unsigned int adjust_body_cost (loop_vec_info, const aarch64_vector_costs *,
unsigned int);
bool prefer_unrolled_loop () const;
- unsigned int determine_suggested_unroll_factor ();
+ unsigned int determine_suggested_unroll_factor (loop_vec_info);
/* True if we have performed one-time initialization based on the
vec_info. */
}
unsigned int
-aarch64_vector_costs::determine_suggested_unroll_factor ()
+aarch64_vector_costs::
+determine_suggested_unroll_factor (loop_vec_info loop_vinfo)
{
bool sve = m_vec_flags & VEC_ANY_SVE;
/* If we are trying to unroll an Advanced SIMD main loop that contains
return 1;
unsigned int max_unroll_factor = 1;
+ auto vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
for (auto vec_ops : m_ops)
{
aarch64_simd_vec_issue_info const *vec_issue
return 1;
/* Limit unroll factor to a value adjustable by the user, the default
value is 4. */
- unsigned int unroll_factor = aarch64_vect_unroll_limit;
+ unsigned int unroll_factor = MIN (aarch64_vect_unroll_limit,
+ (int) known_alignment (vf));
unsigned int factor
= vec_ops.reduction_latency > 1 ? vec_ops.reduction_latency : 1;
unsigned int temp;
{
m_costs[vect_body] = adjust_body_cost (loop_vinfo, scalar_costs,
m_costs[vect_body]);
- m_suggested_unroll_factor = determine_suggested_unroll_factor ();
+ m_suggested_unroll_factor
+ = determine_suggested_unroll_factor (loop_vinfo);
}
/* Apply the heuristic described above m_stp_sequence_cost. Prefer
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-fvect-cost-model=dynamic -mcpu=zeus" { target aarch64*-*-* } } */
+
+template <typename>
+struct complex;
+
+template <>
+struct complex<double> {
+ void operator+= (complex r) { v_ += r.v_; }
+ _Complex v_;
+};
+
+template <typename T>
+void
+bar (T);
+
+void
+foo (complex<double> *x)
+{
+ complex<double> s = {0.0};
+
+ for (int i = 0; i < 16; ++i)
+ s += x[i];
+
+ bar<complex<double> > (s);
+}