Clang Project

clang_source_code/test/OpenMP/flush_codegen.cpp
1// RUN: %clang_cc1 -verify -fopenmp -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
3// RUN: %clang_cc1 -fopenmp -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
5// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s
6// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
7// RUN: %clang_cc1 -fopenmp-simd -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
8// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9// expected-no-diagnostics
10#ifndef HEADER
11#define HEADER
12
13template <class T>
14T tmain(T argc) {
15  static T a;
16#pragma omp flush
17#pragma omp flush(a)
18  return a + argc;
19}
20
21// CHECK-LABEL: @main
22int main() {
23  static int a;
24#pragma omp flush
25#pragma omp flush(a)
26  // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
27  // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
28  return tmain(a);
29  // CHECK: call {{.*}} [[TMAIN:@.+]](
30  // CHECK: ret
31}
32
33// CHECK: [[TMAIN]]
34// CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
35// CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
36// CHECK: ret
37
38// CHECK-NOT: line: 0,
39
40#endif
41