[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / metadirective_device_kind_codegen.c
blobf77f50426a16d42b88d8ac632aa42bc90bf766fb
1 // RUN: %clang_cc1 -verify -fopenmp -x c -triple x86_64-unknown-linux -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -verify -fopenmp -x c -triple aarch64-unknown-linux -emit-llvm %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -verify -fopenmp -x c -triple ppc64le-unknown-linux -emit-llvm %s -o - | FileCheck %s
4 // expected-no-diagnostics
5 #ifndef HEADER
6 #define HEADER
8 void bar(void);
10 void foo(void) {
11 #pragma omp metadirective when(device = {kind(any)} \
12 : parallel)
13 bar();
14 #pragma omp metadirective when(device = {kind(host, cpu)} \
15 : parallel for num_threads(4))
16 for (int i = 0; i < 100; i++)
18 #pragma omp metadirective when(device = {kind(host)} \
19 : parallel for)
20 for (int i = 0; i < 100; i++)
22 #pragma omp metadirective when(device = {kind(nohost, gpu)} \
23 :) when(device = {kind(cpu)} \
24 : parallel)
25 bar();
26 #pragma omp metadirective when(device = {kind(any, cpu)} \
27 : parallel)
28 bar();
29 #pragma omp metadirective when(device = {kind(any, host)} \
30 : parallel)
31 bar();
32 #pragma omp metadirective when(device = {kind(gpu)} \
33 : target parallel for) default(parallel for)
34 for (int i = 0; i < 100; i++)
38 // CHECK-LABEL: define {{.+}} void @foo()
39 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_1:@.+]])
40 // CHECK-NEXT: @__kmpc_push_num_threads
41 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_2:@.+]])
42 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_3:@.+]])
43 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_4:@.+]])
44 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_5:@.+]])
45 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_6:@.+]])
46 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_7:@.+]])
47 // CHECK: ret void
49 // CHECK: define internal void [[OUTLINED_1]](
50 // CHECK: call void @bar
51 // CHECK: ret void
53 // CHECK: define internal void [[OUTLINED_2]](
54 // CHECK: call void @__kmpc_for_static_init
55 // CHECK: call void @__kmpc_for_static_fini
56 // CHECK: ret void
58 // CHECK: define internal void [[OUTLINED_3]](
59 // CHECK: call void @__kmpc_for_static_init
60 // CHECK: call void @__kmpc_for_static_fini
61 // CHECK: ret void
63 // CHECK: define internal void [[OUTLINED_4]](
64 // CHECK: call void @bar
65 // CHECK: ret void
67 // CHECK: define internal void [[OUTLINED_5]](
68 // CHECK: call void @bar
69 // CHECK: ret void
71 // CHECK: define internal void [[OUTLINED_6]](
72 // CHECK: call void @bar
73 // CHECK: ret void
75 // CHECK: define internal void [[OUTLINED_7]](
76 // CHECK: call void @__kmpc_for_static_init
77 // CHECK: call void @__kmpc_for_static_fini
78 // CHECK: ret void
80 #endif