casting "extended vectors"

Marc Glisse marc.glisse@inria.fr
Sun Jul 6 13:45:00 GMT 2014


On Sat, 5 Jul 2014, Vincenzo Innocente wrote:

> at the end of
> https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html
> I read
> "It is possible to cast from one vector type to another, provided they are of the same size"
>
> when I try, it looks to me that it is actually more a type-punning rather than a C-style cast.

Indeed, I am not happy about that, but it seems hard to change that now. 
If you could send a patch to gcc-patches improving the documentation, it 
would be welcome.

> Is it possible to cast “vectors”  as in C one casts intrinsic types?

Not directly, no. You can cast element by element and hope gcc will 
vectorize it, but I don't even think that is likely.

>From a language point of view, clang recently introduced 
__builtin_convertvector. It takes a type as second parameter, that may be 
an issue if we try to implement the same in gcc.

>From an implementation point of view, we seem to have most (all?) pieces 
(float_expr, vec_unpack_hi_expr, etc) to represent those in the 
middle-end.

-- 
Marc Glisse



More information about the Gcc-help mailing list