diff options
-rw-r--r-- | lib/Target/SparcV9/SparcV9InstrInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrInfo.cpp b/lib/Target/SparcV9/SparcV9InstrInfo.cpp index 977360bf00..aa48278fbf 100644 --- a/lib/Target/SparcV9/SparcV9InstrInfo.cpp +++ b/lib/Target/SparcV9/SparcV9InstrInfo.cpp @@ -142,8 +142,9 @@ CreateSETSWConst(const TargetMachine& target, int32_t C, // Set the low 32 bits of dest CreateSETUWConst(target, (uint32_t) C, dest, mvec, /*isSigned*/true); - // Sign-extend to the high 32 bits if needed - if (C < 0 && (-C) > (int32_t) MAXSIMM) + // Sign-extend to the high 32 bits if needed. + // NOTE: The value C = 0x80000000 is bad: -C == C and so -C is < MAXSIMM + if (C < 0 && (C == -C || -C > (int32_t) MAXSIMM)) mvec.push_back(BuildMI(V9::SRA, 3).addReg(dest).addZImm(0).addRegDef(dest)); } |