This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/39819] [avr] Missed optimisation when setting 4-byte values
- From: "gjl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 2 Jul 2011 21:24:50 +0000
- Subject: [Bug target/39819] [avr] Missed optimisation when setting 4-byte values
- Auto-submitted: auto-generated
- References: <bug-39819-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39819
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |gjl at gcc dot gnu.org
Known to work| |4.6.1
Resolution| |WONTFIX
--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-02 21:23:59 UTC ---
Closed as WONTFIX.
Compiled the following code in 4.6.1, -std=c99 -mmcu=atmega88 -Os
typedef unsigned char uint8_t;
typedef unsigned long int uint32_t;
uint8_t as[4];
uint8_t bs[4];
static const uint8_t sz = 4;
void foo1(void) {
for (uint8_t i = 0; i < sz; i++) {
bs[i] = as[1];
}
}
void foo2(void) {
for (uint8_t i = 0; i < sz; i++) {
*(bs + i) = *(as + 1);
}
}
The result is:
foo1:
lds r24,as+1
sts bs,r24
sts bs+1,r24
sts bs+2,r24
sts bs+3,r24
ret
foo2:
lds r24,as+1
sts bs,r24
sts bs+1,r24
sts bs+2,r24
sts bs+3,r24
ret
So the difference has gone.