On Tue, Aug 09, 2022 at 02:23:48PM +0100, Andrew Stubbs wrote:
> 
> The vecsize_int/vecsize_float has an assumption that all arguments will use
> the same bitsize, and vary the number of lanes according to the element size,
> but this is inappropriate on targets where the number of lanes is fixed and
> the bitsize varies (i.e. amdgcn).
> 
> With this change the vecsize can be left zero and the vectorization factor 
> will
> be the same for all types.
> 
> gcc/ChangeLog:
> 
>       * doc/tm.texi: Regenerate.
>       * omp-simd-clone.cc (simd_clone_adjust_return_type): Allow zero
>       vecsize.
>       (simd_clone_adjust_argument_types): Likewise.
>       * target.def (compute_vecsize_and_simdlen): Document the new
>       vecsize_int and vecsize_float semantics.

LGTM, except for a formatting nit.

> @@ -618,8 +621,12 @@ simd_clone_adjust_argument_types (struct cgraph_node 
> *node)
>           veclen = sc->vecsize_int;
>         else
>           veclen = sc->vecsize_float;
> -       veclen = exact_div (veclen,
> -                           GET_MODE_BITSIZE (SCALAR_TYPE_MODE (parm_type)));
> +       if (known_eq (veclen, 0))
> +         veclen = sc->simdlen;
> +       else
> +         veclen = exact_div (veclen,
> +                             GET_MODE_BITSIZE
> +                             (SCALAR_TYPE_MODE (parm_type)));

Macro name on one line and ( on another is too ugly, can you please use:
            veclen
              = exact_div (veclen,
                           GET_MODE_BITSIZE (SCALAR_TYPE_MODE (parm_type)));
or:
            {
              scalar_mode m = SCALAR_TYPE_MODE (parm_type);
              veclen = exact_div (veclen, GET_MODE_BITSIZE (m));
            }
?

        Jakub

Reply via email to