1 // RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
2 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-cuda-mode -fopenmp-host-ir-file-path %t-ppc-host.bc -o -
4 template <typename tx
, typename ty
>
10 int foo(int n
, double *ptr
) {
15 TT
<long long, char> d
;
17 #pragma omp target firstprivate(a) map(tofrom: b) // expected-note 2 {{defined as threadprivate or thread local}}
19 int c
; // expected-note {{defined as threadprivate or thread local}}
20 #pragma omp parallel shared(a, b, c, aa) // expected-error 3 {{threadprivate or thread local variable cannot be shared}}
22 #pragma omp parallel for
23 for (int i
= 0; i
< 10; ++i
) // expected-note {{defined as threadprivate or thread local}}
24 #pragma omp parallel shared(i) // expected-error {{threadprivate or thread local variable cannot be shared}}
28 #pragma omp target map(aa, b, c, d)
30 int e
; // expected-note {{defined as threadprivate or thread local}}
31 #pragma omp parallel private(b, e) // expected-error {{threadprivate or thread local variable cannot be private}}
41 #pragma omp target private(ptr)
49 template <typename tx
>
54 #pragma omp target reduction(+ \
55 : a, b) // expected-note {{defined as threadprivate or thread local}}
57 int e
; // expected-note {{defined as threadprivate or thread local}}
58 #pragma omp parallel shared(a, e) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
66 static int fstatic(int n
) {
71 #pragma omp target firstprivate(a, aaa, b)
87 #pragma omp target firstprivate(b) // expected-note {{defined as threadprivate or thread local}}
89 int c
; // expected-note {{defined as threadprivate or thread local}}
90 #pragma omp parallel shared(b, c) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
91 this->a
= (double)b
+ 1.5;
98 int bar(int n
, double *ptr
) {
104 a
+= ftemplate
<int>(n
); // expected-note {{in instantiation of function template specialization 'ftemplate<int>' requested here}}