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