public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43311]  New: missed 'movw' optimization.
@ 2010-03-09 19:06 pluto at agmk dot net
  2010-03-10 10:55 ` [Bug target/43311] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 7+ messages in thread
From: pluto at agmk dot net @ 2010-03-09 19:06 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-05 23:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-43311-4@http.gcc.gnu.org/bugzilla/>
2012-01-25  0:02 ` [Bug target/43311] missed 'movw' optimization pinskia at gcc dot gnu.org
2012-01-25 10:43 ` zsojka at seznam dot cz
2012-01-25 11:21 ` rguenth at gcc dot gnu.org
2012-01-25 13:15 ` zsojka at seznam dot cz
2012-01-25 13:21 ` jakub at gcc dot gnu.org
2022-01-05 23:28 ` pinskia at gcc dot gnu.org
2010-03-09 19:06 [Bug target/43311] New: " pluto at agmk dot net
2010-03-10 10:55 ` [Bug target/43311] " rguenth 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).