Re: Possible F77 Code Improvement ??
- From: Glen Herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Fri, 06 Mar 2009 09:08:13 -0700
Gus Gassmann wrote:
On Mar 4, 5:42 pm, monir <mon...@xxxxxxxxxxxx> wrote:(snip)
(snip)DO 25 JVORT= 1, NF !max 62
Kount = Kount + 1
C.......my code 2
SSX= valueXX
SSR= valueRR
SST= valueTT
C.......my code 3
ValX(Kount) = SSX*GAM(JVORT)*R(JVORT,1)
ValAbsX(Kount)=ABS(ValX(Kount))
ValR(Kount) = SSR*GAM(JVORT)*R(JVORT,1)
ValAbsR(Kount)=ABS(ValR(Kount))
ValT(Kount) = SST*GAM(JVORT)*R(JVORT,1)
ValAbsT(Kount)=ABS(ValT(Kount))
I came to this thread late, but nobody has yet commented on the fact
that GAM(JVORT) and R(JVORT,1) do not depend on the outer loop
counter, NB. It would therefore make sense to switch the order of
these two loops. Are optimisers clever enough these days to figure
that out?
I think so, but it might be better to write it
ValX(Kount) = GAM(JVORT)*R(JVORT,1)*SSX
such that, evaluated left to right, the compiler sees the
common subexpression.
The OS/360 Fortran H compiler would have found that. Assuming
optimizers haven't gotten worse over the last 40 years, compilers
should still find it.
-- glen
.
- References:
- Possible F77 Code Improvement ??
- From: monir
- Re: Possible F77 Code Improvement ??
- From: Gus Gassmann
- Possible F77 Code Improvement ??
- Prev by Date: Re: Possible F77 Code Improvement ??
- Next by Date: Re: F2003- C interop for Struct with union type
- Previous by thread: Re: Possible F77 Code Improvement ??
- Next by thread: Re: Possible F77 Code Improvement ??
- Index(es):
Relevant Pages
|