On Sun, Dec 10, 2017 at 12:06 AM, Richard Sandiford <richard.sandif...@linaro.org> wrote: > This series is a replacement for: > https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00747.html > based on the feedback that using VEC_PERM_EXPR would be better. > > The changes are: > > (1) Remove the restriction that the selector elements have to have the > same width as the data elements, but only for constant selectors. > This lets through the cases we need without also allowing > potentially-expensive ops. Adding support for the variable > case can be done later if it seems useful, but it's not trivial. > > (2) Encode the integer form of constant selectors (vec_perm_indices) > in the same way as the new VECTOR_CST encoding, so that it can > cope with variable-length vectors. > > (3) Remove the vec_perm_const optab and reuse the target hook to emit > code. This avoids the need to create a CONST_VECTOR for the wide > selectors, and hence the need to have a corresponding wide vector > mode (which the target wouldn't otherwise need or support).
Hmm. Makes sense I suppose. > (4) When handling the variable vec_perm optab, check that modes can store > all element indices before using them. > > (5) Unconditionally use ssizetype selector elements in permutes created > by the vectoriser. Why specifically _signed_ sizetype? That sounds like an odd choice. But I'll eventually see when looking at the patch. Does that mean we have a VNDImode vector unconditionally for the permute even though a vector matching the width of the data members would work? What happens if the target doesn't have vec_perm_const but vec_perm to handle all constant permutes? Going to look over the patches now. Thanks for (re-)doing the work. Richard. > (6) Make the AArch64 vec_perm_const handling handle variable-length vectors. > > Tested directly on trunk on aarch64-linux-gnu, x86_64-linux-gnu and > powerpc64le-linux-gnu. Also tested by comparing the before and after > assembly output for: > > arm-linux-gnueabi arm-linux-gnueabihf aarch64-linux-gnu > aarch64_be-linux-gnu ia64-linux-gnu i686-pc-linux-gnu > mipsisa64-linux-gnu mipsel-linux-gnu powerpc64-linux-gnu > powerpc64le-linux-gnu powerpc-eabispe x86_64-linux-gnu > sparc64-linux-gnu > > at -O3, which should cover all the ports that defined vec_perm_const. > The only difference was one instance of different RA for ia64-linux-gnu, > caused by using force_reg on a SUBREG that was previously used directly. > > OK to install? > > Thanks, > Richard