This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/43311] New: missed 'movw' optimization.
- From: "pluto at agmk dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Mar 2010 19:06:39 -0000
- Subject: [Bug target/43311] New: missed 'movw' optimization.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
reduced testcase:
typedef struct { unsigned char b1, b2; } __attribute__((aligned(8))) S;
void f( S const* s, unsigned char* b1, unsigned char* b2 )
{
*b1 = s->b1;
*b2 = s->b2;
}
generates at -Os and -O3:
f:
movb (%rdi), %al # <variable>.b1, <variable>.b1
movb %al, (%rsi) # <variable>.b1,* b1
movb 1(%rdi), %al # <variable>.b2, <variable>.b2
movb %al, (%rdx) # <variable>.b2,* b2
ret
gcc could (at least at -Os) reduce code size and memory accesses to:
movw (%rdi), %ax
movb %al, (%rsi) # <variable>.b1,* b1
movb %ah, (%rdx) # <variable>.b2,* b2
ret
--
Summary: missed 'movw' optimization.
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pluto at agmk dot net
GCC build triplet: x86_64-gnu-linux
GCC host triplet: x86_64-gnu-linux
GCC target triplet: x86_64-gnu-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43311