From a7721f6b4de876cb905b2d22acfc442aca76630e Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 22 Feb 2012 00:16:54 +0000 Subject: [PATCH] Use a function in MathExtras to do sign extension. llvm-svn: 151107 --- llvm/lib/Target/Mips/MipsAnalyzeImmediate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/Mips/MipsAnalyzeImmediate.cpp b/llvm/lib/Target/Mips/MipsAnalyzeImmediate.cpp index 26c719694cc9..44c7769b37d5 100644 --- a/llvm/lib/Target/Mips/MipsAnalyzeImmediate.cpp +++ b/llvm/lib/Target/Mips/MipsAnalyzeImmediate.cpp @@ -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))