diff --git a/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td b/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td --- a/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td +++ b/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td @@ -71,7 +71,7 @@ Arguments<(ins FloatLike:$operand, DefaultValuedAttr:$fastmath)>, Results<(outs FloatLike:$result)> { - let assemblyFormat = [{ $operand custom($fastmath) + let assemblyFormat = [{ $operand (`fastmath` `` $fastmath^)? attr-dict `:` type($result) }]; } @@ -83,7 +83,7 @@ Arguments<(ins FloatLike:$lhs, FloatLike:$rhs, DefaultValuedAttr:$fastmath)>, Results<(outs FloatLike:$result)> { - let assemblyFormat = [{ $lhs `,` $rhs `` custom($fastmath) + let assemblyFormat = [{ $lhs `,` $rhs (`fastmath` `` $fastmath^)? attr-dict `:` type($result) }]; } diff --git a/mlir/lib/Dialect/Arith/IR/ArithOps.cpp b/mlir/lib/Dialect/Arith/IR/ArithOps.cpp --- a/mlir/lib/Dialect/Arith/IR/ArithOps.cpp +++ b/mlir/lib/Dialect/Arith/IR/ArithOps.cpp @@ -23,31 +23,6 @@ using namespace mlir; using namespace mlir::arith; -//===----------------------------------------------------------------------===// -// Floating point op parse/print helpers -//===----------------------------------------------------------------------===// -static ParseResult parseArithFastMathAttr(OpAsmParser &parser, - Attribute &attr) { - if (succeeded( - parser.parseOptionalKeyword(FastMathFlagsAttr::getMnemonic()))) { - attr = FastMathFlagsAttr::parse(parser, Type{}); - return success(static_cast(attr)); - } else { - // No fastmath attribute mnemonic present - defer attribute creation and use - // the default value. - return success(); - } -} - -static void printArithFastMathAttr(OpAsmPrinter &printer, Operation *op, - FastMathFlagsAttr fmAttr) { - // Elide printing the fastmath attribute when fastmath=none - if (fmAttr && (fmAttr.getValue() != FastMathFlags::none)) { - printer << " " << FastMathFlagsAttr::getMnemonic(); - fmAttr.print(printer); - } -} - //===----------------------------------------------------------------------===// // Pattern helpers //===----------------------------------------------------------------------===//