Fix the SETHIimm pattern for 64-bit code.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 21 Apr 2013 21:18:03 +0000 (21:18 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 21 Apr 2013 21:18:03 +0000 (21:18 +0000)
Don't ignore the high 32 bits of the immediate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179985 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/SparcInstrInfo.td
test/CodeGen/SPARC/64bit.ll

index 07e07f1db3039b420157d6449cd4d84a8577dfbf..baefb0642d471ba567631e4bac792c82fc94c8df 100644 (file)
@@ -64,8 +64,7 @@ def HI22 : SDNodeXForm<imm, [{
 }]>;
 
 def SETHIimm : PatLeaf<(imm), [{
-  return (((unsigned)N->getZExtValue() >> 10) << 10) ==
-         (unsigned)N->getZExtValue();
+  return isShiftedUInt<22, 10>(N->getZExtValue());
 }], HI22>;
 
 // Addressing modes.
index 108663b2553f5ef2f91841d4348d2157644118a8..2bbf7deb1684f61f08928324275eb801189001b7 100644 (file)
@@ -66,6 +66,12 @@ define i64 @ret_bigimm() {
   ret i64 6800754272627607872
 }
 
+; CHECK: ret_bigimm2
+; CHECK: sethi 1048576
+define i64 @ret_bigimm2() {
+  ret i64 4611686018427387904 ; 0x4000000000000000
+}
+
 ; CHECK: reg_reg_alu
 ; CHECK: add %i0, %i1, [[R0:%[goli][0-7]]]
 ; CHECK: sub [[R0]], %i2, [[R1:%[goli][0-7]]]