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

Reply via email to