casting "extended vectors"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux