[PATCH v2 1/2] vect: Account for peeling by masking in strided gather offsets
Dominic P
gcc@gcc.dp11.uk
Sat Oct 10 09:27:39 GMT 2026
Thanks Richard. I may have misunderstood, but I don't think the lanes
skipped by masked peeling are bounded by max_iters: the skip is
VF - npeel (or the runtime misalignment), so a small peel count gives a
large skip even for a short loop. When I tried the check, this went
wrong at -O3 -fno-vect-cost-model -msve-vector-bits=256:
int x[8] __attribute__ ((aligned (64)));
void
foo (int *restrict b, unsigned int n)
{
for (unsigned int i = 5; i < n; ++i)
x[i] = b[i * 650000000L];
}
max_iters is 2 and npeel is 3, so 5 lanes are skipped and i = 7 is in
lane 7, but count = 4 gave 32-bit offsets and x[7] came out wrong under
qemu (similarly at -msve-vector-bits=512). The largest lane index seems
to be min (VF - 1, max_iters + VF - npeel), so I couldn't find a useful
bound when the misalignment is unknown, and I'd leave the code as it is.
Thanks,
Dominic
More information about the Gcc-patches
mailing list