diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Basic/OpenMPKinds.def | 1 | ||||
-rw-r--r-- | clang/test/OpenMP/target_update_ast_print.cpp | 22 | ||||
-rw-r--r-- | clang/test/OpenMP/target_update_nowait_messages.cpp | 17 |
3 files changed, 29 insertions, 11 deletions
diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def index cf91bc78c22..eb2a78e0fec 100644 --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -454,6 +454,7 @@ OPENMP_TARGET_UPDATE_CLAUSE(if) OPENMP_TARGET_UPDATE_CLAUSE(device) OPENMP_TARGET_UPDATE_CLAUSE(to) OPENMP_TARGET_UPDATE_CLAUSE(from) +OPENMP_TARGET_UPDATE_CLAUSE(nowait) // Clauses allowed for OpenMP directive 'teams'. // TODO More clauses for 'teams' directive. diff --git a/clang/test/OpenMP/target_update_ast_print.cpp b/clang/test/OpenMP/target_update_ast_print.cpp index fcb8625d7b2..d739aab96bc 100644 --- a/clang/test/OpenMP/target_update_ast_print.cpp +++ b/clang/test/OpenMP/target_update_ast_print.cpp @@ -13,26 +13,26 @@ T foo(T targ, U uarg) { static T a; U b; int l; -#pragma omp target update to(a) if(l>5) device(l) +#pragma omp target update to(a) if(l>5) device(l) nowait -#pragma omp target update from(b) if(l<5) device(l-1) +#pragma omp target update from(b) if(l<5) device(l-1) nowait return a + targ + (T)b; } // CHECK: static int a; // CHECK-NEXT: float b; // CHECK-NEXT: int l; // CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait // CHECK: static char a; // CHECK-NEXT: float b; // CHECK-NEXT: int l; -// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) +// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait // CHECK: static T a; // CHECK-NEXT: U b; // CHECK-NEXT: int l; -// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) +// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait int main(int argc, char **argv) { static int a; @@ -42,10 +42,10 @@ int main(int argc, char **argv) { // CHECK: static int a; // CHECK-NEXT: int n; // CHECK-NEXT: float f; -#pragma omp target update to(a) if(f>0.0) device(n) - // CHECK-NEXT: #pragma omp target update to(a) if(f > 0.) device(n) -#pragma omp target update from(f) if(f<0.0) device(n+1) - // CHECK-NEXT: #pragma omp target update from(f) if(f < 0.) device(n + 1) +#pragma omp target update to(a) if(f>0.0) device(n) nowait +// CHECK-NEXT: #pragma omp target update to(a) if(f > 0.) device(n) nowait +#pragma omp target update from(f) if(f<0.0) device(n+1) nowait +// CHECK-NEXT: #pragma omp target update from(f) if(f < 0.) device(n + 1) nowait return foo(argc, f) + foo(argv[0][0], f) + a; } diff --git a/clang/test/OpenMP/target_update_nowait_messages.cpp b/clang/test/OpenMP/target_update_nowait_messages.cpp new file mode 100644 index 00000000000..19bc58ea467 --- /dev/null +++ b/clang/test/OpenMP/target_update_nowait_messages.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +int main(int argc, char **argv) { + int i; + + #pragma omp nowait target update to(i) // expected-error {{expected an OpenMP directive}} + #pragma omp target nowait update to(i) // expected-error {{unexpected OpenMP clause 'update' in directive '#pragma omp target'}} expected-error {{unexpected OpenMP clause 'to' in directive '#pragma omp target'}} + {} + #pragma omp target update nowait() to(i) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} + #pragma omp target update to(i) nowait( // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} + #pragma omp target update to(i) nowait (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} + #pragma omp target update to(i) nowait device (-10u) + #pragma omp target update to(i) nowait (3.14) device (-10u) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} + #pragma omp target update to(i) nowait nowait // expected-error {{directive '#pragma omp target update' cannot contain more than one 'nowait' clause}} + #pragma omp target update nowait to(i) nowait // expected-error {{directive '#pragma omp target update' cannot contain more than one 'nowait' clause}} + return 0; +} |