Re: GCC Vector Extensions

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

 



Es geschah am Tuesday, 18. April 2006 12:04 als Andrew Haley schrieb:
> Christian Schoenebeck writes:
>  > Es geschah am Friday, 7. April 2006 22:17 als Greg Buchholz schrieb:
>  > > Christian Schoenebeck wrote:
>  > > > b) We wondered [2] what the currently best way is to access single
>  > > > elements of one vector. Currently the only solution we saw is to use
>  > > > a union trick
>  > >
>  > > /* I don't know if this qualifies as good, but here's some things
>  > >    I've used before  */
>  >
>  > Oh, it officially qualified as good! We just made some benchmarks
>  > [1] to compare our old union trick vs. your straight forward type
>  > casts and your solutions were always faster, often even quite a
>  > lot. So as we thought, gcc doesn't like that union thing very much.
>
> It's not legal C, though.  The _mm_load, _mm_set, and _mm_store
> operations are provided to do the conversions.

Well, those intrinsics would make it hardware dependent though. I thought the
reason for introducing the vector extension was to avoid this. Anyway, I don't
mind if this is legal C or not until it works^TM.

Unfortunately we found a case [1] which did not work at all: a type cast from
float vector to integer vector, like:

    typedef float   v4sf  __attribute__ ((vector_size(16),aligned(16)));
    typedef int     v4i   __attribute__ ((vector_size(sizeof(int)*4)));

    int main() {
        const v4sf v = { 1.2f ,2.2f ,3.3f, 4.4f };
        const v4i vRes = (v4i) v;
    }

The resulting integer vector vRes would simply contain crap.
Is this a bug, not implemented yet or even intentional?

CU
Christian

[1] http://sourceforge.net/mailarchive/forum.php?thread_id=10191980&forum_id=12792

[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