https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43147
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> --- Created attachment 45303 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45303&action=edit example patch (untested) Making the meaning of shuffles visible in GIMPLE could help a bit (although it wouldn't solve the problem completely because IIRC we don't dare combine shuffles, since it is hard to find an optimal expansion for a shuffle and we might pessimize some cases). This patch is one simple way to make _mm_shuffle_pd less opaque. _mm_shuffle_ps would be a bit longer but still manageable. It has the drawback that it does not diagnose when the mask is not a constant, or not between 0 and 3, and I am not sure how to do that from the C code. An alternative would be to keep the current builtin but turn it into a vec_perm_expr in ix86_gimple_fold_builtin, which could include diagnostics.