[2/3] [vect] Add widening add, subtract patterns
authorJoel Hutton <joel.hutton@arm.com>
Thu, 19 Nov 2020 10:39:38 +0000 (10:39 +0000)
committerJoel Hutton <joel.hutton@arm.com>
Thu, 19 Nov 2020 11:49:59 +0000 (11:49 +0000)
commit9fc9573f9a5e9432e53c7de93985cfbd267f0309
tree036540bd548fffd4f3330fdd8e35940b1acda558
parentec46904edfec162f32b8b411301374afc8f5fcb5
[2/3] [vect] Add widening add, subtract patterns

Add widening add, subtract patterns to tree-vect-patterns. Update the
widened code of patterns that detect PLUS_EXPR to also detect
WIDEN_PLUS_EXPR. These patterns take 2 vectors with N elements of size
S and perform an add/subtract on the elements, storing the results as N
elements of size 2*S (in 2 result vectors). This is implemented in the
aarch64 backend as addl,addl2 and subl,subl2 respectively. Add aarch64
tests for patterns.

gcc/ChangeLog:
* doc/generic.texi: Document new widen_plus/minus_lo/hi tree codes.
* doc/md.texi: Document new widenening add/subtract hi/lo optabs.
* expr.c (expand_expr_real_2): Add widen_add, widen_subtract cases.
* optabs-tree.c (optab_for_tree_code): Add case for widening optabs.
* optabs.def (OPTAB_D): Define vectorized widen add, subtracts.
* tree-cfg.c (verify_gimple_assign_binary): Add case for widening adds,
subtracts.
* tree-inline.c (estimate_operator_cost): Add case for widening adds,
subtracts.
* tree-vect-generic.c (expand_vector_operations_1): Add case for
widening adds, subtracts
* tree-vect-patterns.c (vect_recog_widen_add_pattern): New recog
pattern.
(vect_recog_widen_sub_pattern): New recog pattern.
(vect_recog_average_pattern): Update widened add code.
(vect_recog_average_pattern): Update widened add code.
* tree-vect-stmts.c (vectorizable_conversion): Add case for widened add,
subtract.
(supportable_widening_operation): Add case for widened add, subtract.
* tree.def
(WIDEN_PLUS_EXPR): New tree code.
(WIDEN_MINUS_EXPR): New tree code.
(VEC_WIDEN_ADD_HI_EXPR): New tree code.
(VEC_WIDEN_PLUS_LO_EXPR): New tree code.
(VEC_WIDEN_MINUS_HI_EXPR): New tree code.
(VEC_WIDEN_MINUS_LO_EXPR): New tree code.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/vect-widen-add.c: New test.
* gcc.target/aarch64/vect-widen-sub.c: New test.
13 files changed:
gcc/doc/generic.texi
gcc/doc/md.texi
gcc/expr.c
gcc/optabs-tree.c
gcc/optabs.def
gcc/testsuite/gcc.target/aarch64/vect-widen-add.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/vect-widen-sub.c [new file with mode: 0644]
gcc/tree-cfg.c
gcc/tree-inline.c
gcc/tree-vect-generic.c
gcc/tree-vect-patterns.c
gcc/tree-vect-stmts.c
gcc/tree.def