[llvm] [AArch64] Fold SMax and SMin with -1 (PR #208264)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 09:53:38 PDT 2026


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 origin/main HEAD --extensions cpp -- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index a39d4a63a..6824bea0b 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -12650,8 +12650,8 @@ SDValue AArch64TargetLowering::LowerSELECT_CC(
     // (SELECT_CC setgt, lhs, -1, lhs, -1) -> (OR lhs, (SRA lhs, typesize-1))
     // (SELECT_CC setlt, lhs, -1, lhs, -1) -> (ORN lhs, (SRA lhs, typesize-1))
     // Both require less instructions than compare and conditional select.
-    if ((CC == ISD::SETGT || CC == ISD::SETLT) && LHS == TVal &&
-        RHSC && RHSC->isAllOnes() && CFVal && CFVal->isAllOnes() &&
+    if ((CC == ISD::SETGT || CC == ISD::SETLT) && LHS == TVal && RHSC &&
+        RHSC->isAllOnes() && CFVal && CFVal->isAllOnes() &&
         LHS.getValueType() == RHS.getValueType()) {
       EVT VT = LHS.getValueType();
       SDValue Shift =

``````````

</details>


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


More information about the llvm-commits mailing list