Re: [PATCH] vect: Misalign checks for gather/scatter.

2025-06-27 Thread Richard Biener
On Fri, 27 Jun 2025, Robin Dapp wrote: > > Maybe we can pass a scalar mode to the hook when we ask for > > SCATTER/GATHER? That might need fixups in other targets of course, > > but it would make it clear what we're asking for? > > How about an additional argument bool gather_scatter to make it

Re: [PATCH] vect: Misalign checks for gather/scatter.

2025-06-27 Thread Robin Dapp
Maybe we can pass a scalar mode to the hook when we ask for SCATTER/GATHER? That might need fixups in other targets of course, but it would make it clear what we're asking for? How about an additional argument bool gather_scatter to make it more explicit? Then we could just if (gather_scatt

Re: [PATCH] vect: Misalign checks for gather/scatter.

2025-06-27 Thread Richard Biener
On Thu, 26 Jun 2025, Robin Dapp wrote: > > + bool is_misaligned = scalar_align < inner_vectype_sz; > > + bool is_packed = scalar_align > 1 && is_misaligned; > > + > > + *misalignment = !is_misaligned ? 0 : inner_vectype_sz - scalar_align; > > + > > + if (targetm.vectorize.suppo

Re: [PATCH] vect: Misalign checks for gather/scatter.

2025-06-26 Thread Robin Dapp
+ bool is_misaligned = scalar_align < inner_vectype_sz; + bool is_packed = scalar_align > 1 && is_misaligned; + + *misalignment = !is_misaligned ? 0 : inner_vectype_sz - scalar_align; + + if (targetm.vectorize.support_vector_misalignment + (TYPE_MODE (vectype), inner_

Re: [PATCH] vect: Misalign checks for gather/scatter.

2025-06-25 Thread Richard Biener
On Wed, 25 Jun 2025, Richard Biener wrote: > On Wed, 25 Jun 2025, Robin Dapp wrote: > > > Hi, > > > > this patch adds simple misalignment checks for gather/scatter > > operations. Previously, we assumed that those perform element accesses > > internally so alignment does not matter. The riscv

Re: [PATCH] vect: Misalign checks for gather/scatter.

2025-06-25 Thread Robin Dapp
This change reminds me that we lack documentation about arguments of most of the "complicated" internal functions ... I didn't mention it but I got implicitly reminded several times while writing the patch... ;) An overhaul has been on my todo list for a while but of course it never was top pr

Re: [PATCH] vect: Misalign checks for gather/scatter.

2025-06-25 Thread Richard Biener
On Wed, 25 Jun 2025, Robin Dapp wrote: > Hi, > > this patch adds simple misalignment checks for gather/scatter > operations. Previously, we assumed that those perform element accesses > internally so alignment does not matter. The riscv vector spec however > explicitly states that vector operat

[PATCH] vect: Misalign checks for gather/scatter.

2025-06-25 Thread Robin Dapp
Hi, this patch adds simple misalignment checks for gather/scatter operations. Previously, we assumed that those perform element accesses internally so alignment does not matter. The riscv vector spec however explicitly states that vector operations are allowed to fault on element-misaligned acc