http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57156
Bug #: 57156 Summary: miscompilation of call to _mm_cmpeq_epi8(a, a) or _mm_comtrue_epu8(a, a) with uninitialized a Classification: Unclassified Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: kr...@kde.org Testcase: #include <x86intrin.h> static inline __m128 allone() { __m128i a; #ifdef __XOP__ return _mm_castsi128_ps(_mm_comtrue_epu8(a, a)); #else return _mm_castsi128_ps(_mm_cmpeq_epi8(a, a)); #endif } struct X { explicit X() : k(allone()) {} explicit X(bool b) : k(b ? allone() : _mm_setzero_ps()) {} bool operator!=(const X &rhs) const { return _mm_movemask_ps(k) != _mm_movemask_ps(rhs.k); } __m128 k; }; int main() { if (X() != X(true)) { __builtin_abort(); } return 0; } Compile with "g++ -O1 -msse2" or "g++ -O1 -mxop". If you initialize 'a' with _mm_setzero_si128() the problem disappears.