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