Use a combination of sethi and or to build arbitrary immediates.
authorChris Lattner <sabre@nondot.org>
Sat, 17 Dec 2005 19:41:43 +0000 (19:41 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 17 Dec 2005 19:41:43 +0000 (19:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24780 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/SparcInstrInfo.td
lib/Target/SparcV8/SparcV8InstrInfo.td

index bc6938b1fdeba46bf2b5920cfe8bb4a6c14ad45c..dee37544ef5278df43422965180b140a86614101 100644 (file)
@@ -39,6 +39,10 @@ def simm13  : PatLeaf<(imm), [{
   return (((int)N->getValue() << (32-13)) >> (32-13)) == (int)N->getValue();
 }]>;
 
+def LO10 : SDNodeXForm<imm, [{
+  return CurDAG->getTargetConstant((unsigned)N->getValue() & 1023, MVT::i32);
+}]>;
+
 def HI22 : SDNodeXForm<imm, [{
   // Transformation function: shift the immediate value down into the low bits.
   return CurDAG->getTargetConstant((unsigned)N->getValue() >> 10, MVT::i32);
@@ -580,3 +584,6 @@ def FCMPED : F3_3<2, 0b110101, 0b001010110,
 // Small immediates.
 def : Pat<(i32 simm13:$val),
           (ORri G0, imm:$val)>;
+// Arbitrary immediates.
+def : Pat<(i32 imm:$val),
+          (ORri (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>;
\ No newline at end of file
index bc6938b1fdeba46bf2b5920cfe8bb4a6c14ad45c..dee37544ef5278df43422965180b140a86614101 100644 (file)
@@ -39,6 +39,10 @@ def simm13  : PatLeaf<(imm), [{
   return (((int)N->getValue() << (32-13)) >> (32-13)) == (int)N->getValue();
 }]>;
 
+def LO10 : SDNodeXForm<imm, [{
+  return CurDAG->getTargetConstant((unsigned)N->getValue() & 1023, MVT::i32);
+}]>;
+
 def HI22 : SDNodeXForm<imm, [{
   // Transformation function: shift the immediate value down into the low bits.
   return CurDAG->getTargetConstant((unsigned)N->getValue() >> 10, MVT::i32);
@@ -580,3 +584,6 @@ def FCMPED : F3_3<2, 0b110101, 0b001010110,
 // Small immediates.
 def : Pat<(i32 simm13:$val),
           (ORri G0, imm:$val)>;
+// Arbitrary immediates.
+def : Pat<(i32 imm:$val),
+          (ORri (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>;
\ No newline at end of file