[Mlir-commits] [mlir] [mlir][emitc] Restrict integer and float types (PR #85788)

Tina Jung llvmlistbot at llvm.org
Wed Mar 20 03:28:29 PDT 2024


================
@@ -81,3 +81,19 @@ func.func @illegal_array_with_tensor_element_type(
     %arg0: !emitc.array<4xtensor<4xi32>>
 ) {
 }
+
+// -----
+
+func.func @illegal_integer_type(%arg0: i11, %arg1: i11) -> i11 {
+    // expected-error @+1 {{'emitc.mul' op operand #0 must be floating-point type supported by EmitC or integer type supported by EmitC or index or EmitC opaque type, but got 'i11'}}
+    %mul = "emitc.mul" (%arg0, %arg1) : (i11, i11) -> i11
+    return
+}
+
+// -----
+
+func.func @illegal_float_type(%arg0: f80, %arg1: f80) {
+    // expected-error @+1 {{'emitc.mul' op operand #0 must be floating-point type supported by EmitC or integer type supported by EmitC or index or EmitC opaque type, but got 'f80'}}
+    %mul = "emitc.mul" (%arg0, %arg1) : (f80, f80) -> f80
+    return
+}
----------------
TinaAMD wrote:

@marbre I added tests for invalid int and float types to the invalid type tests. Since we only have the checks enable for binary ops (so far), I used an operator in the test to show the error message. Was that the kind of test you would expect for the invalid types?

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


More information about the Mlir-commits mailing list