aarch64: Don't include vec_select high-half in SIMD multiply cost
authorJonathan Wright <jonathan.wright@arm.com>
Mon, 19 Jul 2021 09:19:30 +0000 (10:19 +0100)
committerJonathan Wright <jonathan.wright@arm.com>
Wed, 4 Aug 2021 15:58:26 +0000 (16:58 +0100)
commit63834c84d43fc2eeeaa054c5e24d1e468e9eddab
treeea722026fde334209daef1e4740b81cfb4b17ebd
parent1d65c9d25199264bc8909018df1b0dca71c0b32d
aarch64: Don't include vec_select high-half in SIMD multiply cost

The Neon multiply/multiply-accumulate/multiply-subtract instructions
can select the top or bottom half of the operand registers. This
selection does not change the cost of the underlying instruction and
this should be reflected by the RTL cost function.

This patch adds RTL tree traversal in the Neon multiply cost function
to match vec_select high-half of its operands. This traversal
prevents the cost of the vec_select from being added into the cost of
the multiply - meaning that these instructions can now be emitted in
the combine pass as they are no longer deemed prohibitively
expensive.

gcc/ChangeLog:

2021-07-19  Jonathan Wright  <jonathan.wright@arm.com>

* config/aarch64/aarch64.c (aarch64_strip_extend_vec_half):
Define.
(aarch64_rtx_mult_cost): Traverse RTL tree to prevent cost of
vec_select high-half from being added into Neon multiply
cost.
* rtlanal.c (vec_series_highpart_p): Define.
* rtlanal.h (vec_series_highpart_p): Declare.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/vmul_high_cost.c: New test.
gcc/config/aarch64/aarch64.c
gcc/rtlanal.c
gcc/rtlanal.h
gcc/testsuite/gcc.target/aarch64/vmul_high_cost.c [new file with mode: 0644]