* c-c++-common/Wrestrict.c (test_strcpy_range): Revert latest change.
[official-gcc.git] / libgomp / testsuite / libgomp.c / simd-14.c
blob28bdc99d11b6cbd9732805bbda3709d10c419dd9
1 /* { dg-do run } */
2 /* { dg-additional-options "-msse2" { target sse2_runtime } } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
5 int
6 main ()
8 int i, j, b, c = 0;
9 i = 4; j = 4; b = 7;
10 #pragma omp simd linear(b:2) reduction(+:c)
11 for (i = 0; i < 64; i++)
13 c = c + (b != 7 + 2 * i);
14 b = b + 2;
16 if (c || i != 64 || b != 7 + 64 * 2)
17 __builtin_abort ();
18 i = 4; j = 4; b = 7;
19 #pragma omp simd linear(b:3) reduction(+:c)
20 for (i = 0; i < 64; i += 4)
22 c = c + (b != 7 + i / 4 * 3);
23 b = b + 3;
25 if (c || i != 64 || b != 7 + 16 * 3)
26 __builtin_abort ();
27 i = 4; j = 4; b = 7;
28 #pragma omp simd linear(i) linear(b:2) reduction(+:c)
29 for (i = 0; i < 64; i++)
31 c = c + (b != 7 + 2 * i);
32 b = b + 2;
34 if (c || i != 64 || b != 7 + 64 * 2)
35 __builtin_abort ();
36 i = 4; j = 4; b = 7;
37 #pragma omp simd linear(i:4) linear(b:3) reduction(+:c)
38 for (i = 0; i < 64; i += 4)
40 c = c + (b != 7 + i / 4 * 3);
41 b = b + 3;
43 if (c || i != 64 || b != 7 + 16 * 3)
44 __builtin_abort ();
45 i = 4; j = 4; b = 7;
46 #pragma omp simd collapse (2) linear(b:2) reduction(+:c)
47 for (i = 0; i < 8; i++)
48 for (j = 0; j < 8; j++)
50 c = c + (b != 7 + 2 * j + 2 * 8 * i);
51 b = b + 2;
53 if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
54 __builtin_abort ();
55 i = 4; j = 4; b = 7;
56 #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c)
57 for (i = 0; i < 8; i++)
58 for (j = 0; j < 8; j++)
60 c = c + (b != 7 + 2 * j + 2 * 8 * i);
61 b = b + 2;
63 if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
64 __builtin_abort ();
65 i = 4; j = 4; b = 7;
66 #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c)
67 for (i = 0; i < 64; i++)
69 c = c + (b != 7 + 2 * i);
70 b = b + 2;
72 if (c || i != 64 || b != 7 + 64 * 2)
73 __builtin_abort ();
74 i = 4; j = 4; b = 7;
75 #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c)
76 for (i = 0; i < 64; i += 4)
78 c = c + (b != 7 + i / 4 * 3);
79 b = b + 3;
81 if (c || i != 64 || b != 7 + 16 * 3)
82 __builtin_abort ();
83 i = 4; j = 4; b = 7;
84 #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c)
85 for (i = 0; i < 64; i++)
87 c = c + (b != 7 + 2 * i);
88 b = b + 2;
90 if (c || i != 64 || b != 7 + 64 * 2)
91 __builtin_abort ();
92 i = 4; j = 4; b = 7;
93 #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c)
94 for (i = 0; i < 64; i += 4)
96 c = c + (b != 7 + i / 4 * 3);
97 b = b + 3;
99 if (c || i != 64 || b != 7 + 16 * 3)
100 __builtin_abort ();
101 i = 4; j = 4; b = 7;
102 #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
103 for (i = 0; i < 8; i++)
104 for (j = 0; j < 8; j++)
106 c = c + (b != 7 + 2 * j + 2 * 8 * i);
107 b = b + 2;
109 if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
110 __builtin_abort ();
111 i = 4; j = 4; b = 7;
112 #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c)
113 for (i = 0; i < 8; i++)
114 for (j = 0; j < 8; j++)
116 c = c + (b != 7 + 2 * j + 2 * 8 * i);
117 b = b + 2;
119 if (c || i != 8 || j != 8 || b != 7 + 64 * 2)
120 __builtin_abort ();
121 return 0;