diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-25 10:37:12 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-25 10:37:12 +0000 |
| commit | 346265e3bcee55bff42849683ec01506e67fc5c8 (patch) | |
| tree | a85101f4317cdc897ec25b43aa6b46b6da817f7a /clang/test/OpenMP | |
| parent | c2bb0cbe00b66465a4d73886ce7162243d902769 (diff) | |
| download | bcm5719-llvm-346265e3bcee55bff42849683ec01506e67fc5c8.tar.gz bcm5719-llvm-346265e3bcee55bff42849683ec01506e67fc5c8.zip | |
[OPENMP 4.1] Add 'threads' clause for '#pragma omp ordered'.
OpenMP 4.1 extends format of '#pragma omp ordered'. It adds 3 additional clauses: 'threads', 'simd' and 'depend'.
If no clause is specified, the ordered construct behaves as if the threads clause had been specified. If the threads clause is specified, the threads in the team executing the loop region execute ordered regions sequentially in the order of the loop iterations.
The loop region to which an ordered region without any clause or with a threads clause binds must have an ordered clause without the parameter specified on the corresponding loop directive.
llvm-svn: 248569
Diffstat (limited to 'clang/test/OpenMP')
| -rw-r--r-- | clang/test/OpenMP/ordered_ast_print.cpp | 30 | ||||
| -rw-r--r-- | clang/test/OpenMP/ordered_codegen.cpp | 4 | ||||
| -rw-r--r-- | clang/test/OpenMP/ordered_messages.cpp | 42 |
3 files changed, 74 insertions, 2 deletions
diff --git a/clang/test/OpenMP/ordered_ast_print.cpp b/clang/test/OpenMP/ordered_ast_print.cpp index 0006080b208..f8601c51bad 100644 --- a/clang/test/OpenMP/ordered_ast_print.cpp +++ b/clang/test/OpenMP/ordered_ast_print.cpp @@ -18,6 +18,12 @@ T tmain (T argc) { { a=2; } + #pragma omp for ordered + for (int i =0 ; i < argc; ++i) + #pragma omp ordered threads + { + a=2; + } return (0); } @@ -28,6 +34,12 @@ T tmain (T argc) { // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } +// CHECK-NEXT: #pragma omp for ordered +// CHECK-NEXT: for (int i = 0; i < argc; ++i) +// CHECK-NEXT: #pragma omp ordered threads +// CHECK-NEXT: { +// CHECK-NEXT: a = 2; +// CHECK-NEXT: } // CHECK: static T a; // CHECK-NEXT: #pragma omp for ordered @@ -36,6 +48,12 @@ T tmain (T argc) { // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } +// CHECK-NEXT: #pragma omp for ordered +// CHECK-NEXT: for (int i = 0; i < argc; ++i) +// CHECK-NEXT: #pragma omp ordered threads +// CHECK-NEXT: { +// CHECK-NEXT: a = 2; +// CHECK-NEXT: } int main (int argc, char **argv) { int b = argc, c, d, e, f, g; @@ -47,12 +65,24 @@ int main (int argc, char **argv) { { a=2; } + #pragma omp for ordered + for (int i =0 ; i < argc; ++i) + #pragma omp ordered threads + { + a=2; + } // CHECK-NEXT: #pragma omp for ordered // CHECK-NEXT: for (int i = 0; i < argc; ++i) // CHECK-NEXT: #pragma omp ordered // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } +// CHECK-NEXT: #pragma omp for ordered +// CHECK-NEXT: for (int i = 0; i < argc; ++i) +// CHECK-NEXT: #pragma omp ordered threads +// CHECK-NEXT: { +// CHECK-NEXT: a = 2; +// CHECK-NEXT: } return tmain(argc); } diff --git a/clang/test/OpenMP/ordered_codegen.cpp b/clang/test/OpenMP/ordered_codegen.cpp index ff8a8047cae..e9a7b1390fe 100644 --- a/clang/test/OpenMP/ordered_codegen.cpp +++ b/clang/test/OpenMP/ordered_codegen.cpp @@ -92,7 +92,7 @@ void dynamic1(float *a, float *b, float *c, float *d) { // CHECK-NOT: !llvm.mem.parallel_loop_access // CHECK-NEXT: call void @__kmpc_end_ordered([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) // ... end of ordered region ... - #pragma omp ordered + #pragma omp ordered threads a[i] = b[i] * c[i] * d[i]; // CHECK: [[IV1_2:%.+]] = load i64, i64* [[OMP_IV]]{{.*}} // CHECK-NEXT: [[ADD1_2:%.+]] = add i64 [[IV1_2]], 1 @@ -197,7 +197,7 @@ void runtime(float *a, float *b, float *c, float *d) { // CHECK-NOT: !llvm.mem.parallel_loop_access // CHECK-NEXT: call void @__kmpc_end_ordered([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) // ... end of ordered region ... - #pragma omp ordered + #pragma omp ordered threads a[i] = b[i] * c[i] * d[i]; // CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}} // CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1 diff --git a/clang/test/OpenMP/ordered_messages.cpp b/clang/test/OpenMP/ordered_messages.cpp index 72e59b7c764..039a2b5fbf5 100644 --- a/clang/test/OpenMP/ordered_messages.cpp +++ b/clang/test/OpenMP/ordered_messages.cpp @@ -24,6 +24,27 @@ T foo() { foo(); } } + #pragma omp for ordered + for (int i = 0; i < 10; ++i) { + #pragma omp ordered threads threads // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'threads' clause}} + { + foo(); + } + } + #pragma omp for ordered(1) // expected-note {{'ordered' clause with specified parameter}} + for (int i = 0; i < 10; ++i) { + #pragma omp ordered // expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}} + { + foo(); + } + } + #pragma omp for ordered(1) // expected-note {{'ordered' clause with specified parameter}} + for (int i = 0; i < 10; ++i) { + #pragma omp ordered threads // expected-error {{'ordered' directive with 'threads' clause cannot be closely nested inside ordered region with specified parameter}} + { + foo(); + } + } return T(); } @@ -49,6 +70,27 @@ int foo() { foo(); } } + #pragma omp for ordered + for (int i = 0; i < 10; ++i) { + #pragma omp ordered threads threads // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'threads' clause}} + { + foo(); + } + } + #pragma omp for ordered(1) // expected-note {{'ordered' clause with specified parameter}} + for (int i = 0; i < 10; ++i) { + #pragma omp ordered // expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}} + { + foo(); + } + } + #pragma omp for ordered(1) // expected-note {{'ordered' clause with specified parameter}} + for (int i = 0; i < 10; ++i) { + #pragma omp ordered threads // expected-error {{'ordered' directive with 'threads' clause cannot be closely nested inside ordered region with specified parameter}} + { + foo(); + } + } return foo<int>(); } |

