On Wed, 28 Jan 2026, Andre Vieira wrote:

> This reconstructs the masks vectype based on the the type set by the backend
> for any non scalar masks, which resolves the ICE caused by the sve type
> attribute in SVE types used for simdclones.
> 
> gcc/ChangeLog:
> 
>       * tree-vect-stmts.cc (vectorizable_simd_clone_call): use
>       'build_truth_vector_type_for_mode' to reconstruct mask's vectype for
>       non-scalar masks.
> 
> gcc/testsuite/ChangeLog:
> 
>       * gfortran.dg/vect/pr123016.f90: New test.
> 
> Ok for trunk?

OK.

Please mention the PR in the changelog so it gets picked up by
bugzilla.

Richard.

> 
> On 22/01/2026 15:27, Andre Vieira wrote:
> >
> > On 22/01/2026 09:36, Richard Biener wrote:
> >> On Wed, Jan 21, 2026 at 5:29 PM Andre Vieira
> >> <[email protected]> wrote:
> >>> Hi,
> >>>
> >>> This uses 'get_related_vectype_for_scalar_type' to construct a standard
> >>> vectype
> >>> for any non scalar masks, which resolves the ICE caused by the sve type
> >>> attribute in SVE types used for simdclones.
> >>>
> >>> Tested on aarch64-none-linux-gnu. OK for trunk?
> >> So we're essentially re-building the simdclone masktype to avoid the ICE. 
> >> And
> >> we want exactly the same vector type.  IMO
> >>
> >>    masktype = build_truth_vector_type_for_mode (TYPE_VECTOR_SUBPARTS
> >> (masktype), TYPE_MODE (masktype));
> >>
> >> would achieve this in a more obvious way?
> >>
> > Actually that does preserve the vector mode whereas related does not,
> > related used to generate VNx4QI for the testcase, whereas the original mode
> > was VNx4BI. So your approach is probably better, I don't think it matters
> > much in the end because both get dealt with the same by VEC_COND_EXPR which
> > is how it 'converts' the loop mask into the parameter and it all ends up as
> > NOPs in the examples I looked at, but yeah... I'll just go run all the tests
> > with this one and see if anything falls out, but I suspect it'll be fine
> > too.
> >
> > Thx!
> >>
> >>> PR target/123016
> >>> gcc/ChangeLog:
> >>>
> >>>          * tree-vect-stmts.cc (vectorizable_simd_clone_call): use
> >>>          get_related_vectype_for_scalar_type to reconstruct standard
> >>> vectype for
> >>>          non-scalar masks.
> >>>
> >>> gcc/testsuite/ChangeLog:
> >>>
> >>>           * gfortran.dg/vect/pr123016.f90: New test.
> >>>
> 

-- 
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to