Alexey Bataev | 7f210c6 | 2015-06-18 13:40:03 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple %itanium_abi_triple -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s |
| 2 | // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s |
| 3 | // RUN: %clang_cc1 -fopenmp -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s |
| 4 | // expected-no-diagnostics |
| 5 | #ifndef HEADER |
| 6 | #define HEADER |
| 7 | |
| 8 | typedef __INTPTR_TYPE__ intptr_t; |
| 9 | |
| 10 | // CHECK-DAG: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } |
| 11 | // CHECK-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00" |
| 12 | // 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) } |
| 13 | |
| 14 | void foo(); |
| 15 | |
| 16 | struct S { |
| 17 | intptr_t a, b, c; |
| 18 | S(intptr_t a) : a(a) {} |
| 19 | operator char() { return a; } |
| 20 | ~S() {} |
| 21 | }; |
| 22 | |
| 23 | template <typename T> |
| 24 | T tmain() { |
| 25 | #pragma omp parallel proc_bind(master) |
| 26 | foo(); |
| 27 | return T(); |
| 28 | } |
| 29 | |
| 30 | int main() { |
| 31 | #pragma omp parallel proc_bind(spread) |
| 32 | foo(); |
| 33 | #pragma omp parallel proc_bind(close) |
| 34 | foo(); |
| 35 | return tmain<int>(); |
| 36 | } |
| 37 | |
| 38 | // CHECK-LABEL: @main |
David Blaikie | ea3e51d | 2015-06-29 17:29:50 +0000 | [diff] [blame] | 39 | // CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) |
| 40 | // CHECK: call {{.*}}void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 4) |
| 41 | // CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( |
| 42 | // CHECK: call {{.*}}void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 3) |
| 43 | // CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( |
Alexey Bataev | 7f210c6 | 2015-06-18 13:40:03 +0000 | [diff] [blame] | 44 | |
| 45 | // CHECK-LABEL: @{{.+}}tmain |
David Blaikie | ea3e51d | 2015-06-29 17:29:50 +0000 | [diff] [blame] | 46 | // CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) |
| 47 | // CHECK: call {{.*}}void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 2) |
| 48 | // CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( |
Alexey Bataev | 7f210c6 | 2015-06-18 13:40:03 +0000 | [diff] [blame] | 49 | // CHECK: ret i32 0 |
| 50 | // CHECK-NEXT: } |
| 51 | |
| 52 | #endif |