[LLVMbugs] [Bug 15434] New: Alignment of float arrays in pentium3 mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 4 01:24:08 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15434

            Bug ID: 15434
           Summary: Alignment of float arrays in pentium3 mode
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: klimek at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider the following snippet:
#include <xmmintrin.h>
#include <stdio.h>

void f() {
 UNALIGN_TYPE unalign;
 float step[32];
 printf("%lld\n", (long long)(&step[0]) % 16);
 __m128 result[8];
 _mm_store_ps(&step[0], result[0]);
}

int main() {
 f();
}

$ g++ -DUNALIGN_TYPE=float t.cc -o t -m32 -march=pentium3 -O0 && ./t &&
~/build/llvm-opt/bin/clang++ -DUNALIGN_TYPE=float t.cc -o t -m32
-march=pentium3 -O0 && ./t
0
12
Segmentation fault (core dumped)

$ g++ -DUNALIGN_TYPE=double t.cc -o t -m32 -march=pentium3 -O0 && ./t &&
~/build/llvm-opt/bin/clang++ -DUNALIGN_TYPE=double t.cc -o t -m32
-march=pentium3 -O0 && ./t
0
8
Segmentation fault (core dumped)

GCC seems to 16-byte align the float arrays. Chandler mentioned that this thus
is part of the implicit ABI.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130304/527c0beb/attachment.html>


More information about the llvm-bugs mailing list