On Fri, Jun 04, 2021 at 04:21:41PM +0200, Jakub Jelinek wrote:
> but if the permutation was e.g.
> { 0, 13, 2, 3, 4, 5, 6, 7 }
> then it would be called with 5 as index and it could see that
> it is in the second half (aka. the { 0, 0, 0, 0 } constructor) and
> read the 5-4 element from there.

Note, if it is just
typedef unsigned long long __attribute__((__vector_size__ (2 * sizeof (long 
long)))) U;
typedef unsigned long long __attribute__((__vector_size__ (4 * sizeof (long 
long)))) V;
typedef unsigned long long __attribute__((__vector_size__ (8 * sizeof (long 
long)))) W;

U
foo (V v)
{
  return __builtin_shufflevector ((W){}, v, 0, 13);
}
then that doesn't work and is diagnosed as an error, so we'd probably need
help of compound literals in there
typedef unsigned long long __attribute__((__vector_size__ (2 * sizeof (long 
long)))) U;
typedef unsigned long long __attribute__((__vector_size__ (4 * sizeof (long 
long)))) V;
typedef unsigned long long __attribute__((__vector_size__ (8 * sizeof (long 
long)))) W;

U
foo (V v)
{
  return __builtin_shufflevector ((W){}, (V){1,2,3,4}, 0, 9);
}
where it is
  _1 = {{ 1, 2, 3, 4 }, { 0, 0, 0, 0 }};
  _2 = VEC_PERM_EXPR <{ 0, 0, 0, 0, 0, 0, 0, 0 }, _1, { 0, 9, 2, 3, 4, 5, 6, 7 
}>;

        Jakub

Reply via email to