https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69074

            Bug ID: 69074
           Summary: Specify NaN behaviour for floating point smin and smax
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jon at beniston dot com
  Target Milestone: ---

Currently, the behaviour of smin and smax is unspecified when either operand is
a NaN.

This seems to mean that floating point min/max instructions are only generated
if -ffinite-math-only is specified.

If there were some extra variants of these, that specified NaN behaviour, then
it seems these patterns could be used without -ffinite-math-only.

Two extra variants seem useful:

- One that always returns the second operand, if either operand is a NaN. This
is useful for c=a<b?a:b; type expressions. (x86 has this as minss)
- One that always returns the non-NaN operand. This would be useful for
inlining fmin()/fminf(). (aarch64 has minnm for this).

Reply via email to