Skip to content

Commit 554839e

Browse files
committed
[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
1 parent ab2cbb8 commit 554839e

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

mlir/lib/Parser/TypeParser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ OptionalParseResult Parser::parseOptionalType(Type &type) {
3434
case Token::kw_f16:
3535
case Token::kw_f32:
3636
case Token::kw_f64:
37+
case Token::kw_f80:
38+
case Token::kw_f128:
3739
case Token::kw_index:
3840
case Token::kw_none:
3941
case Token::exclamation_identifier:

mlir/test/IR/parser.mlir

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,3 +1420,7 @@ test.dialect_custom_printer custom_format
14201420
// be handled by the dialect.
14211421
// CHECK: test.dialect_custom_format_fallback custom_format_fallback
14221422
test.dialect_custom_format_fallback custom_format_fallback
1423+
1424+
// Check that an op with an optional result parses f80 as type.
1425+
// CHECK: test.format_optional_result_d_op : f80
1426+
test.format_optional_result_d_op : f80

mlir/test/lib/Dialect/Test/TestOps.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,6 +1962,12 @@ def FormatOptionalResultCOp : FormatOptionalResultOpBase<"c", [{
19621962
(`:` functional-type($optional, $variadic)^)? attr-dict
19631963
}]>;
19641964

1965+
def FormatOptionalResultDOp
1966+
: TEST_Op<"format_optional_result_d_op" > {
1967+
let results = (outs Optional<F80>:$optional);
1968+
let assemblyFormat = "(`:` type($optional)^)? attr-dict";
1969+
}
1970+
19651971
def FormatTwoVariadicOperandsNoBuildableTypeOp
19661972
: TEST_Op<"format_two_variadic_operands_no_buildable_type_op",
19671973
[AttrSizedOperandSegments]> {

0 commit comments

Comments
 (0)