https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118405

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So what's odd is that vect_supportable_dr_alignment says misaligned
vector(1) double loads are not supported.

We are generally expecting targets to support this - IIRC we don't
fall back to load vector(1) T as T during RTL expansion (the vector
and scalar register sets might not overlap).

So - riscv doesn't have movmisalign for vector(1) double it seems, or
wrongly(?) gates it with non-support?

There's an issue with vect_compute_data_ref_alignment because we run into

  if (drb->offset_alignment < vect_align_c
      || !step_preserves_misalignment_p
      /* We need to know whether the step wrt the vectorized loop is
         negative when computing the starting misalignment below.  */
      || TREE_CODE (drb->step) != INTEGER_CST)
    {
      if (dump_enabled_p ())
        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                         "Unknown alignment for access: %T\n", ref);
      return;

as the step is variable ((ssizetype) (s_19(D) * 80)).  We could
possibly special-case some cases in vect_dr_misalign_for_aligned_access
here.

That said, the idea is to only emit supported vector loads, and vector(1)
double
doesn't seem to be supported.

So IMO the fix would be to instead view-convert the scalar load.  The
existing exception for VMAT_ELEMENTWISE was to fix PR85793, a similar
ICE.

Reply via email to