| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-O3 -ftree-parallelize-loops=2 -fno-signed-zeros -fno-trapping-math" } |
| 3 |
|
| 4 |
complex function cdcdot(n, cx) |
| 5 |
implicit none |
| 6 |
|
| 7 |
integer :: n, i, kx |
| 8 |
complex :: cx(*) |
| 9 |
double precision :: dsdotr, dsdoti, dt1, dt3 |
| 10 |
|
| 11 |
kx = 1 |
| 12 |
dsdotr = 0 |
| 13 |
dsdoti = 0 |
| 14 |
do i = 1, n |
| 15 |
dt1 = real(cx(kx)) |
| 16 |
dt3 = aimag(cx(kx)) |
| 17 |
dsdotr = dsdotr + dt1 * 2 - dt3 * 2 |
| 18 |
dsdoti = dsdoti + dt1 * 2 + dt3 * 2 |
| 19 |
kx = kx + 1 |
| 20 |
end do |
| 21 |
cdcdot = cmplx(real(dsdotr), real(dsdoti)) |
| 22 |
return |
| 23 |
end function cdcdot |
| 24 |
program test |
| 25 |
implicit none |
| 26 |
complex :: cx(100), ct, cdcdot |
| 27 |
integer :: i |
| 28 |
do i = 1, 100 |
| 29 |
cx(i) = cmplx(2*i, i) |
| 30 |
end do |
| 31 |
ct = cdcdot (100, cx) |
| 32 |
if (ct.ne.cmplx(10100.0000,30300.0000)) call abort |
| 33 |
end |