Skip to content

Commit bdb0f61

Browse files
author
Xiang Li
committed
Add nsz.
1 parent e86191a commit bdb0f61

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

mlir/lib/Dialect/Arith/IR/ArithOps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,8 @@ OpFoldResult arith::MulFOp::fold(FoldAdaptor adaptor) {
12841284

12851285
arith::FastMathFlags fmf = getFastmath();
12861286
if (arith::bitEnumContainsAll(fmf, arith::FastMathFlags::nnan |
1287-
arith::FastMathFlags::ninf)) {
1287+
arith::FastMathFlags::ninf |
1288+
arith::FastMathFlags::nsz)) {
12881289
// mulf(x, 0) -> 0
12891290
if (matchPattern(adaptor.getRhs(), m_AnyZeroFloat()))
12901291
return getRhs();

mlir/test/Dialect/Arith/canonicalize.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,7 @@ func.func @test_mulf2(%arg0 : f32) -> f32 {
22212221
// CHECK-NEXT: %[[C0:.+]] = arith.constant 0.000000e+00 : f32
22222222
// CHECK-NEXT: return %[[C0]]
22232223
%c0 = arith.constant 0.0 : f32
2224-
%0 = arith.mulf %c0, %arg0 fastmath<nnan,ninf> : f32
2224+
%0 = arith.mulf %c0, %arg0 fastmath<nnan,ninf,nsz> : f32
22252225
return %0 : f32
22262226
}
22272227

0 commit comments

Comments
 (0)