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

llvm-svn: 6332
diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp
index 977360b..aa48278 100644
--- a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp
+++ b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp
@@ -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));
 }