<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/77561>77561</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            rint and nearbyint intrinsic documentation is misleading about exceptions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          RalfJung
      </td>
    </tr>
</table>

<pre>
    The rint intrinsic makes this statement about FP exceptions:

> It may raise an inexact floating-point exception if the operand isn’t an integer.

nearbyint differs from rint by not having that statement.

However, this is misleading, since LLVM also documents "the default LLVM floating-point environment assumes that traps are disabled and status flags are not observable". This means that whether or not rint raises an exception is assumed to be un-observable, and LLVM will freely reorder rint with other operations that might alter FP exception flags. Effectively, rint and nearbyint provide equivalent semantics (as least that's how LLVM frontends should treat the situation), and anyone relying on rint doing anything with exceptions will be disappointed eventually.

It would probably be better to remove any mention of exceptions in the rint and nearbyint docs, and possibly to merge those intrinsics. People relying on exception behavior need to use the constrained intrinsics.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVEuP2zYQ_jX0ZbCGzJVj-6BDm6zRFCkQFEHvQ3EksaVIlTOSo39fkNqtvUEufkjk95oHMrs-EDXq-Ks6ftrhLENMzZ_ou9_n0O9MtGvzbSBILgi4IMkFdi2M-A8xyOAYWFBopCCAJs4C169A31uaxMXA6vkXVX1S1dvn8wt8FhhxhYSOCTCAC_QdW4HORxQX-qcpZq7_McB1IANBnChhsOA4qBetzpW6XGQDEOop7R-JAmEya8axrusoMXQpjpsLs0KIAgMuLvQgA8rdwzuQ3-KNFkpKf9ycOobRsSe0LvT5KbvQEnz58tcfgJ4j2NjOGYVBaZ01W-pw9rId-dFgWFyKYUuOeR5LoCggCScGTATWMRpPFrLvrHFm6Dz229tsIhqmtORDSus9fMsyR8LwCnUbSAZKEFM5XeyX4DkH9xAxv0qwIBEMwRyeHqE_FgXFxc15D10i8iskislS2nBvTgaIG10uVan_JmN0_SCAXii9a4_NzB5euo5acQv5NXMVuEx4r-KU4uIsAf07uwV9zoxpxCCuzWGfkcETshQ-pU8MQ7y9xp5iEAqWgYc4ewuSKKc8ELCTuehU-vJmEsMaA0Eiv-b2iGGTY2P-h2GVIf8oZu9tvqVitopNpb5kgRYKMqP367u2-ixwK0KmFA0av-aLhiSnIxESjXHJk7FC7o0cU-weuVwo4n-Sko0tv_mYIrPL4BJhpNQTyBCZ7jPMe_hKcfLvvN5LYygPSG4c2rpiZiq8bQwsCV0g-wi2s82zvTxfcEfN4VTV59OhulS7ocFT2yEeT2jxYi7PR6rqiuratMfz-UNVm51rdKXr6nCoqtPhfKj29aGi1poj1vpQV4iqrmhE5_feL-M-pn7nmGdqTqfjh8POoyHPZYFpHegG5aXSOu-z1OQ7T2buWdWVdyx8RxEnnpqf5Hjfc28TjW9jcl8Ar-vuXpjdnHwziExl6-mr0tfeyTCbfRtHpa-Z9_XraUrxb2pF6WtRy0pfi5v_AgAA___ShvZd">