aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/Sparc
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-12-17 19:41:43 +0000
committerChris Lattner <sabre@nondot.org>2005-12-17 19:41:43 +0000
commitb71f9f8488f665ef042097eca28aeddb85e6c2ee (patch)
treef6fd07225789c7a2a8c85d714aacd54bdf8038b6 /lib/Target/Sparc
parent57dd3bc46049c528858cdd02f76149d9525199fa (diff)
Use a combination of sethi and or to build arbitrary immediates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc')
-rw-r--r--lib/Target/Sparc/SparcInstrInfo.td7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Target/Sparc/SparcInstrInfo.td b/lib/Target/Sparc/SparcInstrInfo.td
index bc6938b1fd..dee37544ef 100644
--- a/lib/Target/Sparc/SparcInstrInfo.td
+++ b/lib/Target/Sparc/SparcInstrInfo.td
@@ -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