diff options
Diffstat (limited to 'llvm/unittests/Support/KnownBitsTest.cpp')
-rw-r--r-- | llvm/unittests/Support/KnownBitsTest.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/llvm/unittests/Support/KnownBitsTest.cpp b/llvm/unittests/Support/KnownBitsTest.cpp index 14c5825..457b7c8 100644 --- a/llvm/unittests/Support/KnownBitsTest.cpp +++ b/llvm/unittests/Support/KnownBitsTest.cpp @@ -300,7 +300,38 @@ TEST(KnownBitsTest, BinaryExhaustive) { return N1.srem(N2); }, checkCorrectnessOnlyBinary); - + testBinaryOpExhaustive( + [](const KnownBits &Known1, const KnownBits &Known2) { + return KnownBits::sadd_sat(Known1, Known2); + }, + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { + return N1.sadd_sat(N2); + }, + checkCorrectnessOnlyBinary); + testBinaryOpExhaustive( + [](const KnownBits &Known1, const KnownBits &Known2) { + return KnownBits::uadd_sat(Known1, Known2); + }, + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { + return N1.uadd_sat(N2); + }, + checkCorrectnessOnlyBinary); + testBinaryOpExhaustive( + [](const KnownBits &Known1, const KnownBits &Known2) { + return KnownBits::ssub_sat(Known1, Known2); + }, + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { + return N1.ssub_sat(N2); + }, + checkCorrectnessOnlyBinary); + testBinaryOpExhaustive( + [](const KnownBits &Known1, const KnownBits &Known2) { + return KnownBits::usub_sat(Known1, Known2); + }, + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { + return N1.usub_sat(N2); + }, + checkCorrectnessOnlyBinary); testBinaryOpExhaustive( [](const KnownBits &Known1, const KnownBits &Known2) { return KnownBits::shl(Known1, Known2); |