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

--- Comment #15 from Hongtao.liu <crazylht at gmail dot com> ---

> 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;
}

foo():
  movdqa .LC0(%rip), %xmm0
  ret
.LC0:
  .long 8
  .long 2
  .long 3
  .long 5

Reply via email to