On Fri, Sep 7, 2012 at 7:57 AM, Marc Glisse <marc.glisse@xxxxxxxx> wrote: > On Fri, 7 Sep 2012, Ian Lance Taylor wrote: > >> On Fri, Sep 7, 2012 at 5:05 AM, Henrik Mannerström >> <henrik.mannerstrom@xxxxxxxxx> wrote: >>> >>> >>> If I understand the Intel reference correctly, the CVTDQ2PD should allow >>> me to convert two 64 bit integers into two 64 bit doubles in one blow. >>> How should I write this in gcc C/C++? >>> >>> Program 1 uses casting to illustrate the point, it outputs 0 and 1. >>> Program 2 was my naive attempt to use vectorization, it outputs 0 and >>> 4.94066e-324, which is _not_ what I intended. >> >> >>> a.vd = __v2df(a.vi); >> >> >> This is just a type cast of the vector as a whole. It doesn't convert >> the individual vector elements. > > > I always found it strange that vectors act like values everywhere, except > for casts where they act like pointers. I understand this is convenient to > allow calling intrinsics with vector types that don't exactly match, but it > steals a good syntax that gcc's vector extensions can't use for true > conversions. > > -- > Marc Glisse I'm also a fan of explicit "alias" assignment ala _mm_cast_* functions. Just my 2 cents :) Brian