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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The first arg doesn't have to be constant:

typedef int __attribute__ ((__vector_size__ (16))) V;
typedef long __attribute__ ((__vector_size__ (16))) W;

void
foo (W *x)
{
  *x = __builtin_shuffle (*x, (W){}, (W)(V){0, 0, -15, 0});
}

__builtin_shuffle is documented:
"The elements of MASK are considered modulo N in the single-operand case and
modulo 2*N in the two-operand case."
and as there are two operands, that means modulo 4, so the result should be
the same as
  *x = __builtin_shuffle (*x, (W){}, (W){0, 1});
I think and thus a nop.

Reply via email to