summaryrefslogtreecommitdiffstats
path: root/test/OpenMP/parallel_proc_bind_codegen.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-06-18 13:40:03 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-06-18 13:40:03 +0000
commit848f5c87e2fde8f2d9e11f1964edb582d45b14dc (patch)
tree1d03f7e9704f63f3df029c4f131087346c3bf5de /test/OpenMP/parallel_proc_bind_codegen.cpp
parent86b6cb7ed1b613f4cf69408678eb039b2a2b7a3c (diff)
[OPENMP] Codegen for 'proc_bind' clause (4.0).
Adds emission of the code for 'proc_bind(master|close|spread)' clause: call void @__kmpc_push_proc_bind(<loc>, i32 thread_id, i32 4|3|2) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240018 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/OpenMP/parallel_proc_bind_codegen.cpp')
-rw-r--r--test/OpenMP/parallel_proc_bind_codegen.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/OpenMP/parallel_proc_bind_codegen.cpp b/test/OpenMP/parallel_proc_bind_codegen.cpp
new file mode 100644
index 0000000000..2a8eaee127
--- /dev/null
+++ b/test/OpenMP/parallel_proc_bind_codegen.cpp
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple %itanium_abi_triple -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s
+// 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
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+typedef __INTPTR_TYPE__ intptr_t;
+
+// CHECK-DAG: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* }
+// CHECK-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00"
+// 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) }
+
+void foo();
+
+struct S {
+ intptr_t a, b, c;
+ S(intptr_t a) : a(a) {}
+ operator char() { return a; }
+ ~S() {}
+};
+
+template <typename T>
+T tmain() {
+#pragma omp parallel proc_bind(master)
+ foo();
+ return T();
+}
+
+int main() {
+#pragma omp parallel proc_bind(spread)
+ foo();
+#pragma omp parallel proc_bind(close)
+ foo();
+ return tmain<int>();
+}
+
+// CHECK-LABEL: @main
+// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]])
+// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 4)
+// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
+// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 3)
+// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
+
+// CHECK-LABEL: @{{.+}}tmain
+// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]])
+// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 2)
+// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
+// CHECK: ret i32 0
+// CHECK-NEXT: }
+
+#endif