Much like http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19274, gcc pays a visit to
the stack for _mm_set1_epi32 with a memory reference.
With a couple of days old cvs, -O2 -march=k8 -mfpmath=sse
#include <xmmintrin.h>
__m128i eliminated(const int i) {
return _mm_set1_epi32(i);
}
__m128i not_eliminated(const int *i) {
return _mm_set1_epi32(*i);
}
__m128i not_eliminated_bis(const int &i) {
return _mm_set1_epi32(i);
}
int main() { return 0; }
gives:
00401086 <eliminated(int)>:
401086: 66 0f 6e 44 24 04 movd 0x4(%esp),%xmm0
40108c: 66 0f 70 c0 00 pshufd $0x0,%xmm0,%xmm0
401091: c3 ret
00401092 <not_eliminated(int const*)>:
401092: 83 ec 04 sub $0x4,%esp
401095: 8b 44 24 08 mov 0x8(%esp),%eax
401099: 8b 00 mov (%eax),%eax
40109b: 89 04 24 mov %eax,(%esp)
40109e: 66 0f 6e 0c 24 movd (%esp),%xmm1
4010a3: 66 0f 70 c1 00 pshufd $0x0,%xmm1,%xmm0
4010a8: 83 c4 04 add $0x4,%esp
4010ab: c3 ret
--
Summary: temporary not eliminated in composite _mm_set1_epi32
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tbptbp at gmail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: cygwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19714