aarch64: Use real scalar op counts
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 12 Nov 2021 17:33:01 +0000 (17:33 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Fri, 12 Nov 2021 17:33:01 +0000 (17:33 +0000)
commit6756706ea636d6f9aab85cef22659cc35143476f
treea77dfd353b0ade909d2be0f62e845af95b9f2591
parent902b7c9e1835bc11a6127f9bd0c18928bfdbf18d
aarch64: Use real scalar op counts

Now that vector finish_costs is passed the associated scalar costs,
we can record the scalar issue information while computing the scalar
costs, rather than trying to estimate it while computing the vector
costs.

This simplifies things a little, but the main motivation is to improve
accuracy.

gcc/
* config/aarch64/aarch64.c (aarch64_vector_costs::m_scalar_ops)
(aarch64_vector_costs::m_sve_ops): Replace with...
(aarch64_vector_costs::m_ops): ...this.
(aarch64_vector_costs::analyze_loop_vinfo): Update accordingly.
(aarch64_vector_costs::adjust_body_cost_sve): Likewise.
(aarch64_vector_costs::aarch64_vector_costs): Likewise.
Initialize m_vec_flags here rather than in add_stmt_cost.
(aarch64_vector_costs::count_ops): Test for scalar reductions too.
Allow vectype to be null.
(aarch64_vector_costs::add_stmt_cost): Call count_ops for scalar
code too.  Don't require vectype to be nonnull.
(aarch64_vector_costs::adjust_body_cost): Take the loop_vec_info
and scalar costs as parameters.  Use the scalar costs to determine
the cycles per iteration of the scalar loop, then multiply it
by the estimated VF.
(aarch64_vector_costs::finish_cost): Update call accordingly.
gcc/config/aarch64/aarch64.c