[llvm] [KnownBits] Add KnownBits::absdiff to compute the absolute difference of 2 unsigned values (PR #82354)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 03:22:27 PST 2024


================
@@ -281,7 +281,14 @@ TEST(KnownBitsTest, BinaryExhaustive) {
         return KnownBits::smin(Known1, Known2);
       },
       [](const APInt &N1, const APInt &N2) { return APIntOps::smin(N1, N2); });
-
+  testBinaryOpExhaustive(
+      [](const KnownBits &Known1, const KnownBits &Known2) {
+        return KnownBits::absdiff(Known1, Known2);
+      },
+      [](const APInt &N1, const APInt &N2) {
+        return APIntOps::absdiff(N1, N2);
+      },
+      checkCorrectnessOnlyBinary);
----------------
RKSimon wrote:

I've added an example for each absdiff path

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


More information about the llvm-commits mailing list