public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/34789] [avr] sometimes the compiler keeps addresses in registers unnecessarily
[not found] <bug-34789-4@http.gcc.gnu.org/bugzilla/>
@ 2011-10-09 20:49 ` gjl at gcc dot gnu.org
0 siblings, 0 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-10-09 20:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34789
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|avr-*-* |avr
Status|NEW |RESOLVED
CC| |gjl at gcc dot gnu.org
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-10-09 20:49:20 UTC ---
This is compiled with avr-gcc-4.7.0 -Os -mmcu=avr4 as expected:
bar:
lds r30,a
lds r31,a+1
lsl r30
rol r31
subi r30,lo8(-(data))
sbci r31,hi8(-(data))
ld r24,Z
ldd r25,Z+1
rcall foo
movw r30,r24
lsl r30
rol r31
subi r30,lo8(-(data))
sbci r31,hi8(-(data))
ld r24,Z
ldd r25,Z+1
rjmp foo
Thus closing this PR as RESOLVED. For the tail call, see PR34790.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/34789] [avr] sometimes the compiler keeps addresses in registers unnecessarily
2008-01-15 9:04 [Bug c/34789] New: Missed optimisation on avr - " david at westcontrol dot com
2008-02-22 1:22 ` [Bug target/34789] [avr] " hutchinsonandy at aim dot com
@ 2008-04-04 21:32 ` eric dot weddington at atmel dot com
1 sibling, 0 replies; 3+ messages in thread
From: eric dot weddington at atmel dot com @ 2008-04-04 21:32 UTC (permalink / raw)
To: gcc-bugs
--
eric dot weddington at atmel dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-04-04 21:31:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34789
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/34789] [avr] sometimes the compiler keeps addresses in registers unnecessarily
2008-01-15 9:04 [Bug c/34789] New: Missed optimisation on avr - " david at westcontrol dot com
@ 2008-02-22 1:22 ` hutchinsonandy at aim dot com
2008-04-04 21:32 ` eric dot weddington at atmel dot com
1 sibling, 0 replies; 3+ messages in thread
From: hutchinsonandy at aim dot com @ 2008-02-22 1:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from hutchinsonandy at aim dot com 2008-02-22 01:22 -------
This appears to be due to avr_rtx_costs not assigning same cost to SYMBOL_REF
and CONST_INT. So SYMBOL_REF looks expensive - so is held in register to avoid
"recalculating" it.
Quick change to make SYMBOL_REF same cost as CONST_INT in both avr_rtx_cost and
avr_operand_rtx_cost gave the desired result
22 /* prologue: function */
23 /* frame size = 0 */
24 .LM2:
25 0000 E091 0000 lds r30,a
26 0004 F091 0000 lds r31,(a)+1
27 0008 EE0F lsl r30
28 000a FF1F rol r31
29 000c E050 subi r30,lo8(-(data))
30 000e F040 sbci r31,hi8(-(data))
31 0010 8081 ld r24,Z
32 0012 9181 ldd r25,Z+1
33 0014 0E94 0000 call foo
34 .LM3:
35 0018 FC01 movw r30,r24
36 001a EE0F lsl r30
37 001c FF1F rol r31
38 001e E050 subi r30,lo8(-(data))
39 0020 F040 sbci r31,hi8(-(data))
40 0022 8081 ld r24,Z
41 0024 9181 ldd r25,Z+1
42 0026 0E94 0000 call foo
43 /* epilogue start */
44 .LM4:
45 002a 0895 ret
CONST and LABEL_REF might also have same problem as they cost same as MEM.
But note, if SYMBOL_REF were part of memory address, then it might be better
held in register (like Y or Z) - this should be done by checking outer code.
With outer code of "MEM" SYMBOL_REF would be more expensive than register.
(which might same a few LDS/STS that appear in code)
Avr_rtx_cost needs some serious work done to correct these are other anomalies
in cost assumptions and the recursion on operand costs.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34789
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-09 20:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-34789-4@http.gcc.gnu.org/bugzilla/>
2011-10-09 20:49 ` [Bug target/34789] [avr] sometimes the compiler keeps addresses in registers unnecessarily gjl at gcc dot gnu.org
2008-01-15 9:04 [Bug c/34789] New: Missed optimisation on avr - " david at westcontrol dot com
2008-02-22 1:22 ` [Bug target/34789] [avr] " hutchinsonandy at aim dot com
2008-04-04 21:32 ` eric dot weddington at atmel dot com
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).