tree-optimization/95839 - teach SLP vectorization about vector inputs
authorRichard Biener <rguenther@suse.de>
Fri, 26 Jun 2020 09:18:19 +0000 (11:18 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 1 Jul 2020 11:32:27 +0000 (13:32 +0200)
commit7b3adfa7bb47e4ebde91634caa5a7e13175558f1
tree70cc56f23e32eab5cefbb65a7600b2a43e6c026b
parentdeda4625f1befb55a52409de2c7eda325b58e195
tree-optimization/95839 - teach SLP vectorization about vector inputs

This teaches SLP analysis about vector typed externals that are
fed into the SLP operations via lane extracting BIT_FIELD_REFs.
It shows that there's currently no good representation for
vector code on the SLP side so I went a half way and represent
such vector externals uses always using a SLP permutation node
with a single external SLP child which has a non-standard
representation of no scalar defs but only a vector def.  That
works best for shielding the rest of the vectorizer from it.

2020-06-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95839
* tree-vect-slp.c (vect_slp_tree_uniform_p): Pre-existing
vectors are not uniform.
(vect_build_slp_tree_1): Handle BIT_FIELD_REFs of
vector registers.
(vect_build_slp_tree_2): For groups of lane extracts
from a vector register generate a permute node
with a special child representing the pre-existing vector.
(vect_prologue_cost_for_slp): Pre-existing vectors cost nothing.
(vect_slp_analyze_node_operations): Use SLP_TREE_LANES.
(vectorizable_slp_permutation): Do not generate or cost identity
permutes.
(vect_schedule_slp_instance): Handle pre-existing vector
that are function arguments.

* gcc.dg/vect/bb-slp-pr95839-2.c: New testcase.
gcc/testsuite/gcc.dg/vect/bb-slp-pr95839-2.c [new file with mode: 0644]
gcc/tree-vect-slp.c