------- 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