http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53338
Bug #: 53338 Summary: [4.8 Regression] Unaligned store generated for aligned data Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: ubiz...@gmail.com Following testcase: --cut here-- #define SIZE 10240 int b[SIZE], c[SIZE]; long long __attribute__((__aligned__ (128))) a[SIZE]; void imul32_to_64 (void) { int i; for (i = 0; i < SIZE; i++) a[i] = (long)b[i] * (long)c[i]; } --cut here-- regressed from 4.7 when compiled with "-O3 -msse4". An unaligned store is generated in 4.8, where in 4.7 aligned store is used. 4.8: .L3: movdqa b(%rax), %xmm1 movdqa c(%rax), %xmm0 movdqa %xmm1, %xmm3 movdqa %xmm0, %xmm2 punpckldq %xmm1, %xmm3 punpckldq %xmm0, %xmm2 punpckhdq %xmm1, %xmm1 punpckhdq %xmm0, %xmm0 pmuldq %xmm3, %xmm2 >> movdqu %xmm2, a(%rax,%rax) pmuldq %xmm1, %xmm0 >> movdqu %xmm0, a+16(%rax,%rax) addq $16, %rax cmpq $40960, %rax jne .L3 4.7.1: .L2: movdqa b(%rax), %xmm1 movdqa c(%rax), %xmm0 movdqa %xmm1, %xmm3 movdqa %xmm0, %xmm2 punpckldq %xmm1, %xmm3 punpckldq %xmm0, %xmm2 punpckhdq %xmm1, %xmm1 punpckhdq %xmm0, %xmm0 pmuldq %xmm3, %xmm2 >> movdqa %xmm2, a(%rax,%rax) pmuldq %xmm1, %xmm0 >> movdqa %xmm0, a+16(%rax,%rax) addq $16, %rax cmpq $40960, %rax jne .L2 The unaligned store is generated from expr.c, expand_assignment.