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

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 08:44:42 PDT 2019


cameron.mcinally added a subscriber: eli.friedman.
cameron.mcinally 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.
+
----------------
kpn wrote:
> 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?
> Poison only in the constant folding case, right? What about in the non-constant-folding case?

@eli.friedman

Besides the obvious flag raising, that would be undefined. It would be up to the hardware. 


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