summaryrefslogtreecommitdiffstats
path: root/test/OpenMP/cancellation_point_codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/OpenMP/cancellation_point_codegen.cpp')
-rw-r--r--test/OpenMP/cancellation_point_codegen.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/OpenMP/cancellation_point_codegen.cpp b/test/OpenMP/cancellation_point_codegen.cpp
index 4533930..795f69e 100644
--- a/test/OpenMP/cancellation_point_codegen.cpp
+++ b/test/OpenMP/cancellation_point_codegen.cpp
@@ -11,12 +11,16 @@ int main (int argc, char **argv) {
#pragma omp parallel
{
#pragma omp cancellation point parallel
+#pragma omp cancel parallel
argv[0][0] = argc;
}
// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
#pragma omp sections
{
+ {
#pragma omp cancellation point sections
+#pragma omp cancel sections
+ }
}
// CHECK: call i32 @__kmpc_single(
// CHECK-NOT: @__kmpc_cancellationpoint
@@ -28,6 +32,7 @@ int main (int argc, char **argv) {
#pragma omp section
{
#pragma omp cancellation point sections
+#pragma omp cancel sections
}
}
// CHECK: call void @__kmpc_for_static_init_4(
@@ -51,6 +56,7 @@ int main (int argc, char **argv) {
#pragma omp for
for (int i = 0; i < argc; ++i) {
#pragma omp cancellation point for
+#pragma omp cancel for
}
// CHECK: call void @__kmpc_for_static_init_4(
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 [[GTID]], i32 2)
@@ -66,9 +72,36 @@ for (int i = 0; i < argc; ++i) {
#pragma omp task
{
#pragma omp cancellation point taskgroup
+#pragma omp cancel taskgroup
}
// CHECK: call i8* @__kmpc_omp_task_alloc(
// CHECK: call i32 @__kmpc_omp_task(
+#pragma omp parallel sections
+{
+ {
+#pragma omp cancellation point sections
+#pragma omp cancel sections
+ }
+}
+// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
+#pragma omp parallel sections
+{
+ {
+#pragma omp cancellation point sections
+#pragma omp cancel sections
+ }
+#pragma omp section
+ {
+#pragma omp cancellation point sections
+ }
+}
+// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
+#pragma omp parallel for
+for (int i = 0; i < argc; ++i) {
+#pragma omp cancellation point for
+#pragma omp cancel for
+}
+// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
return argc;
}
@@ -92,4 +125,44 @@ for (int i = 0; i < argc; ++i) {
// CHECK: [[RETURN]]
// CHECK: ret i32 0
+// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
+// CHECK: call i32 @__kmpc_single(
+// CHECK-NOT: @__kmpc_cancellationpoint
+// CHECK: call void @__kmpc_end_single(
+// CHECK: ret void
+
+// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
+// CHECK: call void @__kmpc_for_static_init_4(
+// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 [[GTID:%.+]], i32 3)
+// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
+// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
+// CHECK: [[EXIT]]
+// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t*
+// CHECK: br label
+// CHECK: [[CONTINUE]]
+// CHECK: br label
+// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 [[GTID]], i32 3)
+// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
+// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
+// CHECK: [[EXIT]]
+// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t*
+// CHECK: br label
+// CHECK: [[CONTINUE]]
+// CHECK: br label
+// CHECK: call void @__kmpc_for_static_fini(
+// CHECK: ret void
+
+// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}},
+// CHECK: call void @__kmpc_for_static_init_4(
+// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 [[GTID:%.+]], i32 2)
+// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
+// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
+// CHECK: [[EXIT]]
+// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t*
+// CHECK: br label
+// CHECK: [[CONTINUE]]
+// CHECK: br label
+// CHECK: call void @__kmpc_for_static_fini(
+// CHECK: ret void
+
#endif
OpenPOWER on IntegriCloud