| 1 |
! PR fortran/84418 |
| 2 |
! { dg-do run { target vect_simd_clones } } |
| 3 |
! { dg-options "-fno-inline" } |
| 4 |
! { dg-additional-options "-msse2" { target sse2_runtime } } |
| 5 |
! { dg-additional-options "-mavx" { target avx_runtime } } |
| 6 |
|
| 7 |
type p |
| 8 |
integer :: i, j |
| 9 |
end type |
| 10 |
type(p) :: a(1024) |
| 11 |
integer :: b(4,1024), c(1024) |
| 12 |
integer :: i |
| 13 |
do i = 1, 1024 |
| 14 |
a(i)%i = 2 * i |
| 15 |
a(i)%j = 3 * i |
| 16 |
b(1,i) = 4 * i |
| 17 |
b(2,i) = 5 * i |
| 18 |
b(3,i) = 6 * i |
| 19 |
b(4,i) = 7 * i |
| 20 |
end do |
| 21 |
!$omp simd |
| 22 |
do i = 1, 1024 |
| 23 |
c(i) = foo (a(i), b(:,i)) |
| 24 |
end do |
| 25 |
do i = 1, 1024 |
| 26 |
if (c(i).ne.(6 * i)) stop 1 |
| 27 |
end do |
| 28 |
contains |
| 29 |
function foo (x, y) |
| 30 |
type (p) :: x |
| 31 |
integer :: y(4), foo |
| 32 |
!$omp declare simd linear (ref (x, y)) |
| 33 |
foo = x%i + y(1) |
| 34 |
end function |
| 35 |
end |