Skip to content

Commit 8215575

Browse files
committed
Restrict to default rounding mode.
1 parent f3fb4cc commit 8215575

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,17 @@ def TruncIShrUIMulIToMulUIExtended :
423423
// TruncIOp
424424
//===----------------------------------------------------------------------===//
425425

426-
// truncf(sitofp(x)) -> sitofp(x).
426+
// truncf(sitofp(x)) -> sitofp(x) if default rounding mode.
427427
def TruncFSIToFPToSIToFP :
428428
Pat<(Arith_TruncFOp:$tr (Arith_SIToFPOp:$fp $x), $rmf, $fmf),
429-
(Arith_SIToFPOp $x)>;
429+
(Arith_SIToFPOp $x),
430+
[(Constraint<CPred<"$0 == nullptr">, "default rounding mode"> $rmf)]>;
430431

431-
// truncf(sitofp(x)) -> sitofp(x).
432+
// truncf(uitofp(x)) -> uitofp(x) if default rounding mode.
432433
def TruncFUIToFPToUIToFP :
433434
Pat<(Arith_TruncFOp:$tr (Arith_UIToFPOp:$fp $x), $rmf, $fmf),
434-
(Arith_UIToFPOp $x)>;
435+
(Arith_UIToFPOp $x),
436+
[(Constraint<CPred<"$0 == nullptr">, "default rounding mode"> $rmf)]>;
435437

436438
//===----------------------------------------------------------------------===//
437439
// MulFOp

0 commit comments

Comments
 (0)