From bbdca53bad670b69e299b1094e2d654a3a76e0dd Mon Sep 17 00:00:00 2001 From: Noah Goldstein Date: Mon, 30 Sep 2024 13:09:06 -0500 Subject: [KnownBitsTest] Add optimality tests to some optimal impls; NFC Adding optimality test to `add`, `sub`, `avgCeilU` and `avgFloorU` --- llvm/unittests/Support/KnownBitsTest.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'llvm/unittests/Support/KnownBitsTest.cpp') diff --git a/llvm/unittests/Support/KnownBitsTest.cpp b/llvm/unittests/Support/KnownBitsTest.cpp index b6e16f8..b701757 100644 --- a/llvm/unittests/Support/KnownBitsTest.cpp +++ b/llvm/unittests/Support/KnownBitsTest.cpp @@ -305,15 +305,13 @@ TEST(KnownBitsTest, BinaryExhaustive) { [](const KnownBits &Known1, const KnownBits &Known2) { return KnownBits::add(Known1, Known2); }, - [](const APInt &N1, const APInt &N2) { return N1 + N2; }, - /*CheckOptimality=*/false); + [](const APInt &N1, const APInt &N2) { return N1 + N2; }); testBinaryOpExhaustive( "sub", [](const KnownBits &Known1, const KnownBits &Known2) { return KnownBits::sub(Known1, Known2); }, - [](const APInt &N1, const APInt &N2) { return N1 - N2; }, - /*CheckOptimality=*/false); + [](const APInt &N1, const APInt &N2) { return N1 - N2; }); testBinaryOpExhaustive("umax", KnownBits::umax, APIntOps::umax); testBinaryOpExhaustive("umin", KnownBits::umin, APIntOps::umin); testBinaryOpExhaustive("smax", KnownBits::smax, APIntOps::smax); @@ -524,16 +522,15 @@ TEST(KnownBitsTest, BinaryExhaustive) { /*CheckOptimality=*/false); testBinaryOpExhaustive("avgFloorS", KnownBits::avgFloorS, APIntOps::avgFloorS, - false); + /*CheckOptimality=*/false); - testBinaryOpExhaustive("avgFloorU", KnownBits::avgFloorU, APIntOps::avgFloorU, - false); + testBinaryOpExhaustive("avgFloorU", KnownBits::avgFloorU, + APIntOps::avgFloorU); - testBinaryOpExhaustive("avgCeilU", KnownBits::avgCeilU, APIntOps::avgCeilU, - false); + testBinaryOpExhaustive("avgCeilU", KnownBits::avgCeilU, APIntOps::avgCeilU); testBinaryOpExhaustive("avgCeilS", KnownBits::avgCeilS, APIntOps::avgCeilS, - false); + /*CheckOptimality=*/false); } TEST(KnownBitsTest, UnaryExhaustive) { -- cgit v1.1