[Mlir-commits] [mlir] [mlir][tosa] Support boolean types for clamp folder (PR #151653)
Luke Hutton
llvmlistbot at llvm.org
Fri Aug 1 03:30:40 PDT 2025
================
@@ -498,12 +495,9 @@ struct ClampIsNoOp : public OpRewritePattern<tosa::ClampOp> {
int64_t maxClamp =
llvm::cast<mlir::IntegerAttr>(op.getMaxValAttr()).getInt();
- int64_t intMin =
- APInt::getSignedMinValue(inputElementType.getIntOrFloatBitWidth())
- .getSExtValue();
- int64_t intMax =
- APInt::getSignedMaxValue(inputElementType.getIntOrFloatBitWidth())
- .getSExtValue();
+ unsigned bitWidth = inputElementType.getIntOrFloatBitWidth();
+ int64_t intMin = APInt::getSignedMinValue(bitWidth).getSExtValue();
+ int64_t intMax = APInt::getSignedMaxValue(bitWidth).getSExtValue();
----------------
lhutton1 wrote:
Yep, it seems like we can do `minClamp`, `maxClamp` and `bitWidth` as well
https://github.com/llvm/llvm-project/pull/151653
More information about the Mlir-commits
mailing list