Hi,
I noticed that vector permutation gets more use in GCC
4.6, which is great. It is used to handle negative step
by reversing vector elements now. 

However, after reading the related code, I understood
that it only works when the # of vector elements is 
the same as that of mask vector in the following code. 

perm_mask_for_reverse (tree-vect-stmts.c)
...
  mask_type = get_vectype_for_scalar_type (mask_element_type);
  nunits = TYPE_VECTOR_SUBPARTS (vectype);
  if (!mask_type
      || TYPE_VECTOR_SUBPARTS (vectype) != TYPE_VECTOR_SUBPARTS (mask_type))
    return NULL;
...

For PowerPC altivec, the mask_type is V16QI. It means that
compiler can only permute V16QI type.  But given the capability of
altivec vperm instruction, it can permute any 128-bit type 
(V8HI, V4SI, etc). We just need convert in/out V16QI from
given types and a bit more extra work in producing mask. 

Do I understand correctly or miss something here?

Thanks,
Bingfeng Mei




Reply via email to