public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion)
@ 2005-01-29 6:50 dmixm at marine dot febras dot ru
2005-01-29 12:45 ` [Bug target/19686] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: dmixm at marine dot febras dot ru @ 2005-01-29 6:50 UTC (permalink / raw)
To: gcc-bugs
Program:
int foo (int x)
{
int i= x;
do {
x *= 2;
} while (--i);
return x;
}
avr-gcc 4.0 (20050116) with `-Os' option:
foo:
/* prologue: frame size=0 */
/* prologue end (size=0) */
ldi r18,lo8(0)
ldi r19,hi8(0)
clr r20
clr r21
sub r20,r24
sbc r21,r25
.L2:
add r24,r24
adc r25,r25
subi r18,lo8(-(-1))
sbci r19,hi8(-(-1))
cp r18,r20
cpc r19,r21
brne .L2
/* epilogue: frame size=0 */
ret
avr-gcc 3.3.4:
foo:
/* prologue: frame size=0 */
/* prologue end (size=0) */
mov r18,r24
mov r19,r25
.L2:
add r24,r24
adc r25,r25
subi r18,lo8(-(-1))
sbci r19,hi8(-(-1))
brne .L2
/* epilogue: frame size=0 */
ret
--
Summary: avr-gcc 4.0: loop performance decrease (extra
conversion)
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dmixm at marine dot febras dot ru
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/19686] avr-gcc 4.0: loop performance decrease (extra conversion)
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
@ 2005-01-29 12:45 ` pinskia at gcc dot gnu dot org
2005-01-30 19:53 ` [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0 pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-29 12:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-29 12:45 -------
There is a conversion to unsigned int:
(ivtmp.2 != (unsigned int) (x - 1) * 65535 + 65535)
but isn't that free?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
2005-01-29 12:45 ` [Bug target/19686] " pinskia at gcc dot gnu dot org
@ 2005-01-30 19:53 ` pinskia at gcc dot gnu dot org
2005-02-07 5:55 ` andrewhutchinson at cox dot net
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-30 19:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-30 19:52 -------
Actually the conversion to unsigned is free. The problem is something different.
The problem is that we are no longer comparing against 0 instead we are comparing something totally
different.
(ivtmp.2 != (unsigned int) (x - 1) * 65535 + 65535)
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Status|UNCONFIRMED |NEW
Component|target |tree-optimization
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2005-01-30 19:53:00
date| |
Summary|avr-gcc 4.0: loop |[4.0 Regression] loop
|performance decrease (extra |performance decrease, not
|conversion) |comparing against 0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
2005-01-29 12:45 ` [Bug target/19686] " pinskia at gcc dot gnu dot org
2005-01-30 19:53 ` [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0 pinskia at gcc dot gnu dot org
@ 2005-02-07 5:55 ` andrewhutchinson at cox dot net
2005-02-07 14:45 ` schlie at comcast dot net
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: andrewhutchinson at cox dot net @ 2005-02-07 5:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From andrewhutchinson at cox dot net 2005-02-06 23:06 -------
Taking X as the initial value of x on function entry.
The loop is defined as i=X to 0, step -1. Which is a simple do loop.
It gets "optimized" as i=0 to -X, step -1. (Which is something bizarre!)
The code increase is due to 1) Computation of -X and 2) compare said -X
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
` (2 preceding siblings ...)
2005-02-07 5:55 ` andrewhutchinson at cox dot net
@ 2005-02-07 14:45 ` schlie at comcast dot net
2005-02-07 15:10 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: schlie at comcast dot net @ 2005-02-07 14:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schlie at comcast dot net 2005-02-07 02:42 -------
(In reply to comment #2)
Might it be possible to change the severity to at least "normal"
and possibly reclassify it as a "mis-optimization", as it's very
typical for folks who know processors to intentionally write
code such that compairs are agaisnt zero, as they are typically
free; having the compiler de-optimize an otherwise more effecient
explicit code fragment would seem like something that would be fairly
critical to remedy?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
` (3 preceding siblings ...)
2005-02-07 14:45 ` schlie at comcast dot net
@ 2005-02-07 15:10 ` pinskia at gcc dot gnu dot org
2005-02-07 15:12 ` schlie at comcast dot net
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-07 15:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-07 02:46 -------
(In reply to comment #4)
> (In reply to comment #2)
It is minor because it is a missed optimization. (this really is a target dependent bug in that different
cost matrixes give different answers so it might be just avr's cost does not work at all which is a
different bug too).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
` (4 preceding siblings ...)
2005-02-07 15:10 ` pinskia at gcc dot gnu dot org
@ 2005-02-07 15:12 ` schlie at comcast dot net
2005-02-08 14:03 ` andrewhutchinson at cox dot net
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: schlie at comcast dot net @ 2005-02-07 15:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schlie at comcast dot net 2005-02-07 03:01 -------
(In reply to comment #5)
> (In reply to comment #4)
Understood, Thanks (apparently it' becomming more important to get the costs more correct).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
` (5 preceding siblings ...)
2005-02-07 15:12 ` schlie at comcast dot net
@ 2005-02-08 14:03 ` andrewhutchinson at cox dot net
2005-03-05 19:58 ` [Bug tree-optimization/19686] [4.0/4.1 " pinskia at gcc dot gnu dot org
2005-09-20 22:26 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: andrewhutchinson at cox dot net @ 2005-02-08 14:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From andrewhutchinson at cox dot net 2005-02-08 01:48 -------
I ran testcase with proposed avr_costs patch applied. The result is unchanged.
The initially generated RTL is unfortunately beyond that which can be fixed by
backend. I dont think this problem is avr specific, it should appear on other
targets.
I have attached initially generated RTL. It is alarmingly complex given starting
point. (This is not so apparent in the assembler as the backend has done a
rather good job of tidying up what it can.)
Perhaps somebody could glance at this to see what exactly went off the rails. It
might just be a manifestation of a known problem.
Wish I could help more - but trees are beyond me at the moment.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19686] [4.0/4.1 Regression] loop performance decrease, not comparing against 0
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
` (6 preceding siblings ...)
2005-02-08 14:03 ` andrewhutchinson at cox dot net
@ 2005-03-05 19:58 ` pinskia at gcc dot gnu dot org
2005-09-20 22:26 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-05 19:58 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/19686] [4.0/4.1 Regression] loop performance decrease, not comparing against 0
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
` (7 preceding siblings ...)
2005-03-05 19:58 ` [Bug tree-optimization/19686] [4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2005-09-20 22:26 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-20 22:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-20 22:26 -------
Fixed on the mainline:
<L0>:;
fooc ();
i = i - 1;
if (i != 0) goto <L0>; else goto <L1>;
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-09-20 22:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-29 6:50 [Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion) dmixm at marine dot febras dot ru
2005-01-29 12:45 ` [Bug target/19686] " pinskia at gcc dot gnu dot org
2005-01-30 19:53 ` [Bug tree-optimization/19686] [4.0 Regression] loop performance decrease, not comparing against 0 pinskia at gcc dot gnu dot org
2005-02-07 5:55 ` andrewhutchinson at cox dot net
2005-02-07 14:45 ` schlie at comcast dot net
2005-02-07 15:10 ` pinskia at gcc dot gnu dot org
2005-02-07 15:12 ` schlie at comcast dot net
2005-02-08 14:03 ` andrewhutchinson at cox dot net
2005-03-05 19:58 ` [Bug tree-optimization/19686] [4.0/4.1 " pinskia at gcc dot gnu dot org
2005-09-20 22:26 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).