Hi!

On Thu, Mar 24, 2022 at 10:00:43AM +0800, Kewen.Lin wrote:
> Commit r12-7687 exposed one miss optimization chance in function
> rs6000_maybe_emit_maxc_minc, for now it only considers comparison
> codes GE/GT/LE/LT, but it can support more variants with codes
> UNLT/UNLE/UNGT/UNGE by reversing them into the equivalent ones
> with GE/GT/LE/LT.

> +  /* Canonicalize UN[GL][ET] to [LG][TE].  */
> +  if (code == UNGE || code == UNGT || code == UNLE || code == UNLT)
> +    {
> +      code = reverse_condition_maybe_unordered (code);
> +      std::swap (true_cond, false_cond);
> +    }

Typically you would have to generate code to compensate for the reversed
comparison.  It works out fine here, but could you please restructure
the code to make that less tricky / more obvious?  Or at least add a
comment?

I wouldn't call it "canonicalisation" btw, LT is by no means more
standard than UNGE is.  You can say you are folding things so you later
have to support fewer cases, or similar?

Thanks,


Segher

Reply via email to