On Wed, Aug 15, 2012 at 2:07 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Wed, Aug 15, 2012 at 01:46:05PM +0200, Richard Guenther wrote: >> Well, we're waiting for someone to break the tie ... I'd go with the original >> patch, improving the backends where necessary. > > E.g. i?86/x86_64 with just plain -msse2 has only very small subset of > constant shuffles (and no variable shuffle), so by doing the transformation > you could end up with a scalarized shuffle instead of two constant vector > shuffles. Expecting the backend to figure it out and doing the two constant > vector shuffles in every case is not realistic, i386/x86_64 has way too many > different shuffling instructions (and worse different ISA levels have > different subsets of them) and while a lot of effort has been spent on > it already by Richard, me, Marc and others, we are nowhere close to having > optimal sequence in many cases for various modes and ISA levels. Doing a > brute force might be too expensive.
Ok. That would still leave us with the issue Ramana brought up - the target hook returning true unconditionally if a generic permute is implemented. We just avoid generic expansion by tree-vect-generic.c that way. (I wonder if there exists some automated machinery that finds a path using existing instructions to shuffle from {0, 1, ..., n } to the mask and if that would be a viable way to handle shuffle expansions, or pre-compute them all) Richard. > Jakub