This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA] Reimplement canonicalization of comparison arguments in match.pd
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 03 Jun 2015 22:51:10 -0600
- Subject: Re: [RFA] Reimplement canonicalization of comparison arguments in match.pd
- Authentication-results: sourceware.org; auth=none
- References: <55693F80 dot 9070805 at redhat dot com> <CAFiYyc0Qx7384hHoosm4FVgD5vR1wGh7WptGGDZewrdkeA+ZbQ at mail dot gmail dot 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