[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / requires_seq_cst_codegen.cpp
blobb7825e7d8503e85d9149e5e740d45fd6617466bd
1 // RUN: %clang_cc1 -verify -fopenmp %s -triple x86_64-apple-darwin10 -x c++ -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -triple x86_64-apple-darwin10
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -triple x86_64-apple-darwin10 -x c++ -emit-llvm -o -| FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd %s -x c++ -emit-llvm -triple x86_64-apple-darwin10 -o -| FileCheck %s --check-prefix SIMD-ONLY0
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s -triple x86_64-apple-darwin10
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -x c++ -emit-llvm -triple x86_64-apple-darwin10 -o -| FileCheck %s --check-prefix SIMD-ONLY0
8 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 // expected-no-diagnostics
11 #ifndef HEADER
12 #define HEADER
14 #pragma omp requires atomic_default_mem_order(seq_cst)
16 // CHECK-LABEL: foo
17 void foo() {
18 int a = 0, b = 0;
19 // CHECK: load atomic i32, {{.*}} seq_cst, align 4
20 #pragma omp atomic read
21 a = b;
22 // CHECK: store atomic i32 {{.*}} seq_cst, align 4
23 #pragma omp atomic write
24 a = b;
25 // CHECK: atomicrmw add ptr {{.*}} seq_cst, align 4
26 #pragma omp atomic
27 a += 1;
28 // CHECK: atomicrmw add ptr {{.*}} seq_cst, align 4
29 #pragma omp atomic update
30 a += 1;
31 // CHECK: atomicrmw add ptr {{.*}} seq_cst, align 4
32 #pragma omp atomic capture
34 b = a;
35 a += 1;
39 #endif