[Mlir-commits] [llvm] [mlir] [ADT] Add implementations for mulhs and mulhu to APInt (PR #84609)
Jakub Kuderski
llvmlistbot at llvm.org
Sat Mar 9 13:26:51 PST 2024
================
@@ -490,11 +487,8 @@ arith::MulUIExtendedOp::fold(FoldAdaptor adaptor,
[](const APInt &a, const APInt &b) { return a * b; })) {
// Invoke the constant fold helper again to calculate the 'high' result.
Attribute highAttr = constFoldBinaryOp<IntegerAttr>(
- adaptor.getOperands(), [](const APInt &a, const APInt &b) {
- unsigned bitWidth = a.getBitWidth();
- APInt fullProduct = a.zext(bitWidth * 2) * b.zext(bitWidth * 2);
- return fullProduct.extractBits(bitWidth, bitWidth);
- });
+ adaptor.getOperands(),
+ [](const APInt &a, const APInt &b) { return APIntOps::mulhu(a, b); });
----------------
kuhar wrote:
Also here
https://github.com/llvm/llvm-project/pull/84609
More information about the Mlir-commits
mailing list