public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/13144] New: Bad memory-to-memory code for SSE
@ 2003-11-20 22:08 hjl at lucon dot org
  2003-12-06  9:19 ` [Bug target/13144] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hjl at lucon dot org @ 2003-11-20 22:08 UTC (permalink / raw)
  To: gcc-bugs

When SSE is enabled, gcc generatea bad memory-to-memory code.

[hjl@gnu-1 memcpy]$ cat foo.c
char buf1 [64];
char buf2 [64];
 
 
void
bar ()
{
  memcpy (buf1, buf2, sizeof (buf1));
}
[hjl@gnu-1 memcpy]$ /usr/gcc-3.4/bin/gcc -msse -S -O2 foo.c
[hjl@gnu-1 memcpy]$ cat foo.s
        .file   "foo.c"
        .text
        .p2align 4,,15
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    buf2, %eax
        movl    %esp, %ebp
        popl    %ebp
        movl    %eax, buf1
        movl    buf2+4, %eax
        movl    %eax, buf1+4
        movl    buf2+8, %eax
        movl    %eax, buf1+8
        movl    buf2+12, %eax
        movl    %eax, buf1+12
        movl    buf2+16, %eax
        movl    %eax, buf1+16
        movl    buf2+20, %eax
        movl    %eax, buf1+20
        movl    buf2+24, %eax
        movl    %eax, buf1+24
        movl    buf2+28, %eax
        movl    %eax, buf1+28
        movl    buf2+32, %eax
        movl    %eax, buf1+32
        movl    buf2+36, %eax
        movl    %eax, buf1+36
        movl    buf2+40, %eax
        movl    %eax, buf1+40
        movl    buf2+44, %eax
        movl    %eax, buf1+44
        movl    buf2+48, %eax
        movl    %eax, buf1+48
        movl    buf2+52, %eax
        movl    %eax, buf1+52
        movl    buf2+56, %eax
        movl    %eax, buf1+56
        movl    buf2+60, %eax
        movl    %eax, buf1+60
        ret
        .size   bar, .-bar
        .comm   buf1,64,32
        .comm   buf2,64,32
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4 20031105 (experimental)"

It is because move_by_pieces_ninsns assumes TImode can be accessed
with 8 bit alignment. But the i386 backend won't do it. Should i386
define SLOW_UNALIGNED_ACCESS for TImode and move_by_pieces_ninsns
check the widest mode instead of word_mode for slow unaligned access?

-- 
           Summary: Bad memory-to-memory code for SSE
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl at lucon dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13144


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

end of thread, other threads:[~2005-01-06  6:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-20 22:08 [Bug target/13144] New: Bad memory-to-memory code for SSE hjl at lucon dot org
2003-12-06  9:19 ` [Bug target/13144] " pinskia at gcc dot gnu dot org
2003-12-09 17:24 ` hjl at lucon dot org
2003-12-09 17:47 ` [Bug target/13144] pessimize " pinskia at gcc dot gnu dot org
2005-01-06  6:28 ` rth at gcc dot gnu dot org
2005-01-06  6:53 ` rth 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).