This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Segfault with SSE builtins


I've been trying to get the builtin functions corresponding to SSE 
instructions to work, and I keep getting segfaults on any code that 
uses them. Example:

typedef float v4sf __attribute__ ((mode(V4SF)));
int main() {
  v4sf u, v, w;
  w = __builtin_ia32_addps(u, v);
  return 0;
}

This generates the assembly code (compiled with -march=athlon-xp and no 
other special options):

    .file   "foo.c"
    .text
    .align 2
.globl main
    .type   main,@function
main:
    pushl   %ebp
    movl    %esp, %ebp
    subl    $56, %esp
    andl    $-16, %esp
    movl    $0, %eax
    subl    %eax, %esp
    movaps  -24(%ebp), %xmm0
    addps   -40(%ebp), %xmm0
    movaps  %xmm0, -56(%ebp)
    movl    $0, %eax
    leave
    ret
.Lfe1:
    .size   main,.Lfe1-main
    .ident  "GCC: (GNU) 3.1"

This segfaults as soon as it hits the first SSE instruction (movaps). 
I'm not assembler guru enough to try any further analysis. Similar code 
with MMX or 3DNow instructions works fine. Am I doing something wrong, 
or have I hit a known bug somewhere, or what?

Using GCC 3.1.0 (output of gcc -v below) on Linux 2.4.18; CPU is Athlon 
XP 2100+ (Palomino). I don't have any Intel boxes to try it on to see 
if it's Athlon specific.

Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc-3.1/configure --enable-threads=posix 
--enable-version-specific-runtime-libs 
--enable-languages=c,c++,f77,java
Thread model: posix
gcc version 3.1

-- 
Ross Smith ..................................... Auckland, New Zealand
r-smith@ihug.co.nz ...................................................

  "Never underestimate the power of stupid things in large numbers."
                                                      -- Serious Sam


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]