Debian Codegraph @

clang/test/OpenMP/target_parallel_num_threads_strict_messages.cpp

raw
1 // RUN: %clang_cc1 -DF1 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host-ppc.bc
2 // RUN: %clang_cc1 -DF1 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null
3 // RUN: %clang_cc1 -DF2 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host-ppc.bc
4 // RUN: %clang_cc1 -DF2 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null
5 // RUN: %clang_cc1 -DF3 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host-ppc.bc
6 // RUN: %clang_cc1 -DF3 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host-ppc.bc -o /dev/null
7
8 // RUN: %clang_cc1 -DF1 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=spirv64-intel -emit-llvm-bc %s -o %t-spirv-ppc-host-ppc.bc
9 // RUN: %clang_cc1 -DF1 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple spirv64-intel -fopenmp-targets=spirv64-intel -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-spirv-ppc-host-ppc.bc -o /dev/null
10 // RUN: %clang_cc1 -DF2 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=spirv64-intel -emit-llvm-bc %s -o %t-spirv-ppc-host-ppc.bc
11 // RUN: %clang_cc1 -DF2 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple spirv64-intel -fopenmp-targets=spirv64-intel -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-spirv-ppc-host-ppc.bc -o /dev/null
12 // RUN: %clang_cc1 -DF3 -verify -fopenmp -fopenmp-version=60 -triple x86_64-unknown-unknown -fopenmp-targets=spirv64-intel -emit-llvm-bc %s -o %t-spirv-ppc-host-ppc.bc
13 // RUN: %clang_cc1 -DF3 -DTARGET -verify -fopenmp -fopenmp-version=60 -triple spirv64-intel -fopenmp-targets=spirv64-intel -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-spirv-ppc-host-ppc.bc -o /dev/null
14
15 #ifndef TARGET
16 // expected-no-diagnostics
17 #endif
18
19 #ifdef F3
20 template<typename tx>
21 tx ftemplate(int n) {
22 tx a = 0;
23
24 #ifdef TARGET
25 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
26 #endif
27 #pragma omp parallel num_threads(strict: tx(20)) severity(fatal) message("msg")
28 {
29 }
30
31 short b = 1;
32 #ifdef TARGET
33 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
34 #endif
35 #pragma omp parallel num_threads(strict: b) severity(warning) message("msg")
36 {
37 a += b;
38 }
39
40 return a;
41 }
42 #endif
43
44 #ifdef F2
45 static
46 int fstatic(int n) {
47
48 #ifdef TARGET
49 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
50 #endif
51 #pragma omp target parallel num_threads(strict: n) message("msg")
52 {
53 }
54
55 #ifdef TARGET
56 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
57 #endif
58 #pragma omp target parallel num_threads(strict: 32+n) severity(warning)
59 {
60 }
61
62 return n+1;
63 }
64 #endif
65
66 #ifdef F1
67 struct S1 {
68 double a;
69
70 int r1(int n){
71 int b = 1;
72
73 #ifdef TARGET
74 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
75 #endif
76 #pragma omp parallel num_threads(strict: n-b) severity(warning) message("msg")
77 {
78 this->a = (double)b + 1.5;
79 }
80
81 #ifdef TARGET
82 // expected-warning@+2 {{modifier 'strict' is currently not supported on a GPU for the 'num_threads' clause; modifier ignored}}
83 #endif
84 #pragma omp parallel num_threads(strict: 1024) severity(fatal)
85 {
86 this->a = 2.5;
87 }
88
89 return (int)a;
90 }
91 };
92 #endif
93
94 int bar(int n){
95 int a = 0;
96
97 #ifdef F1
98 #pragma omp target
99 {
100 S1 S;
101 a += S.r1(n);
102 }
103 #endif
104
105 #ifdef F2
106 a += fstatic(n);
107 #endif
108
109 #ifdef F3
110 #pragma omp target
111 a += ftemplate<int>(n);
112 #endif
113
114 return a;
115 }