Re: casting "extended vectors"

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

 



On Sun, 6 Jul 2014, Vincenzo Innocente wrote:

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.
    VF convert(itype i) { VF f; for (int j=0;j<N;++j) f[j]=i[j]; return f;}
   itype convert(VF f) { itype i; for (int j=0;j<N;++j) i[j]=f[j]; return i;}
vectorize for N=8  and N=16, does not vectorize for N=4 (independently of the target architecture)

Even for N=8 or 16, if you inline convert, it won't vectorize anymore. The vectorizer needs to see a non-local object to start working.

strange syntax indeed. of course in c++ would be trivial… "__builtin_convertvector<T>” It that would be a very welcome addition whatever syntax you choose/manage-to-implement

If you can also try to add something for “movemask” would be also great!

Please file enhancement PRs (after making sure they don't already exist) with as much information as you can. I am unlikely to implement that any time soon, maybe somebody else will be...

For the vector extension, we don't want things that are too specific to a processor. Maybe an operation that takes an integer vector guaranteed to have only 0 and -1 as elements and compacting it to a bitfield would make sense (and the reverse operation), this would be relevant for sparc-vis and for avx512. Movemask seems a bit too weird for direct support.

--
Marc Glisse




[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