http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56118
Bug #: 56118 Summary: No constant propagation in vector field assignment Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: gli...@gcc.gnu.org Target: x86_64-linux-gnu Hello, with this code: #include <x86intrin.h> __m128d f(){ __m128d r={3,4}; r[0]=1; r[1]=2; return r; } gcc sees the following and fails to optimize it: r = { 3.0e+0, 4.0e+0 }; BIT_FIELD_REF <r, 64, 0> = 1.0e+0; BIT_FIELD_REF <r, 64, 64> = 2.0e+0; Nothing fixes it at the RTL level either, so we end up with: movapd .LC0(%rip), %xmm0 movlpd .LC1(%rip), %xmm0 movhpd .LC2(%rip), %xmm0