xref: /llvm-project/clang/test/OpenMP/flush_codegen.cpp (revision 978e0839ae2feb5ddda3e4e0b5a7ddba1727d2d8)
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
5 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
6 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
7 
8 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=60 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
9 // RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
10 // RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
11 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=60 -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
12 // RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
13 // RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
14 
15 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s
16 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
17 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
18 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
19 
20 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=60 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s
21 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=60 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
22 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=60 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
23 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
24 // expected-no-diagnostics
25 #ifndef HEADER
26 #define HEADER
27 
28 template <class T>
29 T tmain(T argc) {
30   static T a;
31 #pragma omp flush
32 #pragma omp flush seq_cst
33 #pragma omp flush acq_rel
34 #pragma omp flush acquire
35 #pragma omp flush release
36 #pragma omp flush(a)
37   return a + argc;
38 }
39 
40 // CHECK-LABEL: @main
41 int main() {
42   static int a;
43 #pragma omp flush
44 #pragma omp flush seq_cst
45 #pragma omp flush acq_rel
46 #pragma omp flush acquire
47 #pragma omp flush release
48 #pragma omp flush(a)
49   // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
50   // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
51   // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
52   // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
53   // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
54   // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
55   return tmain(a);
56   // CHECK: call {{.*}} [[TMAIN:@.+]](
57   // CHECK: ret
58 }
59 
60 // CHECK: [[TMAIN]]
61 // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
62 // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
63 // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
64 // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
65 // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
66 // CHECK: call {{.*}}void @__kmpc_flush(ptr {{(@|%).+}})
67 // CHECK: ret
68 
69 // CHECK-NOT: line: 0,
70 
71 #endif
72