This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/57071] Optimize (-1)**k to 1 - 2 * mod(K, 2)
- From: "Joost.VandeVondele at mat dot ethz.ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Apr 2013 06:52:13 +0000
- Subject: [Bug fortran/57071] Optimize (-1)**k to 1 - 2 * mod(K, 2)
- Auto-submitted: auto-generated
- References: <bug-57071-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57071
Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Joost.VandeVondele at mat
| |dot ethz.ch
--- Comment #2 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> 2013-04-26 06:52:13 UTC ---
indeed, very common to write this.. however, this is even more common in a loop
DO i=0,N
y=y+(-1)**i * x**i
ENDDO
so there you really would like to have this converted to some form that uses
...
DO i=..
tmp_s=-tmp_s
tmp_x=tmp_x*x
y=y+tmp_s*tmp_x
ENDDO
I'm not sure how the different forms behave in this respect.