[RFC] Explicitly specifying NaN and signed zero semantics for minf and maxf

Thanks for all the good discussion, y’all!

It seems like Any and Platform are confusing, hard to reason about, and don’t necessarily capture the case I was aiming for.

So therefore, version 2 of the enums

enum NanSemantics {
  Unknown,
  PropagateNan,
  PropagateOther,
};

enum SignedZeroSemantics {
  Unknown,
  Ordered
};

In these new versions, Unknown semantics (which could also be called Undefined or Unspecified semantics) means that the min/max operation could implement either propagation behavior (or in the case of min/max(-0, +0) could return either result) and so constant folding the problematic cases is not permitted.

When lowering from Arith, Unknown semantics may be replaced by any fmin/fmax implementation.

1 Like