Richard Biener <richard.guent...@gmail.com> writes: > On Fri, Jun 6, 2025 at 1:26 PM Robin Dapp <rdapp....@gmail.com> wrote: >> >> > In case the riscv strided vector load instruction has additional >> > requirements >> > on the loaded (scalar) element alignment then we'd have to implement this. >> > For the moment the vectorizer will really emit scalar loads here, so that's >> > fine (though eventually inefficient). For the strided vector load there >> > should >> > be an alignment argument specifying element alignment, like we have for >> > .MASK_LOAD, etc. >> >> Our strided loads are similar to other vector insns in that they need to be >> element aligned for certain microarchitectures. I guess then we indeed need >> to >> adjust the IFN. > > Yes. Note I don't see we guarantee element alignment for gather/scatter > either, nor do the IFNs seem to have encoding space for alignment. The > effective type for TBAA seems also missing there ... > >> Regarding vector_vector_composition_type I had a try and attached a >> preliminary >> V3. I'm not really happy with it (and I suppose you won't be either) because >> it's now essentially two closely related functions in one with different >> argument requirements (I needed four additional ones). > > Indeed :/ > > I'm not sure whether handling this case as part of VMAT_STRIDED_SLP is > wise. IIRC we do already choose VMAT_GATHER_SCATTER for some > strided loads, so why not do strided load/store handling as part of > gather/scatter handling? > > Sorry to send you from A to B here ... > > I think the spotted correctness issues wrt alignment/aliasing should be > addressed up-front. In the end the gather/stride-load is probably an > UNSPEC, so there's no MEM RTX with wrong info?
At least on aarch64, the gathers and scatters use (mem:BLK (scratch:P)), i.e. a wildcard memory access. There's no good way in RTL to represent multiplie distinct locations in a single reference. (unspec on its own doesn't imply a memory access) > How would we query the target on whether it can handle the alignment > here? I think for gathers, STRICT_ALIGNMENT rules apply: if STRICT_ALIGNMENT is true then each scalar element must be aligned to its size, otherwise the elements can be misaligned. Thanks, Richard