From: Richard Henderson <r...@redhat.com> These patches allow __builtin_shuffle to handle any vector permutation via optabs. It allows for a not-uncommon fallback to byte permutation at rtl expansion time, while leaving the tree/gimple-level permutation as element-based.
All three targets which heretofore supported vector permutation in any way have been updated to support the new optabs. The next step is to convert the vectorizer to use the VEC_PERM_EXPR code rather than using the hook that returns builtins. Once that is done, it would be possible for the targets to delete the builtins. Supposing that they're not exposed for user-level consumption (which is the case for i386; the user-level interface is via inlines in a header file, which can be updated to use __builtin_shuffle). Tested on x86_64-linux, --with-cpu=corei7. Tested on ppc64-linux, --with-cpu=G5. Committed. r~ Richard Henderson (6): rs6000: Implement vec_permv16qi. spu: Implement vec_permv16qi. i386: Implement vec_perm_const<mode>. Move lowering of vector shifts from v/s to v/v to rtl. rs6000: Fix typo in rs6000_expand_vector_init Expand vector permutation with vec_perm and vec_perm_const. gcc/config/i386/i386-protos.h | 1 + gcc/config/i386/i386.c | 61 +++++++ gcc/config/i386/sse.md | 21 +++ gcc/config/rs6000/altivec.md | 9 + gcc/config/rs6000/rs6000.c | 2 +- gcc/config/spu/spu.md | 12 ++ gcc/doc/md.texi | 6 + gcc/genopinit.c | 1 + gcc/optabs.c | 281 ++++++++++++++++++++++++----- gcc/optabs.h | 12 +- gcc/testsuite/gcc.dg/vect/vec-scal-opt.c | 2 +- gcc/testsuite/gcc.dg/vect/vec-scal-opt1.c | 2 +- gcc/testsuite/gcc.dg/vect/vec-scal-opt2.c | 2 +- gcc/testsuite/lib/target-supports.exp | 21 --- gcc/tree-vect-generic.c | 68 +++----- 15 files changed, 374 insertions(+), 127 deletions(-) -- 1.7.6.4