Hi Bohan,

> When the iteration count is unknown, actually compare the costs of
> different VLA modes instead of blindly choosing the bigger LMUL as long
> as there's no unexpected spill.  This can prevent some cases when
> -mrvv-max-lmul=dynamic emits worse code than -mrvv-max-lmul=m8, and

Could you give an example for this?

> -       else
> -         {
> -           if (dump_enabled_p ())
> -             dump_printf_loc (MSG_NOTE, vect_location,
> -                              "Keep current LMUL loop because"
> -                              " it is unknown NITERS\n");
> -           return false;
> -         }

I think this is OK (and I guess this should have been similar to the 
check below in the first place).

>       }
>      }
>    /* If NITERS is unknown, we should not use VLS modes to vectorize
> @@ -1277,8 +1269,8 @@ costs::better_main_loop_than_p (const vector_costs 
> *uncast_other) const
>       and partial vectors (VLAmodes) on loop epilogue which is very
>       inefficient.  Instead, we should apply partial vectors (VLAmodes)
>       on loop body without an epilogue on unknown NITERS loop.  */
> -  else if (!LOOP_VINFO_NITERS_KNOWN_P (this_loop_vinfo)
> -        && m_cost_type == VLS_VECTOR_COST)
> +  if (!LOOP_VINFO_NITERS_KNOWN_P (this_loop_vinfo)
> +      && m_cost_type == VLS_VECTOR_COST)
>      return false;

This is partially ok but should additionally use 
!LOOP_VINFO_USING_PARTIAL_VECTORS_P.  We do support VLS partial 
vectorization.

> +/* { dg-final { scan-assembler {e8,m1} } } */
> +/* { dg-final { scan-assembler-times {csrr} 0 } } */

scan-assembler-not

-- 
Regards
 Robin

Reply via email to