Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Fancy SSE instructions in gcc

Name: Anonymous 2008-12-01 16:11

Does anyone know if gcc can produce code that uses SSE?

This is the program I'm trying to compile with gcc -msse -msse2 -msse3 sse.c -S -O2 -o sse.S:
#include <xmmintrin.h>

__m128i qq(__m128i a,__m128i b){
    return a&b;
}


And here's what I'm getting
    .file    "sse.c"
    .text
    .p2align 4,,15
.globl _qq
    .def    _qq;    .scl    2;    .type    32;    .endef
_qq:
    pushl    %ebp
    pxor    %xmm2, %xmm2
    movl    %esp, %ebp
    subl    $56, %esp
    movdqa    %xmm0, -24(%ebp)
    movl    -24(%ebp), %eax
    movdqa    %xmm1, -40(%ebp)
    movl    -40(%ebp), %ecx
    movdqa    %xmm2, -56(%ebp)
    movl    -36(%ebp), %edx
    andl    %ecx, %eax
    movl    %eax, -56(%ebp)
    movl    -20(%ebp), %eax
    movl    -32(%ebp), %ecx
    andl    %edx, %eax
    movl    -28(%ebp), %edx
    movl    %eax, -52(%ebp)
    movl    -16(%ebp), %eax
    andl    %ecx, %eax
    movl    %eax, -48(%ebp)
    movl    -12(%ebp), %eax
    andl    %edx, %eax
    movl    %eax, -44(%ebp)
    movdqa    -56(%ebp), %xmm0
    leave
    ret


This is most definitely not what I'm expecting; this simple function can be implemented in five instructions, but gcc decides to ignore SSE and do anding manually.

Name: Anonymous 2008-12-02 13:29

>>32
The beauty of anonymous posting is that once you've made a complete fool of yourself, you don't have to keep digging.
There's no reputation to salvage. Just accept that you were an idiot, learn from your mistakes, and move on.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List