public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: target/6624: SSE misalignment with -O0
@ 2002-05-10 10:56 Tim Prince
0 siblings, 0 replies; 2+ messages in thread
From: Tim Prince @ 2002-05-10 10:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR target/6624; it has been noted by GNATS.
From: Tim Prince <tprince@computer.org>
To: jdhall@uiuc.edu, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: target/6624: SSE misalignment with -O0
Date: Fri, 10 May 2002 10:49:20 -0700
On Friday 10 May 2002 09:12, Jesse Hall wrote:
> >Number: 6624
> >Category: target
> >Synopsis: SSE mis-alignment with -O0
> >Confidential: no
> >Severity: serious
> >Priority: medium
> >Responsible: unassigned
> >State: open
> >Class: wrong-code
> >Submitter-Id: net
> >Arrival-Date: Fri May 10 09:16:01 PDT 2002
> >Closed-Date:
> >Last-Modified:
> >Originator: Jesse Hall
> >Release: 3.1 20020426 (prerelease)
> >Organization:
> >Environment:
>
> System: Linux espresso 2.4.18-xfs #1 SMP Tue Mar 12 20:03:55 CST 2002 i686
> unknown Architecture: i686 (more precisely, dual AthlonMP)
>
>
> host: i386-pc-linux-gnu
> build: i386-pc-linux-gnu
> target: i386-pc-linux-gnu
> configured with: ../src/configure -v
> --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr/lib/gcc-snapshot
> --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as
> --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls
> --without-included-gettext --disable-checking --enable-threads=posix
> --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc
> i386-linux
>
> >Description:
>
> The SSE intrinsic _mm_loadu_ps can do an aligned SSE load (LOADAPS)
> from an unaligned address when compiling with -O0. The problem seems to go
> away with -O1 and higher. This causes a segfault when the program is run.
> The assembly generated looks like:
>
> call 804834a <_mm_loadu_ps>
> add $0x10,%esp
> movaps %xmm0,0xffffffe8(%ebp)
>
> On my machine, the movaps address is consistently not on a 16-byte
> boundary like it should be.
>
> >How-To-Repeat:
>
> This simple program exhibits the problem on my machine:
>
> #include <xmmintrin.h>
> int main(int argc, char** argv) {
> __m128 x;
> float a[4] = {1.0f, 1.0f, 1.0f, 1.0f};
> x = _mm_loadu_ps(a);
> return 0;
> }
>
> Compiled with "gcc -g -O0 -msse foo.c -o foo".
>
> >Fix:
>
> Compiling with -O1 or higher makes the problem go away, at least in the
> simple example above.
>
> >Release-Note:
> >Audit-Trail:
> >Unformatted:
According to my understanding, alignments aren't supported by gcc in main(),
as the OS doesn't necessarily present an aligned stack. The necessary
alignments are supported in functions which are called by a function built
with -mpreferred-stack-boundary=4. The option -Os is intended to present a
lesser alignment; -O2 usually (but not always?) passes a fully aligned stack
to its callees. I'm not sure of all this, and better documentation seems
needed.
--
Tim Prince
^ permalink raw reply [flat|nested] 2+ messages in thread
* target/6624: SSE misalignment with -O0
@ 2002-05-10 9:16 Jesse Hall
0 siblings, 0 replies; 2+ messages in thread
From: Jesse Hall @ 2002-05-10 9:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 6624
>Category: target
>Synopsis: SSE mis-alignment with -O0
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri May 10 09:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Jesse Hall
>Release: 3.1 20020426 (prerelease)
>Organization:
>Environment:
System: Linux espresso 2.4.18-xfs #1 SMP Tue Mar 12 20:03:55 CST 2002 i686 unknown
Architecture: i686 (more precisely, dual AthlonMP)
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr/lib/gcc-snapshot --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
The SSE intrinsic _mm_loadu_ps can do an aligned SSE load (LOADAPS) from
an unaligned address when compiling with -O0. The problem seems to go away
with -O1 and higher. This causes a segfault when the program is run. The
assembly generated looks like:
call 804834a <_mm_loadu_ps>
add $0x10,%esp
movaps %xmm0,0xffffffe8(%ebp)
On my machine, the movaps address is consistently not on a 16-byte
boundary like it should be.
>How-To-Repeat:
This simple program exhibits the problem on my machine:
#include <xmmintrin.h>
int main(int argc, char** argv) {
__m128 x;
float a[4] = {1.0f, 1.0f, 1.0f, 1.0f};
x = _mm_loadu_ps(a);
return 0;
}
Compiled with "gcc -g -O0 -msse foo.c -o foo".
>Fix:
Compiling with -O1 or higher makes the problem go away, at least in the
simple example above.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-05-10 17:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-10 10:56 target/6624: SSE misalignment with -O0 Tim Prince
-- strict thread matches above, loose matches on Subject: below --
2002-05-10 9:16 Jesse Hall
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).