[llvm] [ADT] Add implementations for mulhs and mulhu to APInt (PR #84609)

Shourya Goel via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 9 12:39:05 PST 2024


================
@@ -537,19 +537,13 @@ TEST(KnownBitsTest, BinaryExhaustive) {
       [](const KnownBits &Known1, const KnownBits &Known2) {
         return KnownBits::mulhs(Known1, Known2);
       },
-      [](const APInt &N1, const APInt &N2) {
-        unsigned Bits = N1.getBitWidth();
-        return (N1.sext(2 * Bits) * N2.sext(2 * Bits)).extractBits(Bits, Bits);
-      },
+      [](const APInt &N1, const APInt &N2) { return APIntOps::mulhs(N1, N2); },
----------------
Sh0g0-1758 wrote:

Hm... I think it should because the first one uses a lambda function as a functor, while the second one directly passes a pointer to the member function APIntOps::mulhs.

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


More information about the llvm-commits mailing list