1- // RUN: mlir-opt --memref-emulate-wide-int="widest-int-supported=32" %s | FileCheck %s
1+ // RUN: mlir-opt --memref-emulate-wide-int="widest-int-supported=32" %s \
2+ // RUN: --split-input-file --verify-diagnostics | FileCheck %s
23
34// Expect no conversions, i32 is supported.
45// CHECK-LABEL: func @memref_i32
@@ -15,6 +16,8 @@ func.func @memref_i32() {
1516 return
1617}
1718
19+ // -----
20+
1821// Expect no conversions, f64 is not an integer type.
1922// CHECK-LABEL: func @memref_f32
2023// CHECK: [[M:%.+]] = memref.alloc() : memref<4xf32, 1>
@@ -30,6 +33,8 @@ func.func @memref_f32() {
3033 return
3134}
3235
36+ // -----
37+
3338// CHECK-LABEL: func @alloc_load_store_i64
3439// CHECK: [[C1:%.+]] = arith.constant dense<[1, 0]> : vector<2xi32>
3540// CHECK-NEXT: [[M:%.+]] = memref.alloc() : memref<4xvector<2xi32>, 1>
@@ -45,6 +50,7 @@ func.func @alloc_load_store_i64() {
4550 return
4651}
4752
53+ // -----
4854
4955// CHECK-LABEL: func @alloc_load_store_i64_nontemporal
5056// CHECK: [[C1:%.+]] = arith.constant dense<[1, 0]> : vector<2xi32>
@@ -60,3 +66,30 @@ func.func @alloc_load_store_i64_nontemporal() {
6066 memref.store %c1 , %m [%c0 ] {nontemporal = true } : memref <4 xi64 , 1 >
6167 return
6268}
69+
70+ // -----
71+
72+ // Make sure we do not crash on unsupported types.
73+ func.func @alloc_i128 () {
74+ // expected-error@+1 {{failed to legalize operation 'memref.alloc' that was explicitly marked illegal}}
75+ %m = memref.alloc () : memref <4 xi128 , 1 >
76+ return
77+ }
78+
79+ // -----
80+
81+ func.func @load_i128 (%m: memref <4 xi128 , 1 >) {
82+ %c0 = arith.constant 0 : index
83+ // expected-error@+1 {{failed to legalize operation 'memref.load' that was explicitly marked illegal}}
84+ %v = memref.load %m [%c0 ] : memref <4 xi128 , 1 >
85+ return
86+ }
87+
88+ // -----
89+
90+ func.func @store_i128 (%c1: i128 , %m: memref <4 xi128 , 1 >) {
91+ %c0 = arith.constant 0 : index
92+ // expected-error@+1 {{failed to legalize operation 'memref.store' that was explicitly marked illegal}}
93+ memref.store %c1 , %m [%c0 ] : memref <4 xi128 , 1 >
94+ return
95+ }
0 commit comments