[patch, fortran] PR 57071, some power optimizations
Tobias Burnus
burnus@net-b.de
Sun Apr 28 18:18:00 GMT 2013
Am 28.04.2013 10:32, schrieb Thomas Koenig:
> the attached patch does some optimization on
> power using ishft and iand, as discussed in the PR.
>
> I have left out handling real numbers, that should be left
> to the middle-end (PR 57073).
>
> Regression-tested. OK for trunk?
OK - thanks for the patch.
I wonder whether one should also handle:
1**k == 1
That should only happen (in-real-world code) due to simplifying other
expressions but it is simple to implement.
(0**k is also possible, but it gets more complicated: 0 for k > 0, 1 for
k == 0 and invalid for k < 0 [which one might ignore]. As this is really
special, one can also leave the library call.)
Tobias
> 2013-04-28 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/57071
> * frontend-passes (optimize_power): New function.
> (optimize_op): Use it.
>
> 2013-04-28 Thomas Koenig <tkoenig@gcc.gnu.org>
>
> PR fortran/57071
> * gfortran.dg/power_3.f90: New test.
> * gfortran.dg/power_4.f90: New test.
More information about the Gcc-patches
mailing list