casting "extended vectors"

Vincenzo Innocente vincenzo.innocente@cern.ch
Sat Jul 5 15:33:00 GMT 2014


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.
Is it possible to cast “vectors”  as in C one casts intrinsic types?

given
typedef float __attribute__( ( vector_size( 16 ) ) ) float32x4_t;
typedef int __attribute__( ( vector_size( 16 ) ) ) int32x4_t;

   float32x4_t vf{4.2,-3.2, 1.2, 7.2};
   int32x4_t vi = int32x4_t(vf);
   is not what I would like to be i.e.
   int32x4_t vi{int(vf[0]),int(vf[1]),int(vf[2]),int(vf[3])};   

     
  best,
     v.



More information about the Gcc-help mailing list