[llvm] [ARM] Swap sides of cmp/cmn based on folding ability (PR #191915)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 05:34:52 PDT 2026


================
@@ -4544,12 +4580,22 @@ SDValue ARMTargetLowering::getARMCmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
         break;
       }
     }
-  } else if ((ARM_AM::getShiftOpcForNode(LHS.getOpcode()) != ARM_AM::no_shift) &&
-             (ARM_AM::getShiftOpcForNode(RHS.getOpcode()) == ARM_AM::no_shift)) {
-    // In ARM and Thumb-2, the compare instructions can shift their second
-    // operand.
-    CC = ISD::getSetCCSwappedOperands(CC);
-    std::swap(LHS, RHS);
+  }
+
+  // Prefer folding shifts / CMN into the cmp/cmn second operand (so_reg /
----------------
AZero13 wrote:

I just copy pasted what was in AArch64

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


More information about the llvm-commits mailing list