1 ! { dg-do run { target vect_simd_clones } }
2 ! { dg-additional-options "-msse2" { target sse2_runtime } }
3 ! { dg-additional-options "-mavx" { target avx_runtime } }
7 function foo(p
) result(r
)
8 !$omp declare simd(foo) notinbranch
14 function myaddint(a
, b
, n
) result(r
)
16 integer :: a(*), b(*), n
, r
21 a(i
) = foo(b(i
)) ! foo is not called under a condition
27 function myaddint_ref(a
, b
, n
) result(r
)
29 integer :: a(*), b(*), n
, r
37 end function myaddint_ref
39 function goo(p
) result(r
)
40 !$omp declare simd(goo) inbranch
46 function myaddfloat(x
, y
, n
) result(r
)
56 ! goo is called under the condition (or within a branch)
63 end function myaddfloat
65 function myaddfloat_ref(x
, y
, n
) result(r
)
80 end function myaddfloat_ref
82 subroutine init (b
, y
, n
)
95 subroutine init2 (b
, y
, n
)
106 subroutine checkfloat (a
, b
, n
)
108 real, parameter :: EPS
= 0.000001
109 real :: diff
, a(*), b(*)
112 if (diff
> EPS
.or
. -diff
> EPS
) call abort
116 subroutine checkint (a
, b
, n
)
117 integer :: i
, n
, a(*), b(*)
119 if (a(i
) .ne
. b(i
)) call abort
124 integer :: a(128), a_ref(128), b(128), ri
, ri_ref
125 real :: x(128), x_ref(128), y(128), rf
, rf_ref
127 call init2(a
, x
, 128)
128 call init2(a_ref
, x_ref
, 128)
132 ri
= myaddint (a
, b
, 128)
133 rf
= myaddfloat (x
, y
, 128)
137 ri_ref
= myaddint_ref (a_ref
, b
, 128)
138 rf_ref
= myaddfloat_ref (x_ref
, y
, 128)
140 call checkint (a
, a_ref
, 128)
141 call checkfloat (x
, x_ref
, 128)
147 use SIMD6_mod
, only
: test