aarch64: Make sure the UF divides the VF [PR105254]
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 13 Apr 2022 16:53:54 +0000 (17:53 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 13 Apr 2022 16:53:54 +0000 (17:53 +0100)
commitf2ebf2d98efe0ac2314b58cf474f44cb8ebd5244
tree37e0335a1ea363dc56bc8704c96f502ec5ba4889
parent469fad0161afeb9369010ad498198297993ca592
aarch64: Make sure the UF divides the VF [PR105254]

In this PR, we were trying to set the unroll factor to a value higher
than the minimum VF (or more specifically, to a value that doesn't
divide the VF).  I guess there are two approaches to this: let the
target pick any value it likes and make target-independent code pare
it back to something that makes sense, or require targets to supply
sensible values from the outset.  This patch goes for the latter
approach.

gcc/
PR tree-optimization/105254
* config/aarch64/aarch64.cc
(aarch64_vector_costs::determine_suggested_unroll_factor): Take a
loop_vec_info as argument.  Restrict the unroll factor to values
that divide the VF.
(aarch64_vector_costs::finish_cost): Update call accordingly.

gcc/testsuite/
PR tree-optimization/105254
* g++.dg/vect/pr105254.cc: New test.
gcc/config/aarch64/aarch64.cc
gcc/testsuite/g++.dg/vect/pr105254.cc [new file with mode: 0644]