On Wed, Jun 5, 2024 at 10:44 PM Jeff Law <jeffreya...@gmail.com> wrote:
>
>
>
> On 6/4/24 10:22 PM, liuhongt wrote:
> >> Can you add a testcase for this?  I don't mind if it's x86 specific and
> >> does a bit of asm scanning.
> >>
> >> Also note that the context for this patch has changed, so it won't
> >> automatically apply.  So be extra careful when updating so that it goes
> >> into the right place (all the more reason to have a testcase validating
> >> that the optimization works correctly).
> >>
> >>
> >> I think the patch itself is fine.  So further review is just for the
> >> testcase and should be easy.
> > rebased and add a testcase.
> >
> > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> > Ok for trunk?
> >
> >
> > When mask is (1 << (prec - imm) - 1) which is used to clear upper bits
> > of A, then it can be simplified to LSHIFTRT.
> >
> > i.e Simplify
> > (and:v8hi
> >    (ashifrt:v8hi A 8)
> >    (const_vector 0xff x8))
> > to
> > (lshifrt:v8hi A 8)
> >
> > gcc/ChangeLog:
> >
> >       PR target/114428
> >       * simplify-rtx.cc
> >       (simplify_context::simplify_binary_operation_1):
> >       Simplify (AND (ASHIFTRT A imm) mask) to (LSHIFTRT A imm) for
> >       specific mask.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * gcc.target/i386/pr114428-1.c: New test.
> OK.
>
> Being x264 related, I took a quick glance at RISC-V before/after and
> seems to be slightly better as well.
Great, thanks for the review :)
>
> Jeff



-- 
BR,
Hongtao

Reply via email to