[PATCH] D57143: [builtins] Rounding mode support for addxf3/subxf3
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 25 02:17:30 PST 2019
MaskRay added inline comments.
================
Comment at: compiler-rt/lib/builtins/arm/fp_mode.c:25
+ uint32_t fpscr;
+ __asm__ __volatile__("vmrs %0, fpscr" : "=r" (fpscr));
+ fpscr = fpscr >> ARM_RMODE_SHIFT & ARM_RMODE_MASK;
----------------
MaskRay wrote:
> efriedma wrote:
> > This needs to be guarded; vmrs is only valid on targets which support VFP. Not sure if we need to try to check that at runtime...
> On ARM, perhaps we can assume only `FE_TONEAREST` is available.
>
> https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/arm/ieee754-sf.S
>
> > Only the default rounding mode is intended for best performances.
For aarch64, implementing `__fegetround` in assembly also looks good to me. In musl http://git.musl-libc.org/cgit/musl/tree/src/fenv/aarch64/fenv.s
```
.global fegetround
.type fegetround,%function
fegetround:
mrs x0, fpcr
and w0, w0, #0xc00000
ret
```
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57143/new/
https://reviews.llvm.org/D57143
More information about the llvm-commits
mailing list