On Tue, 11 Apr 2023 at 19:36, Prathamesh Kulkarni <prathamesh.kulka...@linaro.org> wrote: > > On Tue, 11 Apr 2023 at 14:17, Richard Biener <richard.guent...@gmail.com> > wrote: > > > > On Wed, Apr 5, 2023 at 10:39 AM Prathamesh Kulkarni via Gcc-patches > > <gcc-patches@gcc.gnu.org> wrote: > > > > > > Hi, > > > For the following test: > > > > > > svint32_t f(svint32_t v) > > > { > > > return svrev_s32 (svrev_s32 (v)); > > > } > > > > > > We generate 2 rev instructions instead of nop: > > > f: > > > rev z0.s, z0.s > > > rev z0.s, z0.s > > > ret > > > > > > The attached patch tries to fix that by trying to recognize the following > > > pattern in match.pd: > > > v1 = VEC_PERM_EXPR (v0, v0, mask) > > > v2 = VEC_PERM_EXPR (v1, v1, mask) > > > --> > > > v2 = v0 > > > if mask is { nelts - 1, nelts - 2, nelts - 3, ... } > > > > > > Code-gen with patch: > > > f: > > > ret > > > > > > Bootstrap+test passes on aarch64-linux-gnu, and SVE bootstrap in progress. > > > Does it look OK for stage-1 ? > > > > I didn't look at the patch but tree-ssa-forwprop.cc:simplify_permutation > > should > > handle two consecutive permutes with the is_combined_permutation_identity > > which might need tweaking for VLA vectors > Hi Richard, > Thanks for the suggestions. The attached patch modifies > is_combined_permutation_identity > to recognize the above pattern. > Does it look OK ? > Bootstrap+test in progress on aarch64-linux-gnu and x86_64-linux-gnu. Hi, ping https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615502.html
Thanks, Prathamesh > > Thanks, > Prathamesh > > > > Richard. > > > > > > > > Thanks, > > > Prathamesh