| 1 |
// no PCH |
| 2 |
// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -include %s -include %s %s -o - | FileCheck %s |
| 3 |
// with PCH |
| 4 |
// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s |
| 5 |
// no PCH |
| 6 |
// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1 |
| 7 |
// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2 |
| 8 |
// with PCH |
| 9 |
// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1 |
| 10 |
// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2 |
| 11 |
// // UNSUPPORTED: target={{.*}}-zos{{.*}} |
| 12 |
|
| 13 |
#if !defined(PASS1) |
| 14 |
#define PASS1 |
| 15 |
|
| 16 |
extern "C" int* malloc (int size); |
| 17 |
int *a = malloc(20); |
| 18 |
|
| 19 |
#elif !defined(PASS2) |
| 20 |
#define PASS2 |
| 21 |
|
| 22 |
#pragma omp threadprivate(a) |
| 23 |
|
| 24 |
#else |
| 25 |
|
| 26 |
// CHECK: call {{.*}} @__kmpc_threadprivate_register( |
| 27 |
// CHECK-TLS-1: @{{a|\"\?a@@3PE?AHE?A\"}} = {{.*}}thread_local {{.*}}global {{.*}}ptr |
| 28 |
|
| 29 |
// CHECK-LABEL: foo |
| 30 |
// CHECK-TLS-LABEL: foo |
| 31 |
int foo() { |
| 32 |
return *a; |
| 33 |
// CHECK: call {{.*}} @__kmpc_global_thread_num( |
| 34 |
// CHECK: call {{.*}} @__kmpc_threadprivate_cached( |
| 35 |
// CHECK-TLS-1: call {{.*}} @{{_ZTW1a|\"\?\?__Ea@@YAXXZ\"}}() |
| 36 |
} |
| 37 |
|
| 38 |
// CHECK-TLS-2: define {{.*}} @{{_ZTW1a|\"\?\?__Ea@@YAXXZ\"}}() |
| 39 |
|
| 40 |
#endif |