<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><br class=""><blockquote type="cite" class=""><div class="">On Feb 28, 2018, at 6:33 PM, Friedman, Eli <<a href="mailto:efriedma@codeaurora.org" class="">efriedma@codeaurora.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">
  
  <div text="#000000" bgcolor="#FFFFFF" class="">
    <div class="moz-cite-prefix">On 2/28/2018 5:46 PM, Chris Lattner
      wrote:<br class="">
    </div>
    <blockquote type="cite" cite="mid:900CDC6D-15A2-488C-B19D-EBCB8A73775D@nondot.org" class="">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">
      On Feb 28, 2018, at 3:29 PM, Kaylor, Andrew via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="" moz-do-not-send="true">llvm-dev@lists.llvm.org</a>> wrote:<br class="">
      <div class="">
        <blockquote type="cite" class="">
          <div class="">
            <div class="WordSection1" style="page: WordSection1;
              font-family: Helvetica; font-size: 12px; font-style:
              normal; font-variant-caps: normal; font-weight: normal;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              background-color: rgb(255, 255, 255);">
              <div style="margin: 0in 0in 0.0001pt; font-size: 12pt;
                font-family: "Times New Roman", serif;" class=""><span style="font-size: 11pt; font-family:
                  Calibri, sans-serif; color: rgb(31, 73, 125);" class="">For the first part of Sanjay’s question, I
                  think the answer is, “Yes, we can fold all of these to
                  NaN in the general case.” </span></div>
            </div>
          </div>
        </blockquote>
        <div class=""><br class="">
        </div>
        <div class="">Agreed.  Those IR instructions are undefined on SNAN, and
          that undef could take on an SNAN value.  Folding these
          instructions to undef seems reasonable, and it is arguable
          that you could even fold it to an ‘unreachable'.</div>
      </div>
    </blockquote>
    <br class="">
    fdiv snan, snan is undefined?  As opposed to producing a qnan, as
    specified by IEEE-754?<br class=""></div></div></blockquote></div><div><br class=""></div><div>You’re talking about IEEE, I’m talking about LLVM IR.  LLVM IR is undefined on SNaNs.  It looks like LangRef isn’t clear about this, the only mention of SNaNs is in this statement:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">     </span>"fdiv is not (currently) defined on SNaN’s.”</div><div><br class=""></div><div>However, fdiv/fmul/etc are pervasively treated as not having side effects.  The intention, and the only sensible definition for them, is that they are undefined on SNaNs.  </div><div><br class=""></div><div>-Chris</div><div><br class=""></div><br class=""></body></html>