This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: casting "extended vectors"
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Vincenzo Innocente <vincenzo dot innocente at cern dot ch>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sun, 6 Jul 2014 15:45:16 +0200 (CEST)
- Subject: Re: casting "extended vectors"
- Authentication-results: sourceware.org; auth=none
- References: <B4ED95BB-BB4D-4771-9423-B84DE9C9BE4C at cern dot ch>
- Reply-to: gcc-help at gcc dot gnu dot org
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