1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ast-print %s | FileCheck %s 2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s 3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s 4 5 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s | FileCheck %s 6 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s 7 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s 8 // expected-no-diagnostics 9 10 #ifndef HEADER 11 #define HEADER 12 13 void foo() {} 14 15 template <class T, class U> 16 T foo(T targ, U uarg) { 17 static T a, *p; 18 U b; 19 int l; 20 #pragma omp target update to(([a][targ])p, a) if(l>5) device(l) nowait depend(inout:l) 21 22 #pragma omp target update from(b, ([a][targ])p) if(l<5) device(l-1) nowait depend(inout:l) 23 return a + targ + (T)b; 24 } 25 // CHECK: static T a, *p; 26 // CHECK-NEXT: U b; 27 // CHECK-NEXT: int l; 28 // CHECK-NEXT: #pragma omp target update to(([a][targ])p,a) if(l > 5) device(l) nowait depend(inout : l){{$}} 29 // CHECK-NEXT: #pragma omp target update from(b,([a][targ])p) if(l < 5) device(l - 1) nowait depend(inout : l) 30 // CHECK: static int a, *p; 31 // CHECK-NEXT: float b; 32 // CHECK-NEXT: int l; 33 // CHECK-NEXT: #pragma omp target update to(([a][targ])p,a) if(l > 5) device(l) nowait depend(inout : l) 34 // CHECK-NEXT: #pragma omp target update from(b,([a][targ])p) if(l < 5) device(l - 1) nowait depend(inout : l) 35 // CHECK: static char a, *p; 36 // CHECK-NEXT: float b; 37 // CHECK-NEXT: int l; 38 // CHECK-NEXT: #pragma omp target update to(([a][targ])p,a) if(l > 5) device(l) nowait depend(inout : l) 39 // CHECK-NEXT: #pragma omp target update from(b,([a][targ])p) if(l < 5) device(l - 1) nowait depend(inout : l) 40 41 int main(int argc, char **argv) { 42 static int a; 43 int n; 44 float f; 45 46 // CHECK: static int a; 47 // CHECK-NEXT: int n; 48 // CHECK-NEXT: float f; 49 #pragma omp target update to(a) if(f>0.0) device(n) nowait depend(in:n) 50 // CHECK-NEXT: #pragma omp target update to(a) if(f > 0.) device(n) nowait depend(in : n) 51 #pragma omp target update from(f) if(f<0.0) device(n+1) nowait depend(in:n) 52 // CHECK-NEXT: #pragma omp target update from(f) if(f < 0.) device(n + 1) nowait depend(in : n) 53 return foo(argc, f) + foo(argv[0][0], f) + a; 54 } 55 56 #endif 57