This is the mail archive of the 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]

Re: extension dependant givs

Richard Henderson wrote:

> This is a variant of a patch I did once upon a time for the new ia32
> backend.  The object is to recognize cases in which a sign or zero-extend
> of a BIV does not affect the outcome, and thus could be folded in to
> the initialization of a GIV.

> At the time it was put aside, since the conditions that give rise to the
> problem didn't happen often enough to be worth the effort.  However, it
> does happen often on IA-64.

[ Score:1 Interesting ]

Why is this different on the IA-64 vs. Alpha - they're both 32-bit int,
64 bit pointer machines, no ?

> This optimization unfortunately does not trigger on Alpha at all,
> because there we are more apt to see
>   (zero_extend:DI (subreg:SI (reg:DI) 0))
> and this code does not handle nested extensions.  Another thing
> to fix, perhaps.

Sure, you added special code to the Fortran Frontend in '97 to get it to
generate reasonable code vis a vis this problem - would be nice if we
could remove it (and not have to add it to g95) ...

> The next thing to do is to recognize that in

>   int i, start, end;
>   for (i = start; i < end; ++i)
>     ...

> "i" cannot overflow if "end" is loop invariant since we're protected
> by the initial comparison, and the +1 ensures we will not pass "end".
> This appears to be very common, particularly when start == 0.

Is this also a problem with:

  int i, start, end;
  for (i = end - start; i >=0 ; --i)

where start and end are untouched by the loop ?  (This is how Fortran
loops are encoded).

Ceterum censeo "dependent" scribendum esse.

Toon Moene - - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
GNU Fortran 77:
GNU Fortran 95: (under construction)

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