C++: simplify output from suggest_alternatives_for
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / simd6.f90
blobb78bb4b6886abeb82fb7ca0ab7244d6c0dfb1881
1 ! { dg-do run }
2 ! { dg-additional-options "-msse2" { target sse2_runtime } }
3 ! { dg-additional-options "-mavx" { target avx_runtime } }
5 interface
6 subroutine foo (b, i, j, x)
7 integer, intent (inout) :: b
8 integer, intent (in) :: i, j, x
9 end subroutine
10 end interface
11 integer :: i, j, b, c
12 c = 0
13 i = 4
14 j = 4
15 b = 7
16 !$omp simd linear(b:2) reduction(+:c)
17 do i = 0, 63
18 c = c + b - (7 + 2 * i)
19 call foo (b, i, j, 2)
20 end do
21 if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) STOP 1
22 i = 4
23 j = 4
24 b = 7
25 !$omp simd linear(b:3) reduction(+:c)
26 do i = 0, 63, 4
27 c = c + b - (7 + i / 4 * 3)
28 call foo (b, i, j, 3)
29 end do
30 if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) STOP 2
31 i = 4
32 j = 4
33 b = 7
34 !$omp simd linear(i) linear(b:2) reduction(+:c)
35 do i = 0, 63
36 c = c + b - (7 + 2 * i)
37 call foo (b, i, j, 2)
38 end do
39 if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) STOP 3
40 i = 4
41 j = 4
42 b = 7
43 !$omp simd linear(i:4) linear(b:3) reduction(+:c)
44 do i = 0, 63, 4
45 c = c + b - (7 + i / 4 * 3)
46 call foo (b, i, j, 3)
47 end do
48 if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) STOP 4
49 i = 4
50 j = 4
51 b = 7
52 !$omp simd collapse(2) linear(b:2) reduction(+:c)
53 do i = 0, 7
54 do j = 0, 7
55 c = c + b - (7 + 2 * j + 2 * 8 * i)
56 call foo (b, i, j, 2)
57 end do
58 end do
59 if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) STOP 5
60 i = 4
61 j = 4
62 b = 7
63 !$omp simd collapse(2) linear(b:2) reduction(+:c) lastprivate (i, j)
64 do i = 0, 7
65 do j = 0, 7
66 c = c + b - (7 + 2 * j + 2 * 8 * i)
67 call foo (b, i, j, 2)
68 end do
69 end do
70 if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) STOP 6
71 i = 4
72 j = 4
73 b = 7
74 !$omp parallel do simd schedule (static, 4) linear(b:2) reduction(+:c)
75 do i = 0, 63
76 c = c + b - (7 + 2 * i)
77 call foo (b, i, j, 2)
78 end do
79 if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) STOP 7
80 i = 4
81 j = 4
82 b = 7
83 !$omp parallel do simd schedule (static, 4) linear(b:3) reduction(+:c)
84 do i = 0, 63, 4
85 c = c + b - (7 + i / 4 * 3)
86 call foo (b, i, j, 3)
87 end do
88 if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) STOP 8
89 i = 4
90 j = 4
91 b = 7
92 !$omp parallel do simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c)
93 do i = 0, 63
94 c = c + b - (7 + 2 * i)
95 call foo (b, i, j, 2)
96 end do
97 if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) STOP 9
98 i = 4
99 j = 4
100 b = 7
101 !$omp parallel do simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c)
102 do i = 0, 63, 4
103 c = c + b - (7 + i / 4 * 3)
104 call foo (b, i, j, 3)
105 end do
106 if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) STOP 10
107 i = 4
108 j = 4
109 b = 7
110 !$omp parallel do simd schedule (static, 4) collapse(2) linear(b:2) reduction(+:c)
111 do i = 0, 7
112 do j = 0, 7
113 c = c + b - (7 + 2 * j + 2 * 8 * i)
114 call foo (b, i, j, 2)
115 end do
116 end do
117 if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) STOP 11
118 i = 4
119 j = 4
120 b = 7
121 !$omp parallel do simd schedule (static, 4) collapse(2) linear(b:2) &
122 !$omp & reduction(+:c) lastprivate (i, j)
123 do i = 0, 7
124 do j = 0, 7
125 c = c + b - (7 + 2 * j + 2 * 8 * i)
126 call foo (b, i, j, 2)
127 end do
128 end do
129 if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) STOP 12
131 subroutine foo (b, i, j, x)
132 integer, intent (inout) :: b
133 integer, intent (in) :: i, j, x
134 b = b + (i - i) + (j - j) + x
135 end subroutine