[PATCH rs6000] (small C++ patch) Add intrinsics for the new vec_* specified by the C/C++ Language Extension for the CBEA

Andrew Pinski Andrew_Pinski@playstation.sony.com
Wed Oct 1 02:01:00 GMT 2008


Hi,
  This adds the four new intrinsics that are specified by the C/C++
Language Extension for the CBEA; vec_extract, vec_insert, vec_promote,
and vec_splats.  These intrinsics do not correspond to any one
instruction but they are useful for extracting and inserting into a
vector.  They were designed to correspond to the SPU intrinsics that
are name similar.

I implemented so they get translated early on to trees so the tree
level optimizers can maybe do some optimizations on them.  Currently
the tree level optimizers don't do much but later on they could, I
have some ideas of implementing some optimizations for vectors.

I had to add some small support for C++ to support
COMPOUND_LITERAL_EXPR to say it is a lvalue.

OK? Bootstraped and tested on powerpc64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
Handle ALTIVEC_BUILTIN_VEC_SPLATS, ALTIVEC_BUILTIN_VEC_PROMOTE,
ALTIVEC_BUILTIN_VEC_EXTRACT, and ALTIVEC_BUILTIN_VEC_INSERT specially,
they translate to non builtins.
* config/rs6000/rs6000.c (altivec_init_builtins): Add new variable
opaque_ftype_opaque.  Define builtins __builtin_vec_splats,
__builtin_vec_promote, __builtin_vec_extract, and
__builtin_vec_insert.
* config/rs6000/rs6000.h (enum rs6000_builtins): Add
ALTIVEC_BUILTIN_VEC_EXTRACT, ALTIVEC_BUILTIN_VEC_PROMOTE,
ALTIVEC_BUILTIN_VEC_INSERT, and ALTIVEC_BUILTIN_VEC_SPLATS.
* config/rs6000/altivec.h (vec_extract): Define
(vec_insert): Define.
(vec_splats): Define.
(vec_promote): Define.

cp/ChangeLog:
* tree.c (lvalue_p_1): COMPOUND_LITERAL_EXPR is also an lvalue.

testsuite/ChangeLog:
* gcc.target/powerpc/altivec-cell-1.c: New test.
* gcc.target/powerpc/altivec-cell-2.c: New test.
* gcc.target/powerpc/altivec-cell-3.c: New test.
* gcc.target/powerpc/altivec-cell-4.c: New test.
* g++.dg/ext/altivec-cell-1.C: New test.
* g++.dg/ext/altivec-cell-2.C: New test.
* g++.dg/ext/altivec-cell-3.C: New test.
* g++.dg/ext/altivec-cell-4.C: New test.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: addvec.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081001/e9b8a616/attachment.txt>


More information about the Gcc-patches mailing list