[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#406442: Incorrect SSE2 code generated for vector initialization by cast from non-constant array



Package: gcc-4.1
Version: 4.1.1-21

--- begin bug.c ---
typedef long long v2di __attribute__ ((vector_size(16)));
extern long long x(void);
extern long long y(void);

v2di test(void)
{
  return (v2di){x(),y()};
}
--- end bug.c ---

When the above is compiled with `gcc -O -msse2 -S bug.c', the following
incorrect code is generated. Both values get loaded into the lower
vector component,while the upper component is zeroed.

--- begin bug.s ---
        .file   "bug.c"
        .text
.globl test
        .type   test, @function
test:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $24, %esp
        call    x
        movl    %eax, -8(%ebp)
        movl    %edx, -4(%ebp)
        call    y
        movl    %eax, -16(%ebp)
        movl    %edx, -12(%ebp)
        movq    -16(%ebp), %xmm1
        movlps  -8(%ebp), %xmm1
        movdqa  %xmm1, %xmm0
        leave
        ret
        .size   test, .-test
        .ident  "GCC: (GNU) 4.1.2 20061115 (prerelease) (Debian
4.1.1-21)"
        .section        .note.GNU-stack,"",@progbits
--- end bug.s ---

Regards,
Geoff.


Send instant messages to your online friends http://au.messenger.yahoo.com 



Reply to: