Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / metadirective_implementation_codegen.c
blobda09b639d6d4098ad279859e983ebef7937650ec
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
6 #ifndef HEADER
7 #define HEADER
9 void bar(void);
11 void foo(void) {
12 #pragma omp metadirective when(implementation = {vendor(score(0) \
13 : llvm)}, \
14 device = {kind(cpu)} \
15 : parallel) default(target teams)
16 bar();
17 #pragma omp metadirective when(device = {kind(gpu)} \
18 : target teams) when(implementation = {vendor(llvm)} \
19 : parallel) default()
20 bar();
21 #pragma omp metadirective default(target) when(implementation = {vendor(score(5) \
22 : llvm)}, \
23 device = {kind(cpu, host)} \
24 : parallel)
25 bar();
26 #pragma omp metadirective when(implementation = {extension(match_all)} \
27 : parallel) default(parallel for)
28 for (int i = 0; i < 100; i++)
30 #pragma omp metadirective when(implementation = {extension(match_any)} \
31 : parallel) default(parallel for)
32 for (int i = 0; i < 100; i++)
34 #pragma omp metadirective when(implementation = {extension(match_none)} \
35 : parallel) default(parallel for)
36 for (int i = 0; i < 100; i++)
40 // CHECK: void @foo()
41 // CHECK-COUNT-6: ...) @__kmpc_fork_call(
42 // CHECK: ret void
44 // CHECK: define internal void @foo.omp_outlined(
45 // CHECK: @bar
46 // CHECK: ret void
48 // CHECK: define internal void @foo.omp_outlined.1(
49 // CHECK: @bar
50 // CHECK: ret void
52 // CHECK: define internal void @foo.omp_outlined.2(
53 // CHECK: @bar
54 // CHECK: ret void
56 // CHECK: define internal void @foo.omp_outlined.3(
57 // NO-CHECK: call void @__kmpc_for_static_init
58 // NO-CHECK: call void @__kmpc_for_static_fini
59 // CHECK: ret void
61 // CHECK: define internal void @foo.omp_outlined.4(
62 // CHECK: call void @__kmpc_for_static_init
63 // CHECK: call void @__kmpc_for_static_fini
64 // CHECK: ret void
66 // CHECK: define internal void @foo.omp_outlined.5(
67 // NO-CHECK: call void @__kmpc_for_static_init
68 // NO-CHECK: call void @__kmpc_for_static_fini
69 // CHECK: ret void
71 #endif