[PATCH][vectorizer][2/2] Hook up mult synthesis logic into vectorisation of mult-by-constant

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Wed Jun 15 13:24:00 GMT 2016


Hi all,

This is a respin of https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00952.html following feedback.
I've changed the code to cast the operand to an unsigned type before applying the multiplication algorithm
and cast it back to the signed type at the end.
Whether to perform the cast is now determined by the function cast_mult_synth_to_unsigned in which I've implemented
the cases that Marc mentioned in [1]. Please do let me know
if there are any other cases that need to be handled.

I've added a couple of TODO notes in the places that need to be extended to handle shifts as a series of additions
for targets that support vector addition but not vector shifts [2].

tree-vect-patterns.c already includes expmed.h (must have been added in the time since I first wrote the patch
last November...) so it picks up the definition of choose_mult_variant moved there in patch 1/2.

Bootstrapped and tested on aarch64, arm, x86_64.
Does this look better?

Thanks,
Kyrill

[1] https://gcc.gnu.org/ml/gcc-patches/2016-06/msg01023.html
[2] https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00967.html

2016-06-15  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     PR target/65951
     * tree-vect-patterns.c: Include mult-synthesis.h
     (target_supports_mult_synth_alg): New function.
     (apply_binop_and_append_stmt): Likewise.
     (vect_synth_mult_by_constant): Likewise.
     (target_has_vecop_for_code): Likewise.
     (cast_mult_synth_to_unsigned): Likewise.
     (vect_recog_mult_pattern): Use above functions to synthesize vector
     multiplication by integer constants.

2016-06-15  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.dg/vect/vect-mult-const-pattern-1.c: New test.
     * gcc.dg/vect/vect-mult-const-pattern-2.c: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vect-2.patch
Type: text/x-patch
Size: 15165 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160615/31775be7/attachment.bin>


More information about the Gcc-patches mailing list