[patch, fortran] PR 57071, some power optimizations

Tobias Burnus burnus@net-b.de
Sun Apr 28 18:12:00 GMT 2013


Thomas Koenig wrote:
> Regarding PR 57073, the real case - I have never worked with
> GIMPLE, so I have no real idea how to start this.
>
> Any volunteers?  Or should we handle this in the Fortran front
> end after all?

I think one should do it in the middle end. Actually, it shouldn't be 
that difficult. The starting point is gcc/builtins.c's fold_builtin_powi 
- all ingredients are there;  (1.0)**k, x**0, x**1 and x**(-1) are 
already handled. Thus, only (-1)**k is missing. For   "= (a)?(b):(c)" 
one uses "fold_build3_loc (loc, COND_EXPR, ..." and to check whether a 
real argument is -1, you can use "real_minus_onep".

How about writing your first middle end patch?

Tobias



More information about the Fortran mailing list