[llvm] [llvm] Add KnownBits implementations for avgFloor and avgCeil (PR #86445)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 02:57:56 PDT 2024


================
@@ -559,6 +559,42 @@ TEST(KnownBitsTest, BinaryExhaustive) {
       KnownBits::mulhu,
       [](const APInt &N1, const APInt &N2) { return APIntOps::mulhu(N1, N2); },
       checkCorrectnessOnlyBinary);
+
+  testBinaryOpExhaustive(
+      [](const KnownBits &Known1, const KnownBits &Known2) {
+        return KnownBits::avgFloorS(Known1, Known2);
+      },
+      [](const APInt &N1, const APInt &N2) {
+        return APIntOps::avgFloorS(N1, N2);
+      },
+      checkCorrectnessOnlyBinary);
----------------
RKSimon wrote:

You shouldn't need lambdas for these:
```cpp
testBinaryOpExhaustive(KnownBits::avgFloorS, APIntOps::avgFloorS, checkCorrectnessOnlyBinary);
```

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


More information about the llvm-commits mailing list