This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 4/4 v3][PR 67328] Optimize some masked comparisons to efficient bittest
- From: Richard Biener <rguenther at suse dot de>
- To: Yuri Gribov <tetra2005 at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Alan Modra <amodra at gmail dot com>, rguenth at gcc dot gnu dot org
- Date: Fri, 9 Jun 2017 14:37:56 +0200 (CEST)
- Subject: Re: [PATCH 4/4 v3][PR 67328] Optimize some masked comparisons to efficient bittest
- Authentication-results: sourceware.org; auth=none
- References: <CAJOtW+4i56i_F-8NEQKR3E6PDjY4n+2PbKWtEi51X4EjgdRQjQ@mail.gmail.com> <alpine.LSU.2.20.1705311315310.20726@zhemvz.fhfr.qr> <CAJOtW+6B0z7BGHTORosbAiE5O5NAcO0FFCc4uAogEnoOXNU7iQ@mail.gmail.com>
On Thu, 8 Jun 2017, Yuri Gribov wrote:
> On Wed, May 31, 2017 at 12:19 PM, Richard Biener <rguenther@suse.de> wrote:
> > On Mon, 29 May 2017, Yuri Gribov wrote:
> >
> >> This no longer fixes the PR but still works in some cases as
> >> demonstrated by the test. So I decided to keep it.
> >
> > As Richard noticed you don't need widest_ints but can use wide_ints.
> > Please use == 0 instead of ! on wide-ints as well.
> >
> > +(for cmp (le gt)
> > + (simplify
> > ..
> > + (switch
> > + (if (cmp == LE_EXPR)
> > + (eq:type (bit_and @1 { wide_int_to_tree (ty, hi_bits); }) {
> > build_zero_cst (ty); }))
> > + (if (cmp == GT_EXPR)
> > + (ne:type (bit_and @1 { wide_int_to_tree (ty, hi_bits); }) {
> > build_zero_cst (ty); })))))))))
> >
> > long lines plus you can simplify this with using
> >
> > (for cmp (le gt)
> > eqcmp (eq ne)
> > ...
> >
> > (eqcmp (bit_and @1 { wide_int_to_tree (ty, hi_bits); })
> > {build_zero_cst (ty); }))))
> >
> > no need to spell out :type on the result as well.
>
> Hi Richard,
>
> I fixed the issues (attached), rebased and retested on x64. Ok to commit?
Ok.
Thanks,
Richard.