https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43147

--- Comment #16 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Hongtao.liu from comment #15)
> > I think pass_combine should be extended to force illegitimate constant
> > to constant pool and recog load insn again, It looks like a general
> > optimization that better not do it in the backend.
> 
> The issue can also be solved by folding __builtin_ia32_shufps to gimple
> VEC_PERM_EXPR, .i.e the below testcase doesn't have the problem
> 
> typedef int v4si __attribute__((vector_size (16)));
> 
> v4si
> foo ()
> {
>     v4si a = __extension__ (v4si) {4, 3, 2, 1};
>     v4si b = __extension__ (v4si) {5, 6, 7, 8};
>     v4si c = __builtin_shufflevector (a, b, 1, 4, 2, 7);
>     v4si d = __builtin_shuffle (c, __extension__ (v4si) { 3, 2, 0, 1 });
>     return d;
> }

But that is because we constant fold on the gimple level for PERMs.
combining VEC_PERM_EXPR on the gimple is PR 54346; note I found this while
looking at other issues too :).

Reply via email to