From f48e83ded0a27788a4790e73c2c4ad6bed8a7c71 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 26 Aug 2005 23:41:27 +0000 Subject: [PATCH] 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 --- lib/Target/PowerPC/PPCBranchSelector.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Target/PowerPC/PPCBranchSelector.cpp b/lib/Target/PowerPC/PPCBranchSelector.cpp index 9a29eec55f4..24187e3b9fe 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); } -- 2.34.1