xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/flush_codegen.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4*0a6a1f1dSLionel Sambuc // expected-no-diagnostics
5*0a6a1f1dSLionel Sambuc 
6*0a6a1f1dSLionel Sambuc #ifndef HEADER
7*0a6a1f1dSLionel Sambuc #define HEADER
8*0a6a1f1dSLionel Sambuc 
9*0a6a1f1dSLionel Sambuc template <class T>
tmain(T argc)10*0a6a1f1dSLionel Sambuc T tmain(T argc) {
11*0a6a1f1dSLionel Sambuc   static T a;
12*0a6a1f1dSLionel Sambuc #pragma omp flush
13*0a6a1f1dSLionel Sambuc #pragma omp flush(a)
14*0a6a1f1dSLionel Sambuc   return a + argc;
15*0a6a1f1dSLionel Sambuc }
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @main
main()18*0a6a1f1dSLionel Sambuc int main() {
19*0a6a1f1dSLionel Sambuc   static int a;
20*0a6a1f1dSLionel Sambuc #pragma omp flush
21*0a6a1f1dSLionel Sambuc #pragma omp flush(a)
22*0a6a1f1dSLionel Sambuc   // CHECK: call void (%{{.+}}*, ...)* @__kmpc_flush(%{{.+}}* {{(@|%).+}}, i32 0)
23*0a6a1f1dSLionel Sambuc   // CHECK: call void (%{{.+}}*, ...)* @__kmpc_flush(%{{.+}}* {{(@|%).+}}, i32 0)
24*0a6a1f1dSLionel Sambuc   return tmain(a);
25*0a6a1f1dSLionel Sambuc   // CHECK: call {{.*}} [[TMAIN:@.+]](
26*0a6a1f1dSLionel Sambuc   // CHECK: ret
27*0a6a1f1dSLionel Sambuc }
28*0a6a1f1dSLionel Sambuc 
29*0a6a1f1dSLionel Sambuc // CHECK: [[TMAIN]]
30*0a6a1f1dSLionel Sambuc // CHECK: call void (%{{.+}}*, ...)* @__kmpc_flush(%{{.+}}* {{(@|%).+}}, i32 0)
31*0a6a1f1dSLionel Sambuc // CHECK: call void (%{{.+}}*, ...)* @__kmpc_flush(%{{.+}}* {{(@|%).+}}, i32 0)
32*0a6a1f1dSLionel Sambuc // CHECK: ret
33*0a6a1f1dSLionel Sambuc 
34*0a6a1f1dSLionel Sambuc #endif
35