summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc/SparcRegInfo.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2003-07-06 20:13:59 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2003-07-06 20:13:59 +0000
commitd09c4c34c0d0eac5cf49b25918f8d94b13a1d1b2 (patch)
tree147c6f1a548e1e420ddee10eda7e0179bc23644a /llvm/lib/Target/Sparc/SparcRegInfo.cpp
parent95b36820bb18ee5747a06838916ed3925a1763c8 (diff)
downloadbcm5719-llvm-d09c4c34c0d0eac5cf49b25918f8d94b13a1d1b2.tar.gz
bcm5719-llvm-d09c4c34c0d0eac5cf49b25918f8d94b13a1d1b2.zip
Major bug fix though it happened rarely (only on a compare after an
integer overflow): We need to use %icc and not %xcc for comparisons on 32-bit or smaller integer values. llvm-svn: 7111
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcRegInfo.cpp')
-rw-r--r--llvm/lib/Target/Sparc/SparcRegInfo.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/llvm/lib/Target/Sparc/SparcRegInfo.cpp b/llvm/lib/Target/Sparc/SparcRegInfo.cpp
index 95bd87f9505..962b9f68d1c 100644
--- a/llvm/lib/Target/Sparc/SparcRegInfo.cpp
+++ b/llvm/lib/Target/Sparc/SparcRegInfo.cpp
@@ -98,11 +98,11 @@ const char * const SparcFloatRegClass::getRegName(unsigned reg) const {
static const char * const IntCCRegNames[] = {
- "xcc", "ccr"
+ "xcc", "icc", "ccr"
};
const char * const SparcIntCCRegClass::getRegName(unsigned reg) const {
- assert(reg < 2);
+ assert(reg < 3);
return IntCCRegNames[reg];
}
@@ -1088,15 +1088,14 @@ UltraSparcRegInfo::cpReg2RegMI(std::vector<MachineInstr*>& mvec,
case IntCCRegType:
if (getRegType(DestReg) == IntRegType) {
// copy intCC reg to int reg
- // Use SrcReg+1 to get the name "%ccr" instead of "%xcc" for RDCCR
- MI = BuildMI(V9::RDCCR, 2).addMReg(SrcReg+1).addMReg(DestReg,MOTy::Def);
+ MI = (BuildMI(V9::RDCCR, 2).addMReg(SparcIntCCRegClass::ccr).
+ addMReg(DestReg,MOTy::Def));
} else {
// copy int reg to intCC reg
- // Use DestReg+1 to get the name "%ccr" instead of "%xcc" for WRCCR
assert(getRegType(SrcReg) == IntRegType
&& "Can only copy CC reg to/from integer reg");
- MI = BuildMI(V9::WRCCRr, 3).addMReg(SrcReg)
- .addMReg(SparcIntRegClass::g0).addMReg(DestReg+1, MOTy::Def);
+ MI = (BuildMI(V9::WRCCRr, 3).addMReg(SrcReg).addMReg(SparcIntRegClass::g0)
+ .addMReg(SparcIntCCRegClass::ccr, MOTy::Def));
}
break;
@@ -1161,9 +1160,8 @@ UltraSparcRegInfo::cpReg2MemMI(std::vector<MachineInstr*>& mvec,
case IntCCRegType:
assert(scratchReg >= 0 && "Need scratch reg to store %ccr to memory");
assert(getRegType(scratchReg) ==IntRegType && "Invalid scratch reg");
-
- // Use SrcReg+1 to get the name "%ccr" instead of "%xcc" for RDCCR
- MI = BuildMI(V9::RDCCR, 2).addMReg(SrcReg+1).addMReg(scratchReg, MOTy::Def);
+ MI = (BuildMI(V9::RDCCR, 2).addMReg(SparcIntCCRegClass::ccr)
+ .addMReg(scratchReg, MOTy::Def));
mvec.push_back(MI);
cpReg2MemMI(mvec, scratchReg, DestPtrReg, Offset, IntRegType);
@@ -1221,10 +1219,8 @@ UltraSparcRegInfo::cpMem2RegMI(std::vector<MachineInstr*>& mvec,
assert(scratchReg >= 0 && "Need scratch reg to load %ccr from memory");
assert(getRegType(scratchReg) ==IntRegType && "Invalid scratch reg");
cpMem2RegMI(mvec, SrcPtrReg, Offset, scratchReg, IntRegType);
-
- // Use DestReg+1 to get the name "%ccr" instead of "%xcc" for WRCCR
MI = BuildMI(V9::WRCCRr, 3).addMReg(scratchReg)
- .addMReg(SparcIntRegClass::g0).addMReg(DestReg+1,MOTy::Def);
+ .addMReg(SparcIntRegClass::g0).addMReg(SparcIntCCRegClass::ccr,MOTy::Def);
break;
case FloatCCRegType: {
OpenPOWER on IntegriCloud