aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libgomp/testsuite/libgomp.fortran/simd5.f90
blob: 7a5efecac069741b94da6885697133807e0b4367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
! { dg-do run }
! { dg-additional-options "-msse2" { target sse2_runtime } }
! { dg-additional-options "-mavx" { target avx_runtime } }

  integer :: i, j, b, c
  c = 0
  i = 4
  j = 4
  b = 7
!$omp simd linear(b:2) reduction(+:c)
  do i = 0, 63
    c = c + b - (7 + 2 * i)
    b = b + 2
  end do
  if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) call abort
  i = 4
  j = 4
  b = 7
!$omp simd linear(b:3) reduction(+:c)
  do i = 0, 63, 4
    c = c + b - (7 + i / 4 * 3)
    b = b + 3
  end do
  if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) call abort
  i = 4
  j = 4
  b = 7
!$omp simd linear(i) linear(b:2) reduction(+:c)
  do i = 0, 63
    c = c + b - (7 + 2 * i)
    b = b + 2
  end do
  if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) call abort
  i = 4
  j = 4
  b = 7
!$omp simd linear(i:4) linear(b:3) reduction(+:c)
  do i = 0, 63, 4
    c = c + b - (7 + i / 4 * 3)
    b = b + 3
  end do
  if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) call abort
  i = 4
  j = 4
  b = 7
!$omp simd collapse(2) linear(b:2) reduction(+:c)
  do i = 0, 7
    do j = 0, 7
      c = c + b - (7 + 2 * j + 2 * 8 * i)
      b = b + 2
    end do
  end do
  if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) call abort
  i = 4
  j = 4
  b = 7
!$omp simd collapse(2) linear(b:2) reduction(+:c) lastprivate (i, j)
  do i = 0, 7
    do j = 0, 7
      c = c + b - (7 + 2 * j + 2 * 8 * i)
      b = b + 2
    end do
  end do
  if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) call abort
  i = 4
  j = 4
  b = 7
!$omp parallel do simd schedule (static, 4) linear(b:2) reduction(+:c)
  do i = 0, 63
    c = c + b - (7 + 2 * i)
    b = b + 2
  end do
  if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) call abort
  i = 4
  j = 4
  b = 7
!$omp parallel do simd schedule (static, 4) linear(b:3) reduction(+:c)
  do i = 0, 63, 4
    c = c + b - (7 + i / 4 * 3)
    b = b + 3
  end do
  if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) call abort
  i = 4
  j = 4
  b = 7
!$omp parallel do simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c)
  do i = 0, 63
    c = c + b - (7 + 2 * i)
    b = b + 2
  end do
  if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) call abort
  i = 4
  j = 4
  b = 7
!$omp parallel do simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c)
  do i = 0, 63, 4
    c = c + b - (7 + i / 4 * 3)
    b = b + 3
  end do
  if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) call abort
  i = 4
  j = 4
  b = 7
!$omp parallel do simd schedule (static, 4) collapse(2) linear(b:2) reduction(+:c)
  do i = 0, 7
    do j = 0, 7
      c = c + b - (7 + 2 * j + 2 * 8 * i)
      b = b + 2
    end do
  end do
  if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) call abort
  i = 4
  j = 4
  b = 7
!$omp parallel do simd schedule (static, 4) collapse(2) linear(b:2) &
!$omp & reduction(+:c) lastprivate (i, j)
  do i = 0, 7
    do j = 0, 7
      c = c + b - (7 + 2 * j + 2 * 8 * i)
      b = b + 2
    end do
  end do
  if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) call abort
end