[llvm] [Support] Add KnownBits::computeForSubBorrow #65893 (PR #67553)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 06:10:43 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 5109cb28fda8076f057c70bd25af7ed82de1d9b7 6355b54bafcec96770624a6a5df8e0c299be8f3f -- llvm/include/llvm/Support/KnownBits.h llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/lib/Support/KnownBits.cpp llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp llvm/unittests/Support/KnownBitsTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
index 0430c74f7..bb8e76a2e 100644
--- a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
+++ b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp
@@ -268,8 +268,8 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_UADDO_CARRY) {
   KnownBits Known;
 
   auto UnknownBorrow = DAG->getRegister(1, IntVT);
-  auto OpUnknownBorrow = DAG->getNode(
-      ISD::UADDO_CARRY, Loc, IntVT, N0, N1, UnknownBorrow);
+  auto OpUnknownBorrow =
+      DAG->getNode(ISD::UADDO_CARRY, Loc, IntVT, N0, N1, UnknownBorrow);
   // N0 = 0010?000
   // N1 = 01100101
   // B  =        ?
@@ -281,8 +281,8 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_UADDO_CARRY) {
   EXPECT_EQ(Known.One, APInt(8, 0x84));
 
   auto ZeroBorrow = DAG->getConstant(0x0, Loc, IntVT);
-  auto OpZeroBorrow = DAG->getNode(
-      ISD::UADDO_CARRY, Loc, IntVT, N0, N1, ZeroBorrow);
+  auto OpZeroBorrow =
+      DAG->getNode(ISD::UADDO_CARRY, Loc, IntVT, N0, N1, ZeroBorrow);
   // N0 = 0010?000
   // N1 = 01100101
   // B  =        0
@@ -294,8 +294,8 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_UADDO_CARRY) {
   EXPECT_EQ(Known.One, APInt(8, 0x85));
 
   auto OneBorrow = DAG->getConstant(0x1, Loc, IntVT);
-  auto OpOneBorrow = DAG->getNode(
-      ISD::UADDO_CARRY, Loc, IntVT, N0, N1, OneBorrow);
+  auto OpOneBorrow =
+      DAG->getNode(ISD::UADDO_CARRY, Loc, IntVT, N0, N1, OneBorrow);
   // N0 = 0010?000
   // N1 = 01100101
   // B  =        1
@@ -304,7 +304,7 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_UADDO_CARRY) {
   // Known.One  = 10000110 (0x86)
   Known = DAG->computeKnownBits(OpOneBorrow);
   EXPECT_EQ(Known.Zero, APInt(8, 0x71));
-  EXPECT_EQ(Known.One, APInt(8, 0x86)); 
+  EXPECT_EQ(Known.One, APInt(8, 0x86));
 }
 
 // Piggy-backing on the AArch64 tests to verify SelectionDAG::computeKnownBits.
@@ -331,7 +331,7 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_USUBO_CARRY) {
   SDLoc Loc;
   auto IntVT = EVT::getIntegerVT(Context, 8);
   auto N0 = DAG->getConstant(0x5a, Loc, IntVT);
-  auto UnknownOp = DAG->getRegister(0, IntVT);        // ????????
+  auto UnknownOp = DAG->getRegister(0, IntVT);         // ????????
   auto Mask1_Zero = DAG->getConstant(0x8, Loc, IntVT); // 00001000
   auto Mask1_One = DAG->getConstant(0x20, Loc, IntVT); // 00100000
   // N1 = (???????? & 00001000) | 00100000 = 0010?000
@@ -341,8 +341,8 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_USUBO_CARRY) {
   KnownBits Known;
 
   auto UnknownBorrow = DAG->getRegister(1, IntVT);
-  auto OpUnknownBorrow = DAG->getNode(
-      ISD::USUBO_CARRY, Loc, IntVT, N0, N1, UnknownBorrow);
+  auto OpUnknownBorrow =
+      DAG->getNode(ISD::USUBO_CARRY, Loc, IntVT, N0, N1, UnknownBorrow);
   // N0 = 01011010
   // N1 = 0010?000
   // B  =        ?
@@ -354,8 +354,8 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_USUBO_CARRY) {
   EXPECT_EQ(Known.One, APInt(8, 0x30));
 
   auto ZeroBorrow = DAG->getConstant(0x0, Loc, IntVT);
-  auto OpZeroBorrow = DAG->getNode(
-      ISD::USUBO_CARRY, Loc, IntVT, N0, N1, ZeroBorrow);
+  auto OpZeroBorrow =
+      DAG->getNode(ISD::USUBO_CARRY, Loc, IntVT, N0, N1, ZeroBorrow);
   // N0 = 01011010
   // N1 = 0010?000
   // B  =        0
@@ -367,8 +367,8 @@ TEST_F(AArch64SelectionDAGTest, ComputeKnownBits_USUBO_CARRY) {
   EXPECT_EQ(Known.One, APInt(8, 0x32));
 
   auto OneBorrow = DAG->getConstant(0x1, Loc, IntVT);
-  auto OpOneBorrow = DAG->getNode(
-      ISD::USUBO_CARRY, Loc, IntVT, N0, N1, OneBorrow);
+  auto OpOneBorrow =
+      DAG->getNode(ISD::USUBO_CARRY, Loc, IntVT, N0, N1, OneBorrow);
   // N0 = 01011010
   // N1 = 0010?000
   // B  =        1

``````````

</details>


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


More information about the llvm-commits mailing list