[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 09:07:08 PST 2024


Sh0g0-1758 wrote:

@RKSimon, The assertion is failing the tests for `SignedDivisionByConstantTest`. I suppose the strict checking is not required, as can also be seen in the original mulh implementation in the test file : 

```
APInt MULHS(APInt X, APInt Y) {
  unsigned Bits = X.getBitWidth();
  unsigned WideBits = 2 * Bits;
  return (X.sext(WideBits) * Y.sext(WideBits)).lshr(Bits).trunc(Bits);
}
```

please confirm If the assertion is required, if so I will look for further changes. 

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


More information about the llvm-commits mailing list