diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -315,7 +315,7 @@ // Integer types. // Any integer type irrespective of its width and signedness semantics. -def AnyInteger : Type, "integer">; +def AnyInteger : Type()">, "integer">; // Any integer type (regardless of signedness semantics) of a specific width. class AnyI diff --git a/mlir/test/lib/TestDialect/TestOps.td b/mlir/test/lib/TestDialect/TestOps.td --- a/mlir/test/lib/TestDialect/TestOps.td +++ b/mlir/test/lib/TestDialect/TestOps.td @@ -32,7 +32,8 @@ let results = (outs AnyI16:$any_i16, SI32:$si32, - UI64:$ui64 + UI64:$ui64, + AnyInteger:$any_int ); } diff --git a/mlir/test/mlir-tblgen/types.mlir b/mlir/test/mlir-tblgen/types.mlir --- a/mlir/test/mlir-tblgen/types.mlir +++ b/mlir/test/mlir-tblgen/types.mlir @@ -1,9 +1,9 @@ // RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s func @correct_int_types_success() { - "test.int_types"() : () -> (i16, si32, ui64) - "test.int_types"() : () -> (si16, si32, ui64) - "test.int_types"() : () -> (ui16, si32, ui64) + "test.int_types"() : () -> (i16, si32, ui64, i8) + "test.int_types"() : () -> (si16, si32, ui64, ui64) + "test.int_types"() : () -> (ui16, si32, ui64, si128) return } @@ -11,7 +11,7 @@ func @wrong_int_type_signedness_failure() { // expected-error @+1 {{result #1 must be 32-bit signed integer, but got 'ui32'}} - "test.int_types"() : () -> (ui16, ui32, ui64) + "test.int_types"() : () -> (ui16, ui32, ui64, si8) return } @@ -19,7 +19,7 @@ func @wrong_int_type_signedness_failure() { // expected-error @+1 {{result #2 must be 64-bit unsigned integer, but got 'si64'}} - "test.int_types"() : () -> (ui16, si32, si64) + "test.int_types"() : () -> (ui16, si32, si64, ui8) return } @@ -27,7 +27,15 @@ func @wrong_int_type_failure() { // expected-error @+1 {{result #0 must be 16-bit integer, but got 'f16'}} - "test.int_types"() : () -> (f16, si32, ui64) + "test.int_types"() : () -> (f16, si32, ui64, i16) + return +} + +// ----- + +func @wrong_int_type_failure() { + // expected-error @+1 {{result #3 must be integer, but got 'f64'}} + "test.int_types"() : () -> (i16, si32, ui64, f64) return }