[llvm] [PowerPC] Extend select_cc lhs, 0, 1, 0, cc optimization to PowerPC 64 (PR #206281)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 27 12:33:33 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/PowerPC/PPCISelDAGToDAG.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/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index dfa95fa87..5baa76664 100644
--- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -5893,9 +5893,8 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
 
     // Handle the setcc cases here.  select_cc lhs, 0, 1, 0, setne
     // Compute (lhs != 0) as: addic tmp, lhs, -1; subfe res, tmp, lhs
-    if (isNullConstant(N->getOperand(1)) &&
-        isOneConstant(N->getOperand(2)) && isNullConstant(N->getOperand(3)) &&
-        CC == ISD::SETNE &&
+    if (isNullConstant(N->getOperand(1)) && isOneConstant(N->getOperand(2)) &&
+        isNullConstant(N->getOperand(3)) && CC == ISD::SETNE &&
         N->getOperand(0).getValueType() == N->getValueType(0) &&
         (N->getValueType(0) == MVT::i32 ||
          (isPPC64 && N->getValueType(0) == MVT::i64))) {
@@ -5905,11 +5904,10 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
       MVT VT = Is64Bit ? MVT::i64 : MVT::i32;
       SDValue ImmOp = Is64Bit ? getI64Imm(~0ULL, dl) : getI32Imm(~0U, dl);
 
-      SDNode *Tmp =
-          CurDAG->getMachineNode(AddicOpc, dl, VT, MVT::Glue,
-                                 N->getOperand(0), ImmOp);
-      CurDAG->SelectNodeTo(N, SubfeOpc, VT, SDValue(Tmp, 0),
-                           N->getOperand(0), SDValue(Tmp, 1));
+      SDNode *Tmp = CurDAG->getMachineNode(AddicOpc, dl, VT, MVT::Glue,
+                                           N->getOperand(0), ImmOp);
+      CurDAG->SelectNodeTo(N, SubfeOpc, VT, SDValue(Tmp, 0), N->getOperand(0),
+                           SDValue(Tmp, 1));
       return;
     }
 

``````````

</details>


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


More information about the llvm-commits mailing list