]> sourceware.org Git - newlib-cygwin.git/blob - winsup/cygwin/math/rintf.c
Add missing long double functions to Cygwin
[newlib-cygwin.git] / winsup / cygwin / math / rintf.c
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6 #include <math.h>
7
8 #if defined(__arm__) || defined(_ARM_)
9 /* This works around a compiler bug */
10 float __rintf_internal( float x );
11 asm(".def __rintf_internal; .scl 2; .type 32; .endef\n"
12 "\t.text\n"
13 "\t.align 4\n"
14 "\t.globl __rintf_internal\n"
15 "__rintf_internal:\n"
16 "\tvcvtr.s32.f32 s0, s0\n"
17 "\tvcvt.f32.s32 s0, s0\n"
18 "\tbx lr");
19 #endif /* defined(__arm__) || defined(_ARM_) */
20
21 float rintf (float x) {
22 float retval = 0.0F;
23 #if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
24 __asm__ __volatile__ ("frndint;": "=t" (retval) : "0" (x));
25 #elif defined(__arm__) || defined(_ARM_)
26 retval = __rintf_internal(x);
27 #endif
28 return retval;
29 }
This page took 0.035983 seconds and 5 git commands to generate.