[llvm-dev] llvm.rint specification

Cameron McInally via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 14 09:34:58 PST 2018


On Tue, Nov 13, 2018 at 7:56 PM Zakharin, Vyacheslav P via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hello,
>
>
>
> I believe llvm.rint description in LangRef is not quite complete.
>
>
>
> Llvm seems to map math.h:rint() call to llvm.rint intrinsic, and the
> LangRef says that the result of llvm.rint matches the result of libm rint()
> call.  Next, LangRef states that llvm.rint “returns the operand rounded to
> the nearest integer.”
>
>
>
> Shouldn’t the specification also say that “the actual rounding mode is
> determined by the runtime floating-point environment”, just like it does
> for llvm.experimental.constrained.rint?  That would match the actual libm
> rint() behavior…
>
>
Hi Salva,

llvm.rint won't honor the FPEnv in all cases. It falls under the default
FPEnv, as specified here:

https://llvm.org/docs/LangRef.html#floating-point-environment

That said, I agree that the LangRef copy for RINT (and probably other
intrinsics) is sloppy and needs to be cleaned up. Please bear with us. The
constrained FP intrinsic project is a work in progress.

-Cameron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181114/b64101f5/attachment.html>


More information about the llvm-dev mailing list