This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] PR 57071, some power optimizations
- From: Tobias Burnus <burnus at net-b dot de>
- To: Thomas Koenig <tkoenig at netcologne dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 28 Apr 2013 12:10:09 +0200
- Subject: Re: [patch, fortran] PR 57071, some power optimizations
- References: <517CDE9C dot 2020301 at netcologne dot de>
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.