This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42131] Weird translation of DO loops
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Nov 2009 09:47:13 -0000
- Subject: [Bug fortran/42131] Weird translation of DO loops
- References: <bug-42131-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #17 from rguenther at suse dot de 2009-11-27 09:47 -------
Subject: Re: Weird translation of DO loops
On Thu, 26 Nov 2009, tkoenig at gcc dot gnu dot org wrote:
> ------- Comment #13 from tkoenig at gcc dot gnu dot org 2009-11-26 21:56 -------
> Created an attachment (id=19159)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19159&action=view)
> --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19159&action=view)
> patch that implements the multiplication idea
>
> This generates
>
> if (D.1339 > 0)
> {
> if (D.1338 < D.1337)
> {
> goto L.2;
> }
> else
> {
> step_sign.2 = 1;
> }
> }
> else
> {
> if (D.1338 > D.1337)
> {
> goto L.2;
> }
> else
> {
> step_sign.2 = -1;
> }
> }
> countm1.1 = (((character(kind=4)) D.1338 - (character(kind=4)) D.1337) *
> (character(kind=4)) step_sign.2) / (character(kind=4)) (step_sign.2 * D.1339);
>
> implementing the multiplication idea outlined above, and passes at
> least do_3.F90.
>
> Better?
Unfortunately the conditional step_sign.2 is as bad as a conditional
countm1.1 for optimization. The above might even be worse than
the original.
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42131