On Thu, Sep 18, 2014 at 2:19 PM, Alan Lawrence <alan.lawre...@arm.com> wrote: > For reduction operations (e.g. multiply) that don't have such a tree code > ,or where the target platform doesn't define an optab handler for the tree > code, we can perform the reduction using a series of log(N) shifts (where N > = #elements in vector), using the VEC_RSHIFT_EXPR=whole-vector-shift tree > code (if the platform handles the vec_shr_optab). > > First stage is to add some tests of non-(min/max/plus) reductions; here, > multiplies. The first is designed to be non-foldable, so we make sure the > architectural instructions line up with what the tree codes specify. The > second is designed to be easily constant-propagated, to test the (currently > endianness-dependent) constant folding code. > > In lib/target-supports.exp, I've defined a new > check_effective_target_whole_vector_shift, which I intended to define to > true for platforms with the vec_shr optab. However, I've not managed to make > this test pass on PowerPC - even with -maltivec, -fdump-tree-vect-details > gives me a message about the target not supporting vector multiplication - > so I've omitted PowerPC from the whole_vector_shift. This doesn't feel > right, suggestions welcomed from PowerPC maintainers? > > Tests passing on arm-none-eabi and x86_64-none-linux-gnu; > also verified the scan-tree-dump part works on ia64-none-linux-gnu (by > compiling to assembly only). > (Tests are not run on AArch64, because we have no vec_shr_optab at this > point; PowerPC, as above; or MIPS, as check_effective_target_vect_int_mult > yields 0.)
Ok. Thanks, Richard. > gcc/testsuite/ChangeLog: > > * lib/target-supports.exp > (check_effective_target_whole_vector_shift): > New. > > * gcc.dg/vect/vect-reduc-mul_1.c: New test. > * gcc.dg/vect/vect-reduc-mul_2.c: New test.