<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>This bit of confusion comes up regularly.  It would be really
      good to get this documented in either the langref or something
      linked from it.  <br>
    </p>
    <p>Philip<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 03/02/2018 08:34 AM, Stephen Canon
      via llvm-dev wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:BDBC1E64-D84D-4D97-8BE6-1DA409CD6337@apple.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      To further clarify: IEEE 754 calls the process of signaling
      “raising an exception” and “exception handling", but this is not
      what anyone else means by “exception”. Under “default exception
      handling”—what the llvm instructions assume—it is just setting a
      sticky bit in a status register that you cannot even read under
      the assumptions of the llvm instructions, hence operations on sNaN
      are side-effect free in the LLVM instruction model, just like any
      other input.<br class="">
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On Mar 2, 2018, at 11:31 AM, Stephen Canon via
            llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org"
              class="" moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type" content="text/html;
              charset=utf-8" class="">
            <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
              line-break: after-white-space;" class="">Thanks for
              expanding, Chris. Responses inline.<br class="">
              <div class=""><br class="">
                <blockquote type="cite" class="">
                  <div class="">On Mar 2, 2018, at 12:32 AM, Chris
                    Lattner via llvm-dev <<a
                      href="mailto:llvm-dev@lists.llvm.org" class=""
                      moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
                    wrote:</div>
                </blockquote>
                <div class=""><br class="">
                </div>
                <snip></div>
              <div class=""><br class="">
                <blockquote type="cite" class="">
                  <div class="">
                    <div style="caret-color: rgb(0, 0, 0); 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; text-decoration:
                      none;" class=""> - Because LLVM reorders and
                      speculates the instruction forms, and because IEEE
                      defines the corresponding IEEE operations as
                      trapping on SNaNs, it is clear that SNaNs are
                      outside of the domain of these LLVM operations.
                       Either speculation is ok or trapping on SNaN is
                      ok, pick one…  (and we already did :) </div>
                  </div>
                </blockquote>
                <div class=""><br class="">
                </div>
                <div class="">I see the source of confusion now.</div>
                <div class=""><br class="">
                </div>
                <div class="">IEEE does not define any operations as
                  trapping on sNaN. It defines operations as raising the
                  invalid flag on sNaN, which is *not a trap* under
                  default exception handling. It is exactly the same as
                  raising the underflow, overflow, inexact, or
                  division-by-zero flag. </div>
                <div class=""><br class="">
                </div>
                <div class="">Any llvm <i class="">instruction</i> necessarily
                  assumes default exception handling—otherwise, we would
                  be using the constrained intrinsics instead. So
                  there’s no reason for sNaN inputs to ever be undef
                  with the llvm instructions. They are just NaNs.</div>
                <div class=""><br class="">
                </div>
                <div class="">– Steve</div>
              </div>
            </div>
            _______________________________________________<br class="">
            LLVM Developers mailing list<br class="">
            <a href="mailto:llvm-dev@lists.llvm.org" class=""
              moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br
              class="">
            <a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br
              class="">
          </div>
        </blockquote>
      </div>
      <br class="">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>