public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56219] New: avr-gcc-4.7.2 missing __uint24 loop optimisation
@ 2013-02-06 7:37 demiurg_spb at freemail dot ru
2013-02-06 12:35 ` [Bug target/56219] " demiurg_spb at freemail dot ru
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: demiurg_spb at freemail dot ru @ 2013-02-06 7:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56219
Bug #: 56219
Summary: avr-gcc-4.7.2 missing __uint24 loop optimisation
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: demiurg_spb@freemail.ru
int main(void)
{
// static const unsigned long __flash br[8] = {0,}; // case1: 194 bytes
static const __uint24 __flash br[8] = {0,}; // case2: 190 bytes
(should be case1 minus 8 bytes)
unsigned char i=0;
for (;;i++)
{
*((volatile unsigned char*)100) = br[i%8];
}
return (0);
}
//case1: avr-gcc-4.7.2 -S -mmcu=atmega8 -Os main.c
ldi r24,0
.L2:
mov r30,r24
andi r30,lo8(7)
ldi r25,lo8(4)
mul r30,r25
movw r30,r0
clr __zero_reg__
subi r30,lo8(-(br.1322))
sbci r31,hi8(-(br.1322))
lpm r25,Z
sts 100,r25
subi r24,lo8(-(1))
rjmp .L2
//case2: avr-gcc-4.7.2 -S -mmcu=atmega8 -Os main.c
ldi r18,0
.L2:
mov r24,r18
andi r24,lo8(7)
ldi r25,0
movw r30,r24
lsl r30
rol r31
add r30,r24
adc r31,r25
subi r30,lo8(-(br.1322))
sbci r31,hi8(-(br.1322))
lpm r24,Z
sts 100,r24
subi r18,lo8(-(1))
rjmp .L2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/56219] avr-gcc-4.7.2 missing __uint24 loop optimisation
2013-02-06 7:37 [Bug c/56219] New: avr-gcc-4.7.2 missing __uint24 loop optimisation demiurg_spb at freemail dot ru
@ 2013-02-06 12:35 ` demiurg_spb at freemail dot ru
2013-02-06 13:06 ` demiurg_spb at freemail dot ru
2013-04-12 20:05 ` gjl at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: demiurg_spb at freemail dot ru @ 2013-02-06 12:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56219
--- Comment #1 from demiurg_spb at freemail dot ru 2013-02-06 12:34:53 UTC ---
It would be optimal move outside loop all extra instructions, and use temp
register r0 more active.
ldi r24,0
ldi r25,lo8(4) // outside loop
.L2:
mov r30,r24
andi r30,lo8(7)
mul r30,r25
movw r30,r0
subi r30,lo8(-(br.1322))
sbci r31,hi8(-(br.1322))
lpm r0,Z // use r0 as temp
sts 100,r0
subi r24,lo8(-(1))
rjmp .L2
clr __zero_reg__ // outside loop
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/56219] avr-gcc-4.7.2 missing __uint24 loop optimisation
2013-02-06 7:37 [Bug c/56219] New: avr-gcc-4.7.2 missing __uint24 loop optimisation demiurg_spb at freemail dot ru
2013-02-06 12:35 ` [Bug target/56219] " demiurg_spb at freemail dot ru
@ 2013-02-06 13:06 ` demiurg_spb at freemail dot ru
2013-04-12 20:05 ` gjl at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: demiurg_spb at freemail dot ru @ 2013-02-06 13:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56219
--- Comment #2 from demiurg_spb at freemail dot ru 2013-02-06 13:06:01 UTC ---
oops r0 - is call-clobbered:(
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/56219] avr-gcc-4.7.2 missing __uint24 loop optimisation
2013-02-06 7:37 [Bug c/56219] New: avr-gcc-4.7.2 missing __uint24 loop optimisation demiurg_spb at freemail dot ru
2013-02-06 12:35 ` [Bug target/56219] " demiurg_spb at freemail dot ru
2013-02-06 13:06 ` demiurg_spb at freemail dot ru
@ 2013-04-12 20:05 ` gjl at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2013-04-12 20:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56219
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WONTFIX
--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2013-04-12 20:05:11 UTC ---
Closed as WON'T FIX
It might be very well the case that code using __[u]int24 (PSImode) variables
is not compiled as efficient as could be.
Maybe some generic optimizations work also for PSImode so that you'll see
better code for PSI operations as a byproduct of some generic optimizations in
the future. But sorry, no PSI-specific optimization hacks in the avr backend
for now.
Remember that R0 is special and does not survive an insn, i.e. it's used like a
scratch register.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-12 20:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 7:37 [Bug c/56219] New: avr-gcc-4.7.2 missing __uint24 loop optimisation demiurg_spb at freemail dot ru
2013-02-06 12:35 ` [Bug target/56219] " demiurg_spb at freemail dot ru
2013-02-06 13:06 ` demiurg_spb at freemail dot ru
2013-04-12 20:05 ` gjl at gcc dot gnu.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).