<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 16 Sep 2021, at 20:18, Arthur O'Dwyer via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Thu, Sep 16, 2021 at 1:31 PM Serge Pavlov <<a href="mailto:sepavloff@gmail.com" class="">sepavloff@gmail.com</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="gmail_quote"><div class=""><div dir="ltr" class="gmail_attr">On Tue, Sep 14, 2021 at 12:50 AM Serge Pavlov <<a href="mailto:sepavloff@gmail.com" target="_blank" class="">sepavloff@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div dir="ltr" class=""><div class="">On Mon, Sep 13, 2021 at 11:46 PM Chris Tetreault <<a href="mailto:ctetreau@quicinc.com" target="_blank" class="">ctetreau@quicinc.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">… is guaranteed to work, and I read that fast-math enables the compiler to reason about constructs like `x + 0` being equal to `x`, then I’m going to be very confused when:<br class=""></blockquote><div class="">You are right, this was a bad idea. Compiler may optimize out `isnan` but only when it deduces that the value cannot be NaN, but not due to the user's promise. It is especially important for `isinf`. Addition of two finite values may produce infinity and there is no universal way to predict it. It is probably not an issue for types like float or double, but ML cores use halfs or even minifloats, where overflow is much more probable. If in the code:<br class=""></div><div class="">```</div><div class="">float r = a + b;</div><div class="">if (isinf(r)) {...</div><div class="">```</div>`isinf` were optimized out just because -ffinite-math-only is in effect, the user cannot check if overflow did not occur.</div></div></div></blockquote></div><div class=""> </div><div class="">Rules proposed by Richard are also formulated using arguments, not results. Now there is no intention to optimize such a case.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Infinity (HUGE_VAL) is already not NaN, so this example doesn't have anything to do with the NaN cases being discussed.</div></div></div></div></blockquote><div><br class=""></div><div>Well, there's <a href="https://bugs.llvm.org/show_bug.cgi?id=51775" class="">https://bugs.llvm.org/show_bug.cgi?id=51775</a>, "-ffast-math breaks strtod() due to "== HUGE_VAL" considered impossible"... :-)</div><div><br class=""></div><div>-Dimitry</div><div><br class=""></div></div><div class=""><br class=""></div></body></html>