[llvm] [AArch64] Form CCMP for CBB and CBH (PR #221113)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 11:02:13 PDT 2026


================
@@ -346,6 +355,20 @@ MachineInstr *SSACCmpConv::findConvertibleCompare(MachineBasicBlock *MBB) {
       }
       return &*I;
     }
+    // Check if any of the operands would need zero- or sign-extension. If so,
+    // bail out
+    case AArch64::CBBAssertExt:
+    case AArch64::CBHAssertExt: {
+      assert(I->getOperand(4).isImm() && "Expected immediate operand");
+      assert(I->getOperand(5).isImm() && "Expected immediate operand");
+      if (I->getOperand(4).getImm() != AArch64_AM::InvalidShiftExtend ||
+          I->getOperand(5).getImm() != AArch64_AM::InvalidShiftExtend) {
+        LLVM_DEBUG(dbgs() << "Folded extend can't be folded into ccmp: " << *I);
+        return nullptr;
----------------
jroelofs wrote:

The others bump a `*Rej` statistic. Do you want that here too?

https://github.com/llvm/llvm-project/pull/221113


More information about the llvm-commits mailing list