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
5 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
8 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 // expected-no-diagnostics
20 int main(int argc
, char **argv
) {
23 // CHECK: call void @__kmpc_for_static_init_4(
25 // CHECK: call void @__kmpc_for_static_fini(
27 #pragma omp for private(k)
28 for (k
= 0; k
< argc
; k
++)
32 // CHECK: call void @__kmpc_for_static_init_8(
34 // CHECK: call void @__kmpc_for_static_fini(
35 // CHECK: store i32 %{{.+}}, ptr @k
36 #pragma omp for lastprivate(k) collapse(2)
37 for (int i
= 0; i
< 2; ++i
)
38 for (k
= 0; k
< argc
; k
++)
42 // CHECK-NOT: @k{{.+}}!llvm.access.group
43 // CHECK: i32 @{{.+}}bar{{.+}}!llvm.access.group
44 // CHECK-NOT: @k{{.+}}!llvm.access.group
46 // CHECK: store i32 %{{.+}}, ptr @k,
47 #pragma omp simd linear(k : 2)
48 for (k
= 0; k
< argc
; k
++)
51 // CHECK-NOT: @k{{.+}}!llvm.access.group
52 // CHECK: i32 @{{.+}}bar{{.+}}!llvm.access.group
53 // CHECK-NOT: @k{{.+}}!llvm.access.group
55 // CHECK: store i32 %{{.+}}, ptr @k,
57 #pragma omp simd lastprivate(k) collapse(2)
58 for (int i
= 0; i
< 2; ++i
)
59 for (k
= 0; k
< argc
; k
++)
63 // CHECK-NOT: @k{{.+}}!llvm.access.group
64 // CHECK: i32 @{{.+}}bar{{.+}}!llvm.access.group
65 // CHECK-NOT: @k{{.+}}!llvm.access.group
67 // CHECK: store i32 %{{.+}}, ptr @k,
69 for (k
= 0; k
< argc
; k
++)
73 // CHECK-NOT: @k{{.+}}!llvm.access.group
74 // CHECK: i32 @{{.+}}bar{{.+}}!llvm.access.group
75 // CHECK-NOT: @k{{.+}}!llvm.access.group
77 // CHECK: store i32 %{{.+}}, ptr @k,
78 #pragma omp simd collapse(2)
79 for (int i
= 0; i
< 2; ++i
)
80 for (k
= 0; k
< argc
; k
++)
92 // CHECK: call void @__kmpc_for_static_init_4(
93 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
94 // CHECK: call void @__kmpc_for_static_fini(
95 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
96 #pragma omp for private(k)
97 for (k
= 0; k
< argc
; k
++)
101 // CHECK: call void @__kmpc_for_static_init_8(
102 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
103 // CHECK: call void @__kmpc_for_static_fini(
104 #pragma omp for lastprivate(k) collapse(2)
105 for (int i
= 0; i
< 2; ++i
)
106 for (k
= 0; k
< argc
; k
++)
110 // CHECK: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
112 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
113 // CHECK: i32 @{{.+}}bar{{.+}}!llvm.access.group
114 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
115 // CHECK: add nsw i32 %{{.+}}, 1
116 // CHECK: br label {{.+}}, !llvm.loop
117 // CHECK: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
118 #pragma omp simd linear(k : 2)
119 for (k
= 0; k
< argc
; k
++)
123 // CHECK: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
125 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
126 // CHECK: i32 @{{.+}}bar{{.+}}!llvm.access.group
127 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
128 // CHECK: add nsw i64 %{{.+}}, 1
129 // CHECK: br label {{.+}}, !llvm.loop
130 // CHECK: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
131 #pragma omp simd lastprivate(k) collapse(2)
132 for (int i
= 0; i
< 2; ++i
)
133 for (k
= 0; k
< argc
; k
++)
137 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
139 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
140 // CHECK: i32 @{{.+}}bar{{.+}}!llvm.access.group
141 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
142 // CHECK: add nsw i32 %{{.+}}, 1
143 // CHECK: br label {{.+}}, !llvm.loop
144 // CHECK: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
146 for (k
= 0; k
< argc
; k
++)
150 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
152 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
153 // CHECK: i32 @{{.+}}bar{{.+}}!llvm.access.group
154 // CHECK-NOT: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
155 // CHECK: add nsw i64 %{{.+}}, 1
156 // CHECK: br label {{.+}}, !llvm.loop
157 // CHECK: getelementptr inbounds %struct.S, ptr %{{.+}}, i32 0, i32 0
158 #pragma omp simd collapse(2)
159 for (int i
= 0; i
< 2; ++i
)
160 for (k
= 0; k
< argc
; k
++)