[Trying to get some feedback. I earlier posted on gcc-help a week ago]

In tree.def -

/* Minimum and maximum values.  When used with floating point, if both
   operands are zeros, or if either operand is NaN, then it is unspecified
   which of the two operands is returned as the result. */
DEFTREECODE (MIN_EXPR, "min_expr", tcc_binary, 2)
DEFTREECODE (MAX_EXPR, "max_expr", tcc_binary, 2)

I see that the compiler cannot simplify an expression like
((a<b)?a:b) into a MIN_EXPR for FP data types without additional flags
(-ffinite-math-only -fno-signed zeros flags).

Q1: It is not clear to me what is the fundamental reason of the
    "unspecified behaviour" of MIN_EXPR/MAX_EXPR in case of floating point
    operands ?

(For the sake of discussing what I write hereafter, assume that
fminnm/fmaxnm instructions offer better performance than fcsel/fcmp). So, two
further questions:

Q2. If one wants the compiler to generate fminnm/fmaxnm instructions, while
    conforming with IEEE standard, the way to do that will be to use math
    builtins fmin()/fmax(). Is this correct understanding?

Q3. What will it take for the compiler transform high-level language
    floating point construct like ((a<b)?a:b) to a fminnm/fmaxnm insn for
    aarch64 targets?

Thanks!

Reply via email to