This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran, 4.9] Improve efficiency of array constructor operators


Thomas Koenig wrote:
this patch finally makes the idiom
   if (any([a,b,c] < eps)) then
equivalent to
   if (a<eps .or. b<eps .or. c<eps) then
so that there is no loss in efficiency through generating
temporary arrays.

I have not yet looked at the patch, but I wonder whether that causes invalid code for
  if (any([a,b,c] < f()))
by evaluating f() multiple times.

Another question is: Why do we generate a temporary array for ANY/ALL? A scalar should be sufficient, i.e.

res = .false.
do i = 1, n
  res = res .or. (array(i) < eps)
end do
if (res)

In the scalar case with known array size, the middle-end should also be able to fully unroll the loop.

I do not really see in how far such a patch would replace your patch - or whether it should be done additionally.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]