[PATCH] D79322: [FEnv] Small fixes to implementation of flt.rounds

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 08:01:59 PDT 2020


sepavloff marked an inline comment as done.
sepavloff added inline comments.


================
Comment at: llvm/test/CodeGen/RISCV/flt-rounds.ll:23
+; RV64I-NEXT:    sd ra, 8(sp)
+; RV64I-NEXT:    call __flt_rounds
+; RV64I-NEXT:    ld ra, 8(sp)
----------------
craig.topper wrote:
> sepavloff wrote:
> > lenary wrote:
> > > I'm interested to understand how this function is provided. Is it part of `compiler-rt` or `libgcc`, or is it provided another way?
> > At least musl library provides its implementation: https://git.musl-libc.org/cgit/musl/tree/src/fenv/__flt_rounds.c . Similar implementation exists in glibc.
> A quick google search for "glibc __flt_rounds" only shows it in a powerpc nofpu file.
GCC defined `FLT_ROUNDS` in `float.h` as `1`, which is incorrect in general case. As for `__builtin_flt_rounds`, now GCC does not have such intrinsic. So using `FLT_ROUND` on some targets might be tied to this kludge and lowering it to function call can cause fails. So lowering to a constant was restored.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79322





More information about the llvm-commits mailing list