[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrInfo.cpp

Vikram Adve vadve at cs.uiuc.edu
Sun May 25 16:59:00 PDT 2003


Changes in directory llvm/lib/Target/Sparc:

SparcInstrInfo.cpp updated: 1.42 -> 1.43

---
Log message:

Bug fix: sign-extension was not happening for C = -MININT since C == -C!


---
Diffs of the changes:

Index: llvm/lib/Target/Sparc/SparcInstrInfo.cpp
diff -u llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.42 llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.43
--- llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.42	Wed May 21 13:48:06 2003
+++ llvm/lib/Target/Sparc/SparcInstrInfo.cpp	Sun May 25 16:58:11 2003
@@ -142,8 +142,9 @@
   // 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));
 }
 





More information about the llvm-commits mailing list