On Tue, Sep 2, 2025 at 2:31 PM Robin Dapp <[email protected]> wrote:
>
> >> So even though our strided loads do support signed strides, we cannot go
> >> via
> >> the
> >> recognize gather
> >> -> recognize strided offset
> >> -> strided load
> >> route because the initial signed-offset gather will be unsupported :/
> >
> > I did want to relax the initial STMT_VINFO_GATHER_SCATTER_P detection
> > to not require any target support (there's emulated gather after all!).
> > But the
> > above isn't a gather, it's a strided (group) load anyway.
>
> Yes, and I thought we wanted to recognize these as gather with index {0, 1, 2,
> 3, stride + 0, stride + 1, stride + 2, stride + 3, ...}? Then change the
> element size to 32 so the index becomes {0, stride, stride * 2, ...}, which,
> eventually, would be emitted as strided load if supported.
Yes, that was the idea. Though I'd never actually use that {0, 1, 2,
3, stride + ... }
thing but only ever the enlarged element size.
> >> The other option would be to have an alternative to the gather -> strided
> >> connection and additionally check for strided_load support directly?
> >> Currently
> >> I see no way around this given the restrictions imposed by our insns.
> >
> > I think that rather than going via vect_check_gather_scatter in
> > vect_use_strided_gather_scatters_p we should directly query gather optab
> > support with the appropriate offset. Don't you have gather optabs like
> > gatherV4SISI for SImode scalar strides already?
>
> Our gather optabs currently just have vector modes for the index. The
> mask_len_strided_load<mode> optab just has the data mode and supports Pmode
> strides.
> The gather docs also specify the index operand as a vector. Do we want to
> relax this and allow a scalar as well? That way we could at least query a
> unified optab in the above case, rather than querying both gather_load and
> mask_len_strided_load.
I think it's fine to query both gather_load and mask_len_strided_load. But
unifying the optabs, allowing scalar mode gather offset works for me as well.
Richard.
>
> --
> Regards
> Robin
>