This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/13144] New: Bad memory-to-memory code for SSE
- From: "hjl at lucon dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Nov 2003 22:07:59 -0000
- Subject: [Bug target/13144] New: Bad memory-to-memory code for SSE
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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