1 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -x c -std=c99 -ast-print %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -x c -std=c99 -ast-print %s -o - | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp -triple amdgcn-amd-amdhsa -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=CHECK-AMDGCN
7 // RUN: %clang_cc1 -verify -fopenmp-simd -triple amdgcn-amd-amdhsa -x c -std=c99 -ast-print %s -o - | FileCheck %s --check-prefix=CHECK-AMDGCN
8 // expected-no-diagnostics
17 #pragma omp metadirective when(device = {kind(cpu)} \
20 #pragma omp metadirective when(implementation = {vendor(score(0) \
22 device = {kind(cpu)} \
23 : parallel) default(target teams)
25 #pragma omp metadirective when(device = {kind(gpu)} \
26 : target teams) when(implementation = {vendor(llvm)} \
29 #pragma omp metadirective default(target) when(implementation = {vendor(score(5) \
31 device = {kind(cpu, host)} \
34 #pragma omp metadirective when(user = {condition(N > 10)} \
35 : target) when(user = {condition(N == 10)} \
38 #pragma omp metadirective when(device = {kind(host)} \
40 for (int i
= 0; i
< 100; i
++)
42 #pragma omp metadirective when(implementation = {extension(match_all)} \
43 : parallel) default(parallel for)
44 for (int i
= 0; i
< 100; i
++)
46 #pragma omp metadirective when(implementation = {extension(match_any)} \
47 : parallel) default(parallel for)
48 for (int i
= 0; i
< 100; i
++)
50 #pragma omp metadirective when(implementation = {extension(match_none)} \
51 : parallel) default(parallel for)
52 for (int i
= 0; i
< 100; i
++)
55 // Test metadirective with nested OpenMP directive.
57 #pragma omp metadirective when(user = {condition(1)} \
59 for (int i
= 0; i
< 16; i
++) {
61 for (int j
= 0; j
< 16; j
++)
65 #pragma omp metadirective when(device={arch("amdgcn")}: \
66 teams distribute parallel for)\
68 for (int i
= 0; i
< 100; i
++)
72 // CHECK: void bar(void);
73 // CHECK: void foo(void)
74 // CHECK-NEXT: #pragma omp parallel
76 // CHECK-NEXT: #pragma omp parallel
78 // CHECK-NEXT: #pragma omp parallel
80 // CHECK-NEXT: #pragma omp parallel
82 // CHECK-NEXT: #pragma omp parallel
84 // CHECK-NEXT: #pragma omp parallel for
85 // CHECK-NEXT: for (int i = 0; i < 100; i++)
86 // CHECK: #pragma omp parallel
87 // CHECK-NEXT: for (int i = 0; i < 100; i++)
88 // CHECK: #pragma omp parallel for
89 // CHECK-NEXT: for (int i = 0; i < 100; i++)
90 // CHECK: #pragma omp parallel
91 // CHECK-NEXT: for (int i = 0; i < 100; i++)
92 // CHECK: #pragma omp parallel for
93 // CHECK-NEXT: for (int i = 0; i < 16; i++) {
94 // CHECK-NEXT: #pragma omp simd
95 // CHECK-NEXT: for (int j = 0; j < 16; j++)
96 // CHECK-AMDGCN: #pragma omp teams distribute parallel for
97 // CHECK-AMDGCN-NEXT: for (int i = 0; i < 100; i++)