Debian Codegraph @

gcc/testsuite/g++.dg/gomp/linear-2.C

raw
1 // { dg-do compile }
2 // { dg-options "-fopenmp" }
3
4 #pragma omp declare target
5
6 int i, j;
7
8 void
9 f1 ()
10 {
11 #pragma omp for linear (i:1) // { dg-error "iteration variable .i. should not be linear" }
12 for (i = 0; i < 32; i++)
13 ;
14 }
15
16 void
17 f2 ()
18 {
19 #pragma omp distribute parallel for linear (i:1) // { dg-error ".linear. is not valid for .#pragma omp distribute parallel for." }
20 for (i = 0; i < 32; i++)
21 ;
22 }
23
24 void
25 f3 ()
26 {
27 #pragma omp parallel for linear (i:1) collapse(1)
28 for (i = 0; i < 32; i++) // { dg-error "iteration variable .i. should not be linear" }
29 ;
30 }
31
32 void
33 f4 ()
34 {
35 #pragma omp for linear (i:1) linear (j:2) collapse(2) // { dg-error "iteration variable .i. should not be linear" }
36 for (i = 0; i < 32; i++) // { dg-error "iteration variable .j. should not be linear" "" { target *-*-* } .-1 }
37 for (j = 0; j < 32; j+=2)
38 ;
39 }
40
41 void
42 f5 ()
43 {
44 #pragma omp target teams distribute parallel for linear (i:1) linear (j:2) collapse(2) // { dg-error ".linear. is not valid for .#pragma omp target teams distribute parallel for." }
45 for (i = 0; i < 32; i++)
46 for (j = 0; j < 32; j+=2)
47 ;
48 }
49
50 void
51 f6 ()
52 {
53 #pragma omp parallel for linear (i:1) collapse(2) linear (j:2) // { dg-error "iteration variable .i. should not be linear" "" { target *-*-* } .+1 }
54 for (i = 0; i < 32; i++) // { dg-error "iteration variable .j. should not be linear" }
55 for (j = 0; j < 32; j+=2)
56 ;
57 }
58
59 template <int N>
60 void
61 f7 ()
62 {
63 #pragma omp for linear (i:1) // { dg-error "iteration variable .i. should not be linear" }
64 for (i = 0; i < 32; i++)
65 ;
66 }
67
68 template <int N>
69 void
70 f8 ()
71 {
72 #pragma omp distribute parallel for linear (i:1) // { dg-error ".linear. is not valid for .#pragma omp distribute parallel for." }
73 for (i = 0; i < 32; i++)
74 ;
75 }
76
77 template <int N>
78 void
79 f9 ()
80 {
81 #pragma omp parallel for linear (i:1) collapse(1)
82 for (i = 0; i < 32; i++) // { dg-error "iteration variable .i. should not be linear" }
83 ;
84 }
85
86 template <int N>
87 void
88 f10 ()
89 {
90 #pragma omp for linear (i:1) linear (j:2) collapse(2) // { dg-error "iteration variable .i. should not be linear" }
91 for (i = 0; i < 32; i++) // { dg-error "iteration variable .j. should not be linear" "" { target *-*-* } .-1 }
92 for (j = 0; j < 32; j+=2)
93 ;
94 }
95
96 template <int N>
97 void
98 f11 ()
99 {
100 #pragma omp target teams distribute parallel for linear (i:1) linear (j:2) collapse(2) // { dg-error ".linear. is not valid for .#pragma omp target teams distribute parallel for." }
101 for (i = 0; i < 32; i++)
102 for (j = 0; j < 32; j+=2)
103 ;
104 }
105
106 template <int N>
107 void
108 f12 ()
109 {
110 #pragma omp parallel for linear (i:1) collapse(2) linear (j:2) // { dg-error "iteration variable .i. should not be linear" "" { target *-*-* } .+1 }
111 for (i = 0; i < 32; i++) // { dg-error "iteration variable .j. should not be linear" }
112 for (j = 0; j < 32; j+=2)
113 ;
114 }
115
116 #pragma omp end declare target
117
118 void
119 f13 ()
120 {
121 f7 <0> ();
122 #pragma omp target teams
123 f8 <1> ();
124 f9 <2> ();
125 f10 <3> ();
126 f11 <4> ();
127 f12 <5> ();
128 }