[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-fortran
Subject: Re: Yet Another Opportunity to Optimize by the Front End.
From: Paul Thomas <paulthomas2 () wanadoo ! fr>
Date: 2006-10-30 22:39:06
Message-ID: 45467F0A.2000305 () wanadoo ! fr
[Download RAW message or body]
Toon,
>
> allocate (temp (m,n))
> loop over n
> loop over m
> temp (...) = x(...) == y(...)
> loop over n
> loop over m
> all = all .and. temp(...)
>
Steven and Paul were more intelligent than that:
integer, parameter :: N = 10
type :: toon
integer :: wim (N) = (/(i, i = 1, N)/)
end type toon
type (toon) :: current
integer :: wim(N) = (/(i, i = 1, N)/)
call moene (wim)
contains
subroutine moene (wim)
integer :: wim (N)
if (any(current%wim /= wim)) call abort ()
end subroutine moene
end
produces:
moene (wim)
{
int4[10] * D.951;
logical4 test.0;
test.0 = 0;
D.951 = ¤t.wim;
{
int4 S.1;
S.1 = 1;
while (1)
{
if (S.1 > 10) goto L.2; else (void) 0;
if ((*D.951)[NON_LVALUE_EXPR <S.1> + -1] !=
(*wim)[NON_LVALUE_EXPR <S.1> + -1] != 0)
{
test.0 = 1;
goto L.1;
}
else
{
(void) 0;
}
S.1 = S.1 + 1;
}
L.2:;
}
L.1:;
if (test.0)
{
_gfortran_abort ();
}
else
{
(void) 0;
}
}
MAIN__ ()
{
static struct toon current = {.wim={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
int4 i;
static int4 wim[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
static void moene (int4[10] *);
_gfortran_set_std (70, 127, 0);
moene (&wim);
}
ie. there is a single loop with an early bale-out for the condition
being met.
Or have I misunderstood what you are wanting to do?
Cheers
Paul
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic