Lines Matching full:branch
11 // (2) fuses compares and branches into COMPARE AND BRANCH instructions
38 STATISTIC(BranchOnCounts, "Number of branch-on-count instructions");
41 STATISTIC(FusedComparisons, "Number of fused compare-and-branch instructions");
181 // of -1 and if CCUsers is a single branch on nonzero, eliminate the addition
182 // and convert the branch to a BRCT(G) or BRCTH. Return true on success.
203 MachineInstr *Branch = CCUsers[0]; in convertToBRCT() local
204 if (Branch->getOpcode() != SystemZ::BRC || in convertToBRCT()
205 Branch->getOperand(0).getImm() != SystemZ::CCMASK_ICMP || in convertToBRCT()
206 Branch->getOperand(1).getImm() != SystemZ::CCMASK_CMP_NE) in convertToBRCT()
211 // Compare and Branch. in convertToBRCT()
213 MachineBasicBlock::iterator MBBI = Compare, MBBE = Branch; in convertToBRCT()
218 // The transformation is OK. Rebuild Branch as a BRCT(G) or BRCTH. in convertToBRCT()
219 MachineOperand Target(Branch->getOperand(2)); in convertToBRCT()
220 while (Branch->getNumOperands()) in convertToBRCT()
221 Branch->removeOperand(0); in convertToBRCT()
222 Branch->setDesc(TII->get(BRCT)); in convertToBRCT()
223 MachineInstrBuilder MIB(*Branch->getParent()->getParent(), Branch); in convertToBRCT()
226 // branch displacement overflows. BRCTH has a 32-bit displacement, so in convertToBRCT()
236 // the load and convert the branch to a load-and-trap. Return true on success.
247 MachineInstr *Branch = CCUsers[0]; in convertToLoadAndTrap() local
248 if (Branch->getOpcode() != SystemZ::CondTrap || in convertToLoadAndTrap()
249 Branch->getOperand(0).getImm() != SystemZ::CCMASK_ICMP || in convertToLoadAndTrap()
250 Branch->getOperand(1).getImm() != SystemZ::CCMASK_CMP_EQ) in convertToLoadAndTrap()
255 // Compare and Branch. in convertToLoadAndTrap()
257 MachineBasicBlock::iterator MBBI = Compare, MBBE = Branch; in convertToLoadAndTrap()
262 // The transformation is OK. Rebuild Branch as a load-and-trap. in convertToLoadAndTrap()
263 while (Branch->getNumOperands()) in convertToLoadAndTrap()
264 Branch->removeOperand(0); in convertToLoadAndTrap()
265 Branch->setDesc(TII->get(LATOpcode)); in convertToLoadAndTrap()
266 MachineInstrBuilder(*Branch->getParent()->getParent(), Branch) in convertToLoadAndTrap()
518 // Try to remove both MI and Compare by converting a branch to BRCT(G). in optimizeCompareZero()
576 // Try to fuse comparison instruction Compare into a later branch.
580 // See whether we have a single branch with which to fuse. in fuseCompareOperations()
583 MachineInstr *Branch = CCUsers[0]; in fuseCompareOperations() local
585 switch (Branch->getOpcode()) { in fuseCompareOperations()
608 // Make sure that the operands are available at the branch. in fuseCompareOperations()
615 MachineBasicBlock::iterator MBBI = Compare, MBBE = Branch; in fuseCompareOperations()
621 // Read the branch mask, target (if applicable), regmask (if applicable). in fuseCompareOperations()
636 Branch->removeOperand(CCUse); in fuseCompareOperations()
639 Branch->removeOperand(3); in fuseCompareOperations()
640 // Remove target (branch or sibcall). in fuseCompareOperations()
643 Branch->removeOperand(2); in fuseCompareOperations()
644 Branch->removeOperand(1); in fuseCompareOperations()
645 Branch->removeOperand(0); in fuseCompareOperations()
647 // Rebuild Branch as a fused compare and branch. in fuseCompareOperations()
653 Branch->setDesc(TII->get(FusedOpcode)); in fuseCompareOperations()
654 MachineInstrBuilder MIB(*Branch->getParent()->getParent(), Branch); in fuseCompareOperations()
661 // to a non-fused branch because of a long displacement. Conditional in fuseCompareOperations()