diff --git a/lib/Target/Sparc/SparcInstrInfo.td b/lib/Target/Sparc/SparcInstrInfo.td index 07e07f1db30..baefb0642d4 100644 --- a/lib/Target/Sparc/SparcInstrInfo.td +++ b/lib/Target/Sparc/SparcInstrInfo.td @@ -64,8 +64,7 @@ def HI22 : SDNodeXForm; def SETHIimm : PatLeaf<(imm), [{ - return (((unsigned)N->getZExtValue() >> 10) << 10) == - (unsigned)N->getZExtValue(); + return isShiftedUInt<22, 10>(N->getZExtValue()); }], HI22>; // Addressing modes. diff --git a/test/CodeGen/SPARC/64bit.ll b/test/CodeGen/SPARC/64bit.ll index 108663b2553..2bbf7deb168 100644 --- a/test/CodeGen/SPARC/64bit.ll +++ b/test/CodeGen/SPARC/64bit.ll @@ -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]]]