This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31067] MINLOC should sometimes be inlined (gas_dyn is sooooo sloooow)
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jul 2009 12:19:38 -0000
- Subject: [Bug fortran/31067] MINLOC should sometimes be inlined (gas_dyn is sooooo sloooow)
- References: <bug-31067-10259@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #23 from rguenth at gcc dot gnu dot org 2009-07-03 12:19 -------
We are not able to vectorize the loop in
program main
implicit none
integer, volatile, dimension(1) :: n
real, allocatable :: a(:)
integer :: i
real :: t1, t2
allocate (a(100))
call random_number(a) ! negligible time
!call cpu_time(t1)
do i=1, 10000000
n = minloc(a, dim=1)
end do
!call cpu_time(t2)
print *, n !, t2-t1
end program main
because there are two reductions in that loop which I think the vectorizer
cannot handle:
<bb 7>:
# pos.0_31 = PHI <pos.0_3(10), 0(6)>
# limit.2_8 = PHI <limit.2_5(10),
3.4028234663852885981170418348451692544e+38(6)>
# S.3_74 = PHI <S.3_33(10), pretmp.22_79(6)>
D.1593_21 = S.3_74 + pretmp.22_77;
limit.2_22 = (*D.1568_14)[D.1593_21];
D.1595_23 = limit.2_22 < limit.2_8;
D.1596_24 = pos.0_31 == 0;
D.1597_27 = limit.2_8 == limit.2_22;
D.1598_28 = D.1597_27 & D.1596_24;
D.1599_29 = D.1595_23 | D.1598_28;
pos.0_32 = S.3_74 + pretmp.28_90;
pos.0_3 = [cond_expr] D.1599_29 ? pos.0_32 : pos.0_31;
limit.2_5 = [cond_expr] D.1599_29 ? limit.2_22 : limit.2_8;
S.3_33 = S.3_74 + 1;
if (S.3_33 > pretmp.22_81)
goto <bb 11>;
else
goto <bb 10>;
<bb 10>:
goto <bb 7>;
we reduce over limit.2_5 and pos.0_3. The intel compiler vectorizes
the function just fine.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |irar at il dot ibm dot com,
| |rguenth at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31067