Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/metadirective-no-score.c

raw
1 /* { dg-do compile { target x86_64-*-* } } */
2 /* { dg-additional-options "-foffload=disable" } */
3
4 /* This test is expected to fail with compile-time errors:
5 "A trait-score cannot be specified in traits from the construct,
6 device or target_device trait-selector-sets." */
7
8 /* Define this to avoid dependence on libgomp header files. */
9
10 #define omp_initial_device -1
11
12 void
13 f1 (int n, double *a, double s)
14 {
15 #pragma omp metadirective \
16 when (device={kind (score(5) : host)} \
17 : parallel for)
18 /* { dg-error ".score. cannot be specified in traits in the .device. trait-selector-set" "" { target *-*-*} .-2 } */
19 for (int i = 0; i < n; i++)
20 a[i] = a[i] * s;
21 }
22
23 void
24 f2 (int n, double *a, double s)
25 {
26 #pragma omp metadirective \
27 when (device={kind (host), arch (score(6) : x86_64), isa (avx512f)} \
28 : parallel for)
29 /* { dg-error ".score. cannot be specified in traits in the .device. trait-selector-set" "" { target *-*-*} .-2 } */
30 for (int i = 0; i < n; i++)
31 a[i] = a[i] * s;
32 }
33
34 void
35 f3 (int n, double *a, double s)
36 {
37 #pragma omp metadirective \
38 when (device={kind (host), arch (score(6) : x86_64), \
39 isa (score(7): avx512f)} \
40 : parallel for)
41 /* { dg-error ".score. cannot be specified in traits in the .device. trait-selector-set" "" { target *-*-*} .-3 } */
42 /* { dg-error ".score. cannot be specified in traits in the .device. trait-selector-set" "" { target *-*-*} .-3 } */
43 for (int i = 0; i < n; i++)
44 a[i] = a[i] * s;
45 }
46
47 void
48 f4 (int n, double *a, double s)
49 {
50 #pragma omp metadirective \
51 when (target_device={device_num (score(42) : omp_initial_device), \
52 kind (host)} \
53 : parallel for)
54 /* { dg-error ".score. cannot be specified in traits in the .target_device. trait-selector-set" "" { target *-*-*} .-3 } */
55 for (int i = 0; i < n; i++)
56 a[i] = a[i] * s;
57 }
58
59 void
60 f5 (int n, double *a, double s)
61 {
62 #pragma omp metadirective \
63 when (target_device={device_num(omp_initial_device), \
64 kind (score(5) : host)} \
65 : parallel for)
66 /* { dg-error ".score. cannot be specified in traits in the .target_device. trait-selector-set" "" { target *-*-*} .-2 } */
67 for (int i = 0; i < n; i++)
68 a[i] = a[i] * s;
69 }
70
71 void
72 f6 (int n, double *a, double s)
73 {
74 #pragma omp metadirective \
75 when (target_device={device_num(omp_initial_device), kind (host), \
76 arch (score(6) : x86_64), isa (avx512f)} \
77 : parallel for)
78 /* { dg-error ".score. cannot be specified in traits in the .target_device. trait-selector-set" "" { target *-*-*} .-2 } */
79 for (int i = 0; i < n; i++)
80 a[i] = a[i] * s;
81 }
82
83 void
84 f7 (int n, double *a, double s)
85 {
86 #pragma omp metadirective \
87 when (target_device={device_num(omp_initial_device), kind (host), \
88 arch (score(6) : x86_64), \
89 isa (score(7): avx512f)} \
90 : parallel for)
91 /* { dg-error ".score. cannot be specified in traits in the .target_device. trait-selector-set" "" { target *-*-*} .-3 } */
92 /* { dg-error ".score. cannot be specified in traits in the .target_device. trait-selector-set" "" { target *-*-*} .-3 } */
93 for (int i = 0; i < n; i++)
94 a[i] = a[i] * s;
95 }