summaryrefslogtreecommitdiff
path: root/mlir/test/Dialect/OpenACC/invalid.mlir
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/test/Dialect/OpenACC/invalid.mlir')
-rw-r--r--mlir/test/Dialect/OpenACC/invalid.mlir91
1 files changed, 91 insertions, 0 deletions
diff --git a/mlir/test/Dialect/OpenACC/invalid.mlir b/mlir/test/Dialect/OpenACC/invalid.mlir
index 257435c9c4c7..02ddae197b46 100644
--- a/mlir/test/Dialect/OpenACC/invalid.mlir
+++ b/mlir/test/Dialect/OpenACC/invalid.mlir
@@ -303,3 +303,94 @@ acc.private.recipe @privatization_i32 : !llvm.ptr<i32> init {
^bb0(%arg0 : f32):
"test.openacc_dummy_op"(%arg0) : (f32) -> ()
}
+
+// -----
+
+// expected-error@+1 {{expects non-empty init region}}
+acc.firstprivate.recipe @privatization_i32 : !llvm.ptr<i32> init {
+} copy {}
+
+// -----
+
+// expected-error@+1 {{expects init region with one argument of the privatization type}}
+acc.firstprivate.recipe @privatization_i32 : !llvm.ptr<i32> init {
+^bb0(%arg0 : !llvm.ptr<f32>):
+ %c1 = arith.constant 1 : i32
+ %c0 = arith.constant 0 : i32
+ %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr<i32>
+ llvm.store %c0, %0 : !llvm.ptr<i32>
+ acc.yield %0 : !llvm.ptr<i32>
+} copy {}
+
+// -----
+
+// expected-error@+1 {{expects init region to yield a value of the privatization type}}
+acc.firstprivate.recipe @privatization_i32 : !llvm.ptr<f32> init {
+^bb0(%arg0 : !llvm.ptr<f32>):
+ %c1 = arith.constant 1 : i32
+ %c0 = arith.constant 0 : i32
+ %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr<i32>
+ llvm.store %c0, %0 : !llvm.ptr<i32>
+ acc.yield %0 : !llvm.ptr<i32>
+} copy {}
+
+// -----
+
+// expected-error@+1 {{expects non-empty copy region}}
+acc.firstprivate.recipe @privatization_i32 : !llvm.ptr<i32> init {
+^bb0(%arg0 : !llvm.ptr<i32>):
+ %c1 = arith.constant 1 : i32
+ %c0 = arith.constant 0 : i32
+ %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr<i32>
+ llvm.store %c0, %0 : !llvm.ptr<i32>
+ acc.yield %0 : !llvm.ptr<i32>
+} copy {
+}
+
+// -----
+
+// expected-error@+1 {{expects copy region with two arguments of the privatization type}}
+acc.firstprivate.recipe @privatization_i32 : !llvm.ptr<i32> init {
+^bb0(%arg0 : !llvm.ptr<i32>):
+ %c1 = arith.constant 1 : i32
+ %c0 = arith.constant 0 : i32
+ %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr<i32>
+ llvm.store %c0, %0 : !llvm.ptr<i32>
+ acc.yield %0 : !llvm.ptr<i32>
+} copy {
+^bb0(%arg0 : f32):
+ "test.openacc_dummy_op"(%arg0) : (f32) -> ()
+}
+
+// -----
+
+// expected-error@+1 {{expects copy region with two arguments of the privatization type}}
+acc.firstprivate.recipe @privatization_i32 : !llvm.ptr<i32> init {
+^bb0(%arg0 : !llvm.ptr<i32>):
+ %c1 = arith.constant 1 : i32
+ %c0 = arith.constant 0 : i32
+ %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr<i32>
+ llvm.store %c0, %0 : !llvm.ptr<i32>
+ acc.yield %0 : !llvm.ptr<i32>
+} copy {
+^bb0(%arg0 : f32, %arg1 : i32):
+ "test.openacc_dummy_op"(%arg0) : (f32) -> ()
+}
+
+// -----
+
+// expected-error@+1 {{destroy region with one argument of the privatization type}}
+acc.firstprivate.recipe @privatization_i32 : i32 init {
+^bb0(%arg0 : i32):
+ %0 = arith.constant 1 : i32
+ acc.yield %0 : i32
+} copy {
+^bb0(%arg0 : i32, %arg1 : !llvm.ptr<i32>):
+ llvm.store %arg0, %arg1 : !llvm.ptr<i32>
+ acc.yield
+} destroy {
+^bb0(%arg0 : f32):
+ acc.yield
+}
+
+