Use a function in MathExtras to do sign extension.
authorAkira Hatanaka <ahatanaka@mips.com>
Wed, 22 Feb 2012 00:16:54 +0000 (00:16 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Wed, 22 Feb 2012 00:16:54 +0000 (00:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151107 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsAnalyzeImmediate.cpp

index 26c719694cc9fd7dfb0b2856de6ce98c53e3a6f9..44c7769b37d53c4ab71cb094e35181f7c3907a40 100644 (file)
@@ -90,7 +90,7 @@ void MipsAnalyzeImmediate::ReplaceADDiuSLLWithLUi(InstSeq &Seq) {
     return;
 
   // Sign-extend and shift operand of ADDiu and see if it still fits in 16-bit.
-  int64_t Imm = (((int64_t)Seq[0].ImmOpnd) << 48) >> 48;
+  int64_t Imm = SignExtend64<16>(Seq[0].ImmOpnd);
   int64_t ShiftedImm = Imm << (Seq[1].ImmOpnd - 16);
 
   if (!isInt<16>(ShiftedImm))