<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Sep 12, 2014, at 5:39 PM, Dan Gohman <<a href="mailto:dan433584@gmail.com">dan433584@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 12, 2014 at 3:04 PM, Owen Anderson <span dir="ltr"><<a href="mailto:resistor@mac.com" target="_blank">resistor@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div class="h5"><br><div><blockquote type="cite"><div>On Sep 12, 2014, at 2:24 PM, Owen Anderson <<a href="mailto:resistor@mac.com" target="_blank">resistor@mac.com</a>> wrote:</div><br><div><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Sep 12, 2014, at 10:27 AM, Dan Gohman <<a href="mailto:dan433584@gmail.com" target="_blank">dan433584@gmail.com</a>> wrote:</div><br><div><blockquote class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><br>More generally, I don’t see a compelling reason for LLVM to add intrinsic support for the version you’re proposing.  Your choice can easily be expanded into IR, and does not have the wide hardware support (particularly in GPUs) that the IEEE version does.</div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">The IEEE version can also be expanded in LLVM IR. And for GPUs, many GPU input languages leave the behavior on NaN unspecified, so it's not obviously the best guide.</div></div></blockquote></div><br><div>That’s not generally true.  HLSL (DirectX), CUDA, OpenCL, and Metal all have defined semantics for NaNs which include not propagating them through min/max.  GLSL (OpenGL) is the odd one out in this area.</div></div></div></blockquote></div></div></div></blockquote><div><br>HLSL leaves it undefined:<br><br><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb509624%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/bb509624%28v=vs.85%29.aspx</a><br></div></div></div></div></blockquote></div><br><div>Not exactly.  The HLSL language leaves it undefined, but HLSL bytecode specifies that it’s not NaN-propagating:</div><div><br></div><div><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/hh447185(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/hh447185(v=vs.85).aspx</a></div><div><br></div><div>And I happen to know from experience that a lot of graphics shaders depend on it working that way in practice.</div><div><br></div><div>—Owen</div></body></html>