1*cba42226Scchen // expected-no-diagnostics
2*cba42226Scchen 
3*cba42226Scchen // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -x c++ -triple %itanium_abi_triple -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
4*cba42226Scchen // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s
5*cba42226Scchen // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
6*cba42226Scchen 
7*cba42226Scchen // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -x c++ -triple %itanium_abi_triple -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s
8*cba42226Scchen // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s
9*cba42226Scchen // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
10*cba42226Scchen // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
11*cba42226Scchen #ifndef HEADER
12*cba42226Scchen #define HEADER
13*cba42226Scchen 
14*cba42226Scchen typedef __INTPTR_TYPE__ intptr_t;
15*cba42226Scchen 
16*cba42226Scchen // CHECK-DAG: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* }
17*cba42226Scchen // CHECK-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00"
18*cba42226Scchen // CHECK-DAG: [[DEF_LOC_2:@.+]] = private unnamed_addr constant [[IDENT_T_TY]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[STR]], i32 0, i32 0) }
19*cba42226Scchen 
20*cba42226Scchen void foo();
21*cba42226Scchen 
22*cba42226Scchen template <typename T>
23*cba42226Scchen T tmain() {
24*cba42226Scchen #pragma omp parallel proc_bind(primary)
25*cba42226Scchen   foo();
26*cba42226Scchen   return T();
27*cba42226Scchen }
28*cba42226Scchen 
29*cba42226Scchen int main() {
30*cba42226Scchen #pragma omp parallel proc_bind(primary)
31*cba42226Scchen   foo();
32*cba42226Scchen   return tmain<int>();
33*cba42226Scchen }
34*cba42226Scchen 
35*cba42226Scchen // CHECK-LABEL: @main
36*cba42226Scchen // CHECK:       [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]])
37*cba42226Scchen // CHECK:       call {{.*}}void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 5)
38*cba42226Scchen // CHECK:       call {{.*}}void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
39*cba42226Scchen 
40*cba42226Scchen // CHECK-LABEL: @{{.+}}tmain
41*cba42226Scchen // CHECK:       [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]])
42*cba42226Scchen // CHECK:       call {{.*}}void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 5)
43*cba42226Scchen // CHECK:       call {{.*}}void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
44*cba42226Scchen // CHECK:       ret i32 0
45*cba42226Scchen // CHECK-NEXT:  }
46*cba42226Scchen 
47*cba42226Scchen #endif
48*cba42226Scchen 
49