[llvm] [AArch64] Combine SEXT_INREG(CSET) to CSETM. (PR #156429)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 09:22:09 PDT 2025


================
@@ -26585,6 +26585,26 @@ performSignExtendInRegCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
     return DAG.getNode(SOpc, DL, N->getValueType(0), Ext);
   }
 
+  // Sign extend of CSET -> CSETM.
+  if (Opc == AArch64ISD::CSEL &&
+      cast<VTSDNode>(N->getOperand(1))->getVT() == MVT::i1) {
+    EVT VT = N->getValueType(0);
+    SDValue TVal = Src.getOperand(0);
+    SDValue FVal = Src.getOperand(1);
+
+    // SIGN_EXTEND_INREG (CSEL 0, 1, cc), i1 --> CSEL 0, -1, cc
----------------
rj-jesus wrote:

It does, although it seems the flags operand is not always documented when not relevant, as occurs, for example, in `performCSELCombine`. I've now made it explicit in any case.

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


More information about the llvm-commits mailing list