I find it instructive that 4 of the 5 isas that actually implement widening integer multiplication do have mult-widen-even as the isa primitive (even if the -odd variant is missing). The fact that this operation is implemented as a set of builtins and target hooks has lead to disturbingly cookie-cutter implementations of these hooks in the various backends.
Thus I choose to add VEC_WIDEN_MULT_EVEN/ODD_EXPR as tree codes and optabs. This removes a farily trivial amount of code from three backends (the fourth backend, ia64, never grew this support). The existance of optabs then allows the expansion of MULT_HIGHPART_EXPR at the rtl-expansion level without having to resort to builtin expansion in order to emit the even/odd alternative. This saves a fairly substantial amount of code from the vectorizer. I've not touched the interface to supportable_widening_operation, which is still prepared to return a CALL_EXPR and some decls. After this patch set it will never do so. I'm undecided as to whether we ought to be prepared for such in the future, or whether this should simply go in as a completely separate patch that could in the future be easily reverted. Tested on x86_64; cross-compiled to ppc64 and spu, spot checking the relevant division-by-constant testcases. r~ Richard Henderson (7): Add VEC_WIDEN_MULT_EVEN/ODD_EXPR i386: Rename patterns for vec_widen_<s>mult_even/odd_<mode> rs6000: Rename patterns for vec_widen_<s>mult_even/odd_<mode> spu: Rename patterns for vec_widen_<s>mult_even/odd_<mode> Move vector highpart emulation to the optabs layer Use VEC_WIDEN_MULT_EVEN/ODD_EXPR in supportable_widening_operation Zap now unused builtin_mul_widen_even/odd target hooks gcc/ChangeLog | 89 ++++++++++++ gcc/cfgexpand.c | 4 +- gcc/config/i386/i386.c | 103 ++----------- gcc/config/i386/sse.md | 18 +-- gcc/config/rs6000/altivec.md | 54 +++---- gcc/config/rs6000/rs6000-builtin.def | 24 +-- gcc/config/rs6000/rs6000.c | 51 ------- gcc/config/spu/spu-builtins.def | 24 +-- gcc/config/spu/spu-builtins.md | 65 --------- gcc/config/spu/spu.c | 42 ------ gcc/config/spu/spu.md | 86 +++++++++-- gcc/doc/md.texi | 12 +- gcc/doc/tm.texi | 22 --- gcc/doc/tm.texi.in | 22 --- gcc/expmed.c | 32 ++-- gcc/expr.c | 35 ++--- gcc/fold-const.c | 36 +++-- gcc/genopinit.c | 4 + gcc/gimple-pretty-print.c | 2 + gcc/optabs.c | 134 +++++++++++++++++ gcc/optabs.h | 18 ++- gcc/system.h | 4 +- gcc/target.def | 14 -- gcc/tree-cfg.c | 2 + gcc/tree-inline.c | 2 + gcc/tree-pretty-print.c | 32 ++-- gcc/tree-vect-generic.c | 145 +++++------------- gcc/tree-vect-patterns.c | 23 +-- gcc/tree-vect-stmts.c | 267 +++++++++------------------------- gcc/tree.c | 2 + gcc/tree.def | 4 + 31 files changed, 580 insertions(+), 792 deletions(-) -- 1.7.10.4