https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113441
--- Comment #32 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Sandiford from comment #31) > (In reply to Tamar Christina from comment #29) > > This works fine for normal gather and scatters but doesn't work for widening > > gathers and narrowing scatters which only the pattern seems to handle. > I'm supposedly on holiday, so didn't see the IRC discussion, but: as I > remember it, there is no narrowing or widening for IFN gathers or scatters > as such, even for patterns. One vector's worth of offsets corresponds to > one vector's worth of data. But the widths of the data elements and the > offset elements can be different. Any sign or zero extension of a loaded > vector, or any operation to double or halve the number of vectors, is done > separately. Yep. The emulated gather/scatter and builtin paths do this widening/shortening of the offset operand to what we expect on-the-fly. This support is missing from the IFN path which relies on patterns doing this. Having widening/shortening explicitly represented is of course better but using patterns for this has the unfortunate all-or-nothing effect (right now). I do hope with SLP only, where it's easier to insert/remove "stmts", we can delay "pattern recognition" in these cases eventually even up to vectorizable_* which would "simply" insert a widening/shortening operation into the SLP graph to make itself happy. In the mean time I think making the IFN path work also the same way as emuated/builtin would make sense. It's already half-way there.