[Mlir-commits] [mlir] 554839e - [mlir] support f80 and f128 in parseOptionalType

Alex Zinenko llvmlistbot at llvm.org
Wed Mar 2 05:56:56 PST 2022


Author: Alex Zinenko
Date: 2022-03-02T14:56:47+01:00
New Revision: 554839ecdf73104777f38830b5dbcfbf4a1804d4

URL: https://github.com/llvm/llvm-project/commit/554839ecdf73104777f38830b5dbcfbf4a1804d4
DIFF: https://github.com/llvm/llvm-project/commit/554839ecdf73104777f38830b5dbcfbf4a1804d4.diff

LOG: [mlir] support f80 and f128 in parseOptionalType

This seems to have been forgotten when the types were introduced.

Reviewed By: wsmoses

Differential Revision: https://reviews.llvm.org/D120737

Added: 
    

Modified: 
    mlir/lib/Parser/TypeParser.cpp
    mlir/test/IR/parser.mlir
    mlir/test/lib/Dialect/Test/TestOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Parser/TypeParser.cpp b/mlir/lib/Parser/TypeParser.cpp
index c4699ee5b7290..59ee740661286 100644
--- a/mlir/lib/Parser/TypeParser.cpp
+++ b/mlir/lib/Parser/TypeParser.cpp
@@ -34,6 +34,8 @@ OptionalParseResult Parser::parseOptionalType(Type &type) {
   case Token::kw_f16:
   case Token::kw_f32:
   case Token::kw_f64:
+  case Token::kw_f80:
+  case Token::kw_f128:
   case Token::kw_index:
   case Token::kw_none:
   case Token::exclamation_identifier:

diff  --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir
index 67c18a7644db1..f8c95a317b870 100644
--- a/mlir/test/IR/parser.mlir
+++ b/mlir/test/IR/parser.mlir
@@ -1420,3 +1420,7 @@ test.dialect_custom_printer custom_format
 // be handled by the dialect.
 // CHECK: test.dialect_custom_format_fallback custom_format_fallback
 test.dialect_custom_format_fallback custom_format_fallback
+
+// Check that an op with an optional result parses f80 as type.
+// CHECK: test.format_optional_result_d_op : f80
+test.format_optional_result_d_op : f80

diff  --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index 4bf82ada9aac6..9ab7d9e62e67c 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -1962,6 +1962,12 @@ def FormatOptionalResultCOp : FormatOptionalResultOpBase<"c", [{
   (`:` functional-type($optional, $variadic)^)? attr-dict
 }]>;
 
+def FormatOptionalResultDOp
+  : TEST_Op<"format_optional_result_d_op" > {
+  let results = (outs Optional<F80>:$optional);
+  let assemblyFormat = "(`:` type($optional)^)? attr-dict";
+}
+
 def FormatTwoVariadicOperandsNoBuildableTypeOp
     : TEST_Op<"format_two_variadic_operands_no_buildable_type_op",
               [AttrSizedOperandSegments]> {


        


More information about the Mlir-commits mailing list