aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2003-05-25 21:58:11 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2003-05-25 21:58:11 +0000
commitc2f09393205b5be542d984a3f0c65f17dcc417fb (patch)
tree2b10081768c5c77123da2984d500d1702d50b99f /lib/Target
parentf6bcd1b6bfc2e31556662a180cbf96e2e7b00a2e (diff)
downloadexternal_llvm-c2f09393205b5be542d984a3f0c65f17dcc417fb.zip
external_llvm-c2f09393205b5be542d984a3f0c65f17dcc417fb.tar.gz
external_llvm-c2f09393205b5be542d984a3f0c65f17dcc417fb.tar.bz2
Bug fix: sign-extension was not happening for C = -MININT since C == -C!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6332 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/SparcV9/SparcV9InstrInfo.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrInfo.cpp b/lib/Target/SparcV9/SparcV9InstrInfo.cpp
index 977360b..aa48278 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));
}