[DAG] TransformFPLoadStorePair - early out if we're not loading a simple type
[llvm-project.git] / clang / test / OpenMP / nvptx_target_cuda_mode_messages.cpp
blob266483f555092a25862c36d27268085ea8b56e66
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>
5 struct TT {
6 tx X;
7 ty Y;
8 };
10 int foo(int n, double *ptr) {
11 int a = 0;
12 short aa = 0;
13 float b[10];
14 double c[5][10];
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}}
21 b[a] = a;
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}}
25 ++i;
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}}
33 aa += 1;
34 b[2] = 1.0;
35 c[1][2] = 1.0;
36 d.X = 1;
37 d.Y = 1;
41 #pragma omp target private(ptr)
43 ptr[0]++;
46 return a;
49 static int fstatic(int n) {
50 int a = 0;
51 char aaa = 0;
52 int b[10];
54 #pragma omp target firstprivate(a, aaa, b)
56 a += 1;
57 aaa += 1;
58 b[2] += 1;
61 return a;
64 struct S1 {
65 double a;
67 int r1(int n) {
68 int b = n + 1;
70 #pragma omp target firstprivate(b) // expected-note {{defined as threadprivate or thread local}}
72 int c; // expected-note {{defined as threadprivate or thread local}}
73 #pragma omp parallel shared(b, c) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
74 this->a = (double)b + 1.5;
77 return (int)b;
81 int bar(int n, double *ptr) {
82 int a = 0;
83 a += foo(n, ptr);
84 S1 S;
85 a += S.r1(n);
86 a += fstatic(n);
88 return a;