https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65197
Bug ID: 65197 Summary: static initialization via intel intrinsics Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target: x86_64-linux-gnu I am compiling the following with: g++ -std=gnu++11 -Ofast #include <x86intrin.h> extern const __m128i x = { -1, 0 }; extern const __m128i y = _mm_set_epi64x (0, -1); While x becomes a nice constant in .rodata, y is initialized by _GLOBAL__sub_I_x (copying a constant that is in .rodata). For this specific case, marking _mm_set_epi64x as constexpr gives y the same treatment as x, and I believe we should do that, i.e. mark all intrinsics that can be constexpr in C++11/C++14. However, I believe we are missing an optimization in the general case that would notice (late, after many optimizations) when the initialization function has become unnecessary. Some possibly related bugs: PR4131, PR18399, PR24928, PR37949.