[llvm] [AArch64] Use umin for x != 0 when +cssc is enabled (PR #169159)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 06:59:51 PST 2025


================
@@ -11735,7 +11735,12 @@ SDValue AArch64TargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const {
   }
 
   if (LHS.getValueType().isInteger()) {
-
+    if (Subtarget->hasCSSC() && CC == ISD::SETNE && isNullConstant(RHS)) {
+      SDValue One = DAG.getConstant(1, DL, LHS.getValueType());
+      auto UMin = DAG.getNode(ISD::UMIN, DL, LHS.getValueType(), LHS, One);
+      SDValue Res = DAG.getNode(ISD::TRUNCATE, DL, VT, UMin);
+      return IsStrict ? DAG.getMergeValues({Res, Chain}, DL) : Res;
----------------
MacDue wrote:

:+1: I assumed the` VT == LHS.getValueType()`, ignore this. 

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


More information about the llvm-commits mailing list