[llvm] [X86] Use the standard cmp+cmov for select (X != 0), -1, Y if we will be setting sbb to 0 anyway (PR #149672)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 19 13:09:16 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Target/X86/X86ISelLowering.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 847dda42d..9ee0cd316 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -24928,7 +24928,7 @@ static SDValue LowerSELECTWithCmpZero(SDValue CmpVal, SDValue LHS, SDValue RHS,
     if (Subtarget.canUseCMOV() &&
         (VT == MVT::i16 || VT == MVT::i32 || VT == MVT::i64) &&
         !Subtarget.hasSBBDepBreaking()) {
-            // Create comparison against zero to set EFLAGS  
+      // Create comparison against zero to set EFLAGS
       SDValue Zero = DAG.getConstant(0, DL, CmpVT);
       SDValue Cmp = DAG.getNode(X86ISD::CMP, DL, MVT::i32, CmpVal, Zero);
 
@@ -24941,8 +24941,7 @@ static SDValue LowerSELECTWithCmpZero(SDValue CmpVal, SDValue LHS, SDValue RHS,
       // FalseVal if condition is false
 
       return DAG.getNode(X86ISD::CMOV, DL, VT, RHS, LHS,
-                                                  DAG.getTargetConstant(X86CC, DL, MVT::i8), 
-                         Cmp);
+                         DAG.getTargetConstant(X86CC, DL, MVT::i8), Cmp);
     }
 
     // Fall back to SBB pattern for older processors or unsupported types

``````````

</details>


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


More information about the llvm-commits mailing list