Hi!

On Thu, Sep 22, 2022 at 10:28:23AM +0800, Kewen.Lin wrote:
> on 2022/9/22 05:56, Segher Boessenkool wrote:
> > On Fri, Jun 24, 2022 at 10:02:19AM +0800, HAO CHEN GUI wrote:
> > In the other direction I am worried that the unspecs will degrade
> > performance (relative to smin/smax) when -ffast-math *is* active (and
> > this new builtin code and pattern doesn't blow up).
> 
> For fmin/fmax it would be fine, since they are transformed to {MAX,MIN}
> EXPR in middle end, and yes, it can degrade for the bifs, although IMHO
> the previous expansion to smin/smax contradicts with the bif names (users
> expect to map them to xs{min,max}dp than others).

But builtins *never* say to generate any particular instruction.  They
say to generate code that implements certain functionality.  For many
builtins this does of course boil down to specific instructions, but
even then it could be optimised away completely or replace with
something more specific if things can be folded or such.

> > I still think we should get RTL codes for this, to have access to proper
> > floating point min/max semantics always and everywhere.  "fmin" and
> > "fmax" seem to be good names :-)
> 
> It would be good, especially if we have observed some uses of these bifs
> and further opportunities around them.  :)

Currently we only have smin/smax for float, and those are not valid for
NaNs, or when the sign of zeros is relevant.  On the other hand the
semantics of fmin/fmax are settled and in most standards nowadays.  So
it is time we did this I would say :-)


Segher

Reply via email to