[Bug tree-optimization/49064] [x86/x64]: broken alias analysis leads vectorizer to emit poor code
piotr.wyderski at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu May 19 14:41:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49064
--- Comment #1 from Piotr Wyderski <piotr.wyderski at gmail dot com> 2011-05-19 14:27:28 UTC ---
This is caused by the following definition in emmintrin.h:
/* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components. */
typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));
Without __may_alias__ the generated assembly code is OK.
It's wrong to blindly assume a type aliases everything;
proper analysis should be performed.
Because the headers are indended to provide seamless integration
with MSVC and ICC vectorized code, it's a good practice to use SSE
that way. Most bona fide users will step into that trap assuming
GCC produces comparably good code, which in this case it obviously
doesn't, as can be seen above.
More information about the Gcc-bugs
mailing list