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
++)
71 #pragma omp metadirective when(implementation = {extension(match_all)} \
72 : nothing) default(parallel for)
73 for (int i
= 0; i
< 16; i
++)
76 #pragma omp metadirective when(implementation = {extension(match_any)} \
77 : parallel) default(nothing)
78 for (int i
= 0; i
< 16; i
++)
82 // CHECK: void bar(void);
83 // CHECK: void foo(void)
84 // CHECK-NEXT: #pragma omp parallel
86 // CHECK-NEXT: #pragma omp parallel
88 // CHECK-NEXT: #pragma omp parallel
90 // CHECK-NEXT: #pragma omp parallel
92 // CHECK-NEXT: #pragma omp parallel
94 // CHECK-NEXT: #pragma omp parallel for
95 // CHECK-NEXT: for (int i = 0; i < 100; i++)
96 // CHECK: #pragma omp parallel
97 // CHECK-NEXT: for (int i = 0; i < 100; i++)
98 // CHECK: #pragma omp parallel for
99 // CHECK-NEXT: for (int i = 0; i < 100; i++)
100 // CHECK: #pragma omp parallel
101 // CHECK-NEXT: for (int i = 0; i < 100; i++)
102 // CHECK: #pragma omp parallel for
103 // CHECK-NEXT: for (int i = 0; i < 16; i++) {
104 // CHECK-NEXT: #pragma omp simd
105 // CHECK-NEXT: for (int j = 0; j < 16; j++)
106 // CHECK-AMDGCN: #pragma omp teams distribute parallel for
107 // CHECK-AMDGCN-NEXT: for (int i = 0; i < 100; i++)
108 // CHECK: for (int i = 0; i < 16; i++)
109 // CHECK: for (int i = 0; i < 16; i++)