--- Comment #13 from spop at gcc dot gnu dot org 2010-02-11 15:45 ---
Subject: Bug 40886
Author: spop
Date: Thu Feb 11 15:45:27 2010
New Revision: 156701
URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=156701
Log:
Fix PR40886.
2010-02-11 Sebastian Pop sebastian@amd.com
--- Comment #11 from rakdver at kam dot mff dot cuni dot cz 2010-02-09
08:30 ---
Subject: Re: [4.3/4.4/4.5 Regression] No loop
counter reversal for simple loops anymore
Hi,
As suggested by Zdenek, here is a patch that lowers the cost of the IV when
it is compared against
--- Comment #12 from spop at gcc dot gnu dot org 2010-02-09 17:17 ---
Hi,
I just checked the back-end cost tables and there is no cost entry for
compare against zero. I guess that we should just add a TODO
comment around the code that we're adding, and then add the cost
field in GCC
--- Comment #9 from spop at gcc dot gnu dot org 2010-02-09 04:57 ---
Hi,
As suggested by Zdenek, here is a patch that lowers the cost of the IV when
it is compared against zero in a condition. The fragile part of this patch is
that it
lowers the cost by a magical constant 10. Would
--- Comment #10 from spop at gcc dot gnu dot org 2010-02-09 06:00 ---
Note that subtracting 1 from the cost of the candidate IV works as well for
this PR's testcase and we generate this asm with the patch:
.file pr40886.c
.text
.p2align 4,,15
.globl main
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40886
--- Comment #3 from rakdver at gcc dot gnu dot org 2009-08-07 08:44 ---
(In reply to comment #1)
The tree optimizers canonicalize the loop to
bb 3:
# i_5 = PHI i_3(4), 0(2)
# ivtmp.23_1 = PHI ivtmp.23_4(4), 10(2)
f2 ();
i_3 = i_5 + 1;
ivtmp.23_4 = ivtmp.23_1 - 1;
--- Comment #4 from andi-gcc at firstfloor dot org 2009-08-07 08:50 ---
The RTL loop optimizer does this optimization. I had to fix it a couple
of years ago for unsigned variables.
I think the loop optimizer still does it, just the gcc 4 frontend doesn't
give it input RTL with a
--- Comment #5 from rakdver at kam dot mff dot cuni dot cz 2009-08-07
08:54 ---
Subject: Re: [4.3/4.4/4.5 Regression] No loop counter reversal for simple
loops anymore
The RTL loop optimizer does this optimization. I had to fix it a couple
of years ago for unsigned variables.
I
--- Comment #6 from andi-gcc at firstfloor dot org 2009-08-07 09:38 ---
It worked on x86 at least
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40886
--- Comment #7 from steven at gcc dot gnu dot org 2009-08-07 09:47 ---
Re. comment #6: doloop never worked on x86 except for the AMD K6. x86 does not
have a doloop pattern.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40886
--- Comment #8 from andi-gcc at firstfloor dot org 2009-08-07 09:52 ---
At least my example in the original bug description shows that the optimization
worked on gcc 3.3. If your theory doesn't explain this then your theory is
wrong.
--
--- Comment #1 from rguenth at gcc dot gnu dot org 2009-07-28 11:09 ---
The tree optimizers canonicalize the loop to
bb 3:
# i_5 = PHI i_3(4), 0(2)
# ivtmp.23_1 = PHI ivtmp.23_4(4), 10(2)
f2 ();
i_3 = i_5 + 1;
ivtmp.23_4 = ivtmp.23_1 - 1;
if (ivtmp.23_4 != 0)
goto bb 4;
13 matches
Mail list logo