diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2003-05-25 21:58:11 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2003-05-25 21:58:11 +0000 |
commit | 5b941461b14621ff61b8fb57bf2602c3c163c3f6 (patch) | |
tree | 817683d6338155ac6335dd695a8ee7ee0cf805ad /llvm/lib/Target/Sparc | |
parent | dd4307ff2b8d618af69ae0e715f065e71bf718d5 (diff) | |
download | bcm5719-llvm-5b941461b14621ff61b8fb57bf2602c3c163c3f6.tar.gz bcm5719-llvm-5b941461b14621ff61b8fb57bf2602c3c163c3f6.zip |
Bug fix: sign-extension was not happening for C = -MININT since C == -C!
llvm-svn: 6332
Diffstat (limited to 'llvm/lib/Target/Sparc')
-rw-r--r-- | llvm/lib/Target/Sparc/SparcInstrInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp index 977360bf006..aa48278fbff 100644 --- a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcInstrInfo.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)); } |