Author: kli Date: Mon Jun 20 14:16:34 2016 New Revision: 273190 URL: http://llvm.org/viewvc/llvm-project?rev=273190&view=rev Log: [OpenMP] Add the nowait clause to target update construct.
Differential Revision: http://reviews.llvm.org/D21477 Added: cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/test/OpenMP/target_update_ast_print.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=273190&r1=273189&r2=273190&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Mon Jun 20 14:16:34 2016 @@ -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. Modified: cfe/trunk/test/OpenMP/target_update_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_update_ast_print.cpp?rev=273190&r1=273189&r2=273190&view=diff ============================================================================== --- cfe/trunk/test/OpenMP/target_update_ast_print.cpp (original) +++ cfe/trunk/test/OpenMP/target_update_ast_print.cpp Mon Jun 20 14:16:34 2016 @@ -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; } Added: cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp?rev=273190&view=auto ============================================================================== --- cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp (added) +++ cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp Mon Jun 20 14:16:34 2016 @@ -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; +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits