Home | History | Annotate | Download | only in OpenMP
      1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
      2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
      3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
      4 // expected-no-diagnostics
      5 // REQUIRES: x86-registered-target
      6 #ifndef HEADER
      7 #define HEADER
      8 
      9 // CHECK: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, i8* }
     10 
     11 void foo() {}
     12 
     13 template <class T>
     14 T tmain(T argc) {
     15   static T a;
     16 #pragma omp taskyield
     17   return a + argc;
     18 }
     19 
     20 // CHECK-LABEL: @main
     21 int main(int argc, char **argv) {
     22   static int a;
     23 #pragma omp taskyield
     24   // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* @{{.+}})
     25   // CHECK: call i32 @__kmpc_omp_taskyield([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0)
     26   // CHECK: call {{.+}} [[TMAIN_INT:@.+]](i{{[0-9][0-9]}}
     27   // CHECK: call {{.+}} [[TMAIN_CHAR:@.+]](i{{[0-9]}}
     28   return tmain(argc) + tmain(argv[0][0]) + a;
     29 }
     30 
     31 // CHECK: define {{.+}} [[TMAIN_INT]](
     32 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* @{{.+}})
     33 // CHECK: call i32 @__kmpc_omp_taskyield([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0)
     34 
     35 // CHECK: define {{.+}} [[TMAIN_CHAR]](
     36 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* @{{.+}})
     37 // CHECK: call i32 @__kmpc_omp_taskyield([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0)
     38 
     39 #endif
     40