1 /*
2 Copyright (c) 2007 Dave Korn
3
4
5 x87 FP implementation contributed to Newlib by
6 Dave Korn, November 2007. This file is placed in the
7 public domain. Permission to use, copy, modify, and
8 distribute this software is freely granted.
9 */
10 /*
11 * ====================================================
12 * x87 FP implementation contributed to Newlib by
13 * Dave Korn, November 2007. This file is placed in the
14 * public domain. Permission to use, copy, modify, and
15 * distribute this software is freely granted.
16 * ====================================================
17 */
18
19 #ifdef __GNUC__
20 #if !defined(_SOFT_FLOAT)
21
22 #include <math.h>
23 #include "f_math.h"
24
25 /*
26 * Fast math version of lrintl(x)
27 * Return x rounded to integral value according to the prevailing
28 * rounding mode.
29 * Method:
30 * Using inline x87 asms.
31 * Exception:
32 * Governed by x87 FPCR.
33 */
34
_f_lrintl(long double x)35 long int _f_lrintl (long double x)
36 {
37 long int _result;
38 __asm__("fistpl %0" : "=m" (_result) : "t" (x) : "st");
39 return _result;
40 }
41
42 #endif /* !_SOFT_FLOAT */
43 #endif /* __GNUC__ */
44