This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question reg fminnm/fmaxnm generation in aarch64


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: Its 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. Is there a way to make the compiler transform high-level language floating
   point construct like ((a<b)?a:b) to a fminnm/fmaxnm insn for aarch64
   targets?

Thanks!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]