aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCBranchSelector.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-26 23:41:27 +0000
committerChris Lattner <sabre@nondot.org>2005-08-26 23:41:27 +0000
commitf48e83ded0a27788a4790e73c2c4ad6bed8a7c71 (patch)
tree0f22841f7fe8fa6357ca646cc8dce041860b289d /lib/Target/PowerPC/PPCBranchSelector.cpp
parenteb150d7d1fe0a7c63a9008798324a284bbcb9ce9 (diff)
Propagate cr# from COND_BRANCH to the actual branch instruction as appropriate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCBranchSelector.cpp')
-rw-r--r--lib/Target/PowerPC/PPCBranchSelector.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Target/PowerPC/PPCBranchSelector.cpp b/lib/Target/PowerPC/PPCBranchSelector.cpp
index 9a29eec55f..24187e3b9f 100644
--- a/lib/Target/PowerPC/PPCBranchSelector.cpp
+++ b/lib/Target/PowerPC/PPCBranchSelector.cpp
@@ -106,12 +106,13 @@ namespace {
int Displacement = OffsetMap[trueMBB] - ByteCount;
unsigned Opcode = MBBI->getOperand(1).getImmedValue();
+ unsigned CRReg = MBBI->getOperand(0).getReg();
unsigned Inverted = PPC32InstrInfo::invertPPCBranchOpcode(Opcode);
if (Displacement >= -32768 && Displacement <= 32767) {
- BuildMI(*MBB, MBBJ, Opcode, 2).addReg(PPC::CR0).addMBB(trueMBB);
+ BuildMI(*MBB, MBBJ, Opcode, 2).addReg(CRReg).addMBB(trueMBB);
} else {
- BuildMI(*MBB, MBBJ, Inverted, 2).addReg(PPC::CR0).addSImm(8);
+ BuildMI(*MBB, MBBJ, Inverted, 2).addReg(CRReg).addSImm(8);
BuildMI(*MBB, MBBJ, PPC::B, 1).addMBB(trueMBB);
BuildMI(*MBB, MBBJ, PPC::B, 1).addMBB(falseMBB);
}