[patch, fortran] Simplify (-1.0)**i
Thomas Koenig
tkoenig@netcologne.de
Sun May 19 14:55:00 GMT 2013
Hello world,
the attached patch replaces (-1.0)**i with (in C language)
(i & 1) == 0 ? 1.0 : 1.0, see PR 57073.
I tried doing it in the middle end, see the PR of where these
approaches failed. So, rather than not doing the optimization
at all, I would rather do it in the Fortran front end.
If somebody jumps in with a middle-end solution that works, I
would withdraw this patch.
Regression-tested on trunk. OK?
Thomas
2013-05-19 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/57073
* trans-expr.c: Simplify (-1.0)**i to (i & 1) == 0 ? 1.0 : -1.0.
2013-05-19 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/57073
* gfortran.dg/power_6.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fe2.diff
Type: text/x-patch
Size: 2627 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130519/09bdc4d9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: power_6.f90
Type: text/x-fortran
Size: 495 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130519/09bdc4d9/attachment-0001.bin>
More information about the Fortran
mailing list