[PATCH] D68810: Document rounding for llvm.lround and llvm.lrint

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 14:50:10 PST 2019


efriedma accepted this revision.
efriedma added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/docs/LangRef.rst:12788
 
-The '``llvm.lrint.*``' intrinsics returns the operand rounded to the
-nearest integer.
+The '``llvm.lrint.*``' intrinsics return the operand rounded to the nearest
+integer.
----------------
kpn wrote:
> efriedma wrote:
> > kpn wrote:
> > > efriedma wrote:
> > > > craig.topper wrote:
> > > > > Doesn't lrint use the current rounding mode?
> > > > Sort of?  I mean, in this context, we assume the "current rounding mode" is round-to-nearest-even.
> > > > 
> > > > Probably worth clarifying what we mean by "nearest" here.
> > > We specify how rounding is done very rarely, and when we do we usually say "nearest integer" without mentioning the rounding mode.
> > > 
> > > Do we want to change all references to "nearest integer" to state that the current rounding mode is used? Do we want a mention somewhere else to cover all uses?
> > We only use "nearest integer" in connection to rint/round/etc. In that context, it's not obvious to a casual reader what this means in the context of IEEE arithmetic.
> > 
> > In other contexts, floating-point arithmetic uses the default floating-point rounding mode; this is stated explicitly at http://llvm.org/docs/LangRef.html#floating-point-environment .
> Looking more closely, the *lrint parts of this patch are just grammar changes. I could commit those tomorrow and this patch would be just *lround. The *lround part of the patch is explicit in stating the rounding. Does that seem reasonable?
Fine.  In that case, LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68810





More information about the llvm-commits mailing list