[llvm] [MIPS] Fix miscompile of 64-bit shift with masked shift amount (PR #71154)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 01:42:17 PDT 2023


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 8e2b3309a975748649a504620a9600da9fe3c837 3d0a76a0fed02d07307c129fd6fbe02d94b74ed9 -- llvm/lib/Target/Mips/MipsISelLowering.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp
index 3f6122543c26..269cc397536d 100644
--- a/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -2599,7 +2599,7 @@ SDValue MipsTargetLowering::lowerShiftLeftParts(SDValue Op,
   //  hi = (shl lo, shamt[4:0])
   SDValue Not =
       DAG.getNode(ISD::XOR, DL, MVT::i32, Shamt,
-		  DAG.getConstant(VT.getSizeInBits() - 1, DL, MVT::i32));
+                  DAG.getConstant(VT.getSizeInBits() - 1, DL, MVT::i32));
   SDValue ShiftRight1Lo = DAG.getNode(ISD::SRL, DL, VT, Lo,
                                       DAG.getConstant(1, DL, VT));
   SDValue ShiftRightLo = DAG.getNode(ISD::SRL, DL, VT, ShiftRight1Lo, Not);
@@ -2607,7 +2607,7 @@ SDValue MipsTargetLowering::lowerShiftLeftParts(SDValue Op,
   SDValue Or = DAG.getNode(ISD::OR, DL, VT, ShiftLeftHi, ShiftRightLo);
   SDValue ShamtMasked =
       DAG.getNode(ISD::AND, DL, MVT::i32, Shamt,
-		  DAG.getConstant(VT.getSizeInBits() - 1, DL, MVT::i32));
+                  DAG.getConstant(VT.getSizeInBits() - 1, DL, MVT::i32));
   SDValue ShiftLeftLo = DAG.getNode(ISD::SHL, DL, VT, Lo, ShamtMasked);
   SDValue Cond = DAG.getNode(ISD::AND, DL, MVT::i32, Shamt,
                              DAG.getConstant(VT.getSizeInBits(), DL, MVT::i32));
@@ -2641,7 +2641,7 @@ SDValue MipsTargetLowering::lowerShiftRightParts(SDValue Op, SelectionDAG &DAG,
   //   hi = 0
   SDValue Not =
       DAG.getNode(ISD::XOR, DL, MVT::i32, Shamt,
-		  DAG.getConstant(VT.getSizeInBits() - 1, DL, MVT::i32));
+                  DAG.getConstant(VT.getSizeInBits() - 1, DL, MVT::i32));
   SDValue ShiftLeft1Hi = DAG.getNode(ISD::SHL, DL, VT, Hi,
                                      DAG.getConstant(1, DL, VT));
   SDValue ShiftLeftHi = DAG.getNode(ISD::SHL, DL, VT, ShiftLeft1Hi, Not);
@@ -2649,7 +2649,7 @@ SDValue MipsTargetLowering::lowerShiftRightParts(SDValue Op, SelectionDAG &DAG,
   SDValue Or = DAG.getNode(ISD::OR, DL, VT, ShiftLeftHi, ShiftRightLo);
   SDValue ShamtMasked =
       DAG.getNode(ISD::AND, DL, MVT::i32, Shamt,
-		  DAG.getConstant(VT.getSizeInBits() - 1, DL, MVT::i32));
+                  DAG.getConstant(VT.getSizeInBits() - 1, DL, MVT::i32));
   SDValue ShiftRightHi =
       DAG.getNode(IsSRA ? ISD::SRA : ISD::SRL, DL, VT, Hi, ShamtMasked);
   SDValue Cond = DAG.getNode(ISD::AND, DL, MVT::i32, Shamt,

``````````

</details>


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


More information about the llvm-commits mailing list