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 #if defined(__GNUC__) && !defined(_SOFT_FLOAT)
20 
21 #include <math.h>
22 
23 /*
24  * Fast math version of lrintf(x)
25  * Return x rounded to integral value according to the prevailing
26  * rounding mode.
27  * Method:
28  *	Using inline x87 asms.
29  * Exception:
30  *	Governed by x87 FPCR.
31  */
32 
_f_lrintf(float x)33 long int _f_lrintf (float x)
34 {
35   long int _result;
36   __asm__("fistpl %0" : "=m" (_result) : "t" (x) : "st");
37   return _result;
38 }
39 
40 #endif  /* !__GNUC__ || _SOFT_FLOAT */
41 
42