What will call _mm_setzero_si128 () for SIGSEGV?

Possible duplicate:
Qt, GCC, SSE and stack alignment

I am converting a simulator from TinyPTC to WxWidgets. Some graphics routines are optimized using the built-in SSE features. During GUI initialization, the initial state is displayed once, and all SSE routines work fine. However, if I call them later from the event handler, I will get SIGSEGV.

At first I thought that these were some weird alignment problems, but this happens even for:

__m128i zero = _mm_setzero_si128();

When I replace SSE routines with non-optimized code, everything works fine.

I believe that event processing occurs in a different thread than initialization. Is there something to consider when using SSE from different threads? What else could cause this behavior?


SIGSEGV occurs with the instruction movdqa %xmm0, -40(%ebp)(there are several of them). If I compile with -O1, the instructions are movdqafully optimized and the program works fine. This seems to be a stack alignment issue, as already mentioned in the comments.

Here is the CodeLite command to compile:

g++ -c "x:/some/folder/sse.cpp" -g -O1 -Wall -std=gnu++0x -msse3
-mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE
-ID:\CodeLite\wxWidgets\lib\gcc_dll\mswud -ID:\CodeLite\wxWidgets\include
-DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -o ./Debug/sse.o -I.

Anything unusual? Is it possible that WxWidgets is changing the alignment settings somewhere?

+5
source share
3 answers

, , . SSE , 16 . _mm_setzero_si128, SSE, , .

, GCC ( SSE). -mstackrealign , 16- ( ).

movdqa . 2-6 . 4-67 2a . 4-67 Intel Architecture, .

+4

AFAIK, wxWidgets ( GUI.) , . , .

0

SSE. SSE . , , SSE. . , . , .

0

All Articles