public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFA] Reimplement canonicalization of comparison arguments in match.pd
Date: Thu, 04 Jun 2015 04:53:00 -0000	[thread overview]
Message-ID: <556FD93E.1050805@redhat.com> (raw)
In-Reply-To: <CAFiYyc0Qx7384hHoosm4FVgD5vR1wGh7WptGGDZewrdkeA+ZbQ@mail.gmail.com>

On 06/01/2015 05:15 AM, Richard Biener wrote:
>
> In addition to what Marc said we'd simplify 1 != 0 immediately anyway (to 1),
> so I don't think the special-cases should make a difference (and if they
> do I'd like to see a testcase!).
FWIW, I agree -- and across my testfiles I don't see any difference in 
the dumps with the special casing of 0 removed.


>
> Note that you should use a double-for here,
>
>   (for op (lt gt le ge)
>        iop (gt lt ge le)
>    (simplify ...
>      (if ...
>       (iop @1 @0)
>
> and drop the inner ifs.  You get op and iop iterated in lock-step.
> IMHO you should
> simply iterate over all comparison codes, thus
>
>   (for op (tcc_comparison)
>        iop (inverted_tcc_comparison)
>        nop (inverted_tcc_comparison_with_nans)
>    (...
>
> see the existing patterns using invert_tree_comparison.  Or not care
> about handling
> NANs correctly and guard with
>
>       && invert_tree_comparison (op, HONOR_NANS (..)) == iop
We actually want swapped_tcc_comparison.  We're swapping the operands, 
not inverting the comparison.  Swapping the operands also happens to be 
safe for FP, so no need to do anything special there.

Using Marc's suggestion for integrating canonicalization into the 
existing pattern seems the cleanest to me and that's what I'm testing now.

jeff

      parent reply	other threads:[~2015-06-04  4:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-30  5:02 Jeff Law
2015-05-30 15:10 ` Marc Glisse
2015-06-02 22:07   ` Jeff Law
2015-06-04  5:47   ` Jeff Law
2015-06-01 11:16 ` Richard Biener
2015-06-02 22:54   ` Jeff Law
2015-06-04  4:53   ` Jeff Law [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=556FD93E.1050805@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).