[Mlir-commits] [mlir] [MLIR][Arith][Resubmit] add fastMathAttr on arith::extf and arith::truncf (PR #95346)

Ivy Zhang llvmlistbot at llvm.org
Thu Jun 13 08:54:53 PDT 2024


================
@@ -1390,6 +1390,23 @@ LogicalResult arith::ExtSIOp::verify() {
 /// Fold extension of float constants when there is no information loss due the
 /// difference in fp semantics.
 OpFoldResult arith::ExtFOp::fold(FoldAdaptor adaptor) {
+  if (auto truncFOp = getOperand().getDefiningOp<TruncFOp>()) {
+    if (truncFOp.getOperand().getType() == getType()) {
+      arith::FastMathFlags truncFMF =
+          truncFOp.getFastmath().value_or(arith::FastMathFlags::none);
+      bool isTruncContract =
+          bitEnumContainsAll(truncFMF, arith::FastMathFlags::contract);
+      arith::FastMathFlags extFMF =
+          getFastmath().value_or(arith::FastMathFlags::none);
+      ;
----------------
crazydemo wrote:

Thanks for the comment. Fixed.

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


More information about the Mlir-commits mailing list