public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/37003] 4.2.2 -mfpmath=sse causes movapd from non-16-byte aligned address
[not found] <bug-37003-4@http.gcc.gnu.org/bugzilla/>
@ 2011-02-26 9:36 ` vastheman at users dot sourceforge.net
2011-02-26 9:36 ` vastheman at users dot sourceforge.net
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: vastheman at users dot sourceforge.net @ 2011-02-26 9:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37003
Vas Crabb <vastheman at users dot sourceforge.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vastheman at users dot
| |sourceforge.net
--- Comment #4 from Vas Crabb <vastheman at users dot sourceforge.net> 2011-02-26 09:30:56 UTC ---
I can confirm that this still occurs in gcc version 4.3.3 20090124 (Red Hat
4.3.3-13) and in gcc version 4.5.3 (Ubuntu/Linaro 4.5.2-3ubuntu3).
Using the same input, with the following options on gcc version 4.3.3 20090124
(Red Hat 4.3.3-13) (GCC):
gcc -march=core2 -msse2 -mfpmath=sse -O3 -xc++
This is the prologue of the generated code for the function. The Linux i686
ABI doesn't guarantee any more than 32-bit alignment of %esp on entry to a
function, and there is no code here to force alignment of %esp or %ebp:
_Z18create_geo_to_topoP7DMATRIXdd:
.LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
movl %esp, %ebp
.cfi_offset 5, -8
.cfi_def_cfa_register 5
pushl %ebx
subl $148, %esp
movl 8(%ebp), %ebx
.cfi_offset 3, -12
Later in the function, we find the following code:
leal -56(%ebp), %eax
movapd %xmm0, -88(%ebp)
movsd %xmm5, -40(%ebp)
movl %eax, (%esp)
call _Z11geo_lla_xyzIP7DVECTORS1_EvT_T0_
movapd -88(%ebp), %xmm0
movsd -24(%ebp), %xmm3
It is using movapd to save and restore the contents of %xmm0 around the
function call. Since movapd re
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/37003] 4.2.2 -mfpmath=sse causes movapd from non-16-byte aligned address
[not found] <bug-37003-4@http.gcc.gnu.org/bugzilla/>
2011-02-26 9:36 ` [Bug target/37003] 4.2.2 -mfpmath=sse causes movapd from non-16-byte aligned address vastheman at users dot sourceforge.net
@ 2011-02-26 9:36 ` vastheman at users dot sourceforge.net
2011-02-26 9:37 ` vastheman at users dot sourceforge.net
2011-02-26 10:50 ` vastheman at users dot sourceforge.net
3 siblings, 0 replies; 6+ messages in thread
From: vastheman at users dot sourceforge.net @ 2011-02-26 9:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37003
--- Comment #5 from Vas Crabb <vastheman at users dot sourceforge.net> 2011-02-26 09:33:44 UTC ---
I can confirm that this still occurs in gcc version 4.3.3 20090124 (Red Hat
4.3.3-13) and in gcc version 4.5.3 (Ubuntu/Linaro 4.5.2-3ubuntu3).
Using the same input, with the following options on gcc version 4.3.3 20090124
(Red Hat 4.3.3-13) (GCC):
gcc -march=core2 -msse2 -mfpmath=sse -O3 -xc++
This is the prologue of the generated code for the function. The Linux i686
ABI doesn't guarantee any more than 32-bit alignment of %esp on entry to a
function, and there is no code here to force alignment of %esp or %ebp:
_Z18create_geo_to_topoP7DMATRIXdd:
.LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
movl %esp, %ebp
.cfi_offset 5, -8
.cfi_def_cfa_register 5
pushl %ebx
subl $148, %esp
movl 8(%ebp), %ebx
.cfi_offset 3, -12
Later in the function, we find the following code:
leal -56(%ebp), %eax
movapd %xmm0, -88(%ebp)
movsd %xmm5, -40(%ebp)
movl %eax, (%esp)
call _Z11geo_lla_xyzIP7DVECTORS1_EvT_T0_
movapd -88(%ebp), %xmm0
movsd -24(%ebp), %xmm3
It is using movapd to save and restore the contents of %xmm0 around the
function call. Since movapd requires the memory operand to fall on a 16-byte
boundary, this only works if, by chance, the stack was aligned appropriately on
entry to the function. In this case, GCC should probably use some other
instruction (e.g. movupd) to save the contents of the XMM register to avoid the
possibility of causing a general protection fault if the stack isn't aligned as
required.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/37003] 4.2.2 -mfpmath=sse causes movapd from non-16-byte aligned address
[not found] <bug-37003-4@http.gcc.gnu.org/bugzilla/>
2011-02-26 9:36 ` [Bug target/37003] 4.2.2 -mfpmath=sse causes movapd from non-16-byte aligned address vastheman at users dot sourceforge.net
2011-02-26 9:36 ` vastheman at users dot sourceforge.net
@ 2011-02-26 9:37 ` vastheman at users dot sourceforge.net
2011-02-26 10:50 ` vastheman at users dot sourceforge.net
3 siblings, 0 replies; 6+ messages in thread
From: vastheman at users dot sourceforge.net @ 2011-02-26 9:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37003
--- Comment #6 from Vas Crabb <vastheman at users dot sourceforge.net> 2011-02-26 09:35:50 UTC ---
Sorry, I should mention that this happened when targeting 32-bit x86
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/37003] 4.2.2 -mfpmath=sse causes movapd from non-16-byte aligned address
[not found] <bug-37003-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-02-26 9:37 ` vastheman at users dot sourceforge.net
@ 2011-02-26 10:50 ` vastheman at users dot sourceforge.net
3 siblings, 0 replies; 6+ messages in thread
From: vastheman at users dot sourceforge.net @ 2011-02-26 10:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37003
--- Comment #7 from Vas Crabb <vastheman at users dot sourceforge.net> 2011-02-26 09:39:02 UTC ---
Created attachment 23477
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23477
assembly output from GCC 4.5.2 Red Hat i686
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/37003] New: 4.2.2 -mfpmath=sse causes movapd from non-16-byte aligned address
@ 2008-08-01 17:35 gkumar007 at gmail dot com
2008-08-01 20:11 ` [Bug target/37003] " pinskia at gcc dot gnu dot org
2009-09-17 9:24 ` ubizjak at gmail dot com
0 siblings, 2 replies; 6+ messages in thread
From: gkumar007 at gmail dot com @ 2008-08-01 17:35 UTC (permalink / raw)
To: gcc-bugs
gcc-4.2.2 seems to generating wrong/misaligned code for movapd.
I have used the same test case mentione here (for almost the similar bug)
http://gcc.gnu.org/bugzilla/attachment.cgi?id=6012
The relavent information about the version and the files are as follows:
The version of gcc:
gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../../src/gcc-4.2.2/configure
--prefix=/depot/gcc-4.2.2-static --disable-shared
--enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,c++,objc,fortran --with-cpu=generic
--host=i386-redhat-linux
Thread model: posi
$ gcc -g -O2 -funsigned-bitfields -fsigned-char -ffloat-store -Wformat
-msse2 -mfpmath=sse -c sse.c
$ objdump -Sd sse.o > sse_asm.txt
$ grep movapd sse_asm.txt
a3: 66 0f 28 c2 movapd %xmm2,%xmm0
cb: 66 0f 28 c1 movapd %xmm1,%xmm0
f6: 66 0f 28 c4 movapd %xmm4,%xmm0
165: 66 0f 29 9d 38 fe ff movapd %xmm3,0xfffffe38(%ebp) #<============
185: 66 0f 28 9d 38 fe ff movapd 0xfffffe38(%ebp),%xmm3
Is this a known issue? If so, is there are there any suggested
workarounds (other than upgrading to later versions :-) ?
Regards,
Gowri Kumar
--
Summary: 4.2.2 -mfpmath=sse causes movapd from non-16-byte
aligned address
Product: gcc
Version: 4.2.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gkumar007 at gmail dot com
GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37003
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-02-26 9:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-37003-4@http.gcc.gnu.org/bugzilla/>
2011-02-26 9:36 ` [Bug target/37003] 4.2.2 -mfpmath=sse causes movapd from non-16-byte aligned address vastheman at users dot sourceforge.net
2011-02-26 9:36 ` vastheman at users dot sourceforge.net
2011-02-26 9:37 ` vastheman at users dot sourceforge.net
2011-02-26 10:50 ` vastheman at users dot sourceforge.net
2008-08-01 17:35 [Bug c/37003] New: " gkumar007 at gmail dot com
2008-08-01 20:11 ` [Bug target/37003] " pinskia at gcc dot gnu dot org
2009-09-17 9:24 ` ubizjak at gmail dot com
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).