[PATCH] D64746: Add constrained intrinsics for lrint and lround

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 06:07:59 PDT 2019


kpn added inline comments.


================
Comment at: docs/LangRef.rst:15724
+mode is determined by the runtime floating-point environment.  The rounding
+mode argument is only intended as information to the compiler.
+
----------------
cameron.mcinally wrote:
> cameron.mcinally wrote:
> > kpn wrote:
> > > andrew.w.kaylor wrote:
> > > > We should describe what is returned if the value is too large to be represented as a long. The llvm.lrint doesn't do that either, but it should too.
> > > What do we want this to be? My draft copy of C99 says the return value is "unspecified". What does that translate to in LLVM-land? Is this listed in IEEE 754?
> > That should throw an Invalid exception. And I think we agreed in your other Diff that it should return a poison value.
> ```
> 7.2 Invalid operation 
> 
> <...snip...>
> 
> For operations producing no result in floating-point format, the operations that signal the invalid operation exception are:
> 
> i) conversion of a floating-point number to an integer format, when the source is NaN, infinity, or a value that would convert to an integer outside the range of the result format under the applicable rounding attribute
> ```
Poison only in the constant folding case, right? What about in the non-constant-folding case?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64746/new/

https://reviews.llvm.org/D64746





More information about the llvm-commits mailing list