https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128846
--- Comment #8 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot
Uni-Bielefeld.DE> ---
>> This is the x86_64-linux -m64 behaviour. For i686, I see this instead:
>
> I don't have convenient access to a bare i686, but using -march=i686
me neither. This is always a 64-bit kernel either with a 32-bit gcc
(Solaris) or 64-bit gcc -m32 (Linux).
> shows we don't vectorize on trunk, even with -fno-vect-cost-model,
> so that would explain the lower alignment (it's the vectorizer requesting
> a alrger alignment). With -march=i686 -msse2 it gets vectorized and
> alignment is sufficient.
Here's part of the difference:
* Linux defaults to -march=pentiumpro -mno-sse2
* Solaris defaults to -march=pentium4 -msse2
With -mno-sse2 the test passes.
> So the solaris alignment should be sufficient for movaps %xmm, so how
> is it not?
Alignment is correct in both cases:
* Linux/i386 pentium4:
[18] .tbss
NOBITS 0804bef0 002ef0 000288 00 0 0 16
[00000403]: WRITE, ALLOC, TLS
* Solaris/i386 pentium4:
[26] .tbss
NOBITS 08060ed0 000ed0 000288 00 0 0 16
[00000403]: WRITE, ALLOC, TLS
However, there are still codegen differences, as attached:
* Linux/i386 pentium4:
Breakpoint 1, 0x08049040 in main ()
=> 0x8049040 <main>: mov %gs:0x0,%edx
=> 0x8049047 <main+7>: lea -0x290(%edx),%eax
(gdb) p/x $edx
$10 = 0xf7c5a9c0
=> 0x804904d <main+13>: add $0xfffffff0,%edx
(gdb) p/x $eax
$11 = 0xf7c5a730
=> 0x8049053 <main+19>: movapd 0x804a010,%xmm0
=> 0x804905b <main+27>: lea %cs:0x0(%esi,%eiz,1),%esi
=> 0x8049060 <main+32>: movapd %xmm0,(%eax)
* Solaris/i386 pentium4:
Thread 2 hit Breakpoint 1, 0x08050c30 in main ()
=> 0x8050c30 <main>: mov %gs:0x0,%ecx
=> 0x8050c37 <main+7>: movsd 0x8050a00,%xmm0
(gdb) p/x $ecx
$6 = 0xfe5e04c0
=> 0x8050c3f <main+15>: lea -0x288(%ecx),%eax
=> 0x8050c45 <main+21>: lea -0x8(%ecx),%edx
(gdb) p/x $eax
$7 = 0xfe5e0238
=> 0x8050c4b <main+27>: unpcklpd %xmm0,%xmm0
=> 0x8050c4f <main+31>: nop
=> 0x8050c50 <main+32>: movaps %xmm0,(%eax)
Thread 2 received signal SIGSEGV, Segmentation fault.