[llvm] [SelectionDAG] Optimize BSWAP yet again once more (PR #165292)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 27 11:29:10 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 origin/main HEAD --extensions cpp -- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/lib/Target/ARM/ARMISelLowering.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/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 03ea2d315..b1950d885 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -9905,8 +9905,8 @@ SDValue TargetLowering::expandBSWAP(SDNode *N, SelectionDAG &DAG) const {
       SDValue Src = Op;
 
       // ror rtmp, r0, #16
-      SDValue Ror16 = DAG.getNode(ISD::ROTR, dl, OpVT, Src,
-                                  DAG.getConstant(16, dl, SHVT));
+      SDValue Ror16 =
+          DAG.getNode(ISD::ROTR, dl, OpVT, Src, DAG.getConstant(16, dl, SHVT));
       // eor r1, r0, rtmp   ; r1 = r0 ^ (r0 ror 16)
       SDValue Xor1 = DAG.getNode(ISD::XOR, dl, OpVT, Src, Ror16);
 
@@ -9921,8 +9921,8 @@ SDValue TargetLowering::expandBSWAP(SDNode *N, SelectionDAG &DAG) const {
                                  DAG.getConstant(8, dl, SHVT));
 
       // ror r0, r0, #8
-      SDValue Ror8 = DAG.getNode(ISD::ROTR, dl, OpVT, Src,
-                                 DAG.getConstant(8, dl, SHVT));
+      SDValue Ror8 =
+          DAG.getNode(ISD::ROTR, dl, OpVT, Src, DAG.getConstant(8, dl, SHVT));
 
       // eor r0, Lsr8, Ror8
       SDValue Result = DAG.getNode(ISD::XOR, dl, OpVT, Lsr8, Ror8);

``````````

</details>


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


More information about the llvm-commits mailing list