This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

casting "extended vectors"


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]