]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/x86_64/fpu/math_private.h
1 #ifndef _MATH_PRIVATE_H
3 #define math_opt_barrier(x) \
5 if (sizeof (x) <= sizeof (double)) \
6 __asm ("" : "=x" (__x) : "0" (x)); \
8 __asm ("" : "=t" (__x) : "0" (x)); \
10 #define math_force_eval(x) \
13 if (sizeof (x) <= sizeof (double)) \
14 __asm __volatile ("" : : "x" (x)); \
16 __asm __volatile ("" : : "f" (x)); \
20 #include <math/math_private.h>
22 /* We can do a few things better on x86-64. */
24 /* Direct movement of float into integer register. */
25 #undef EXTRACT_WORDS64
26 #define EXTRACT_WORDS64(i,d) \
29 asm ("movd %1, %0" : "=rm" (i_) : "x" (d)); \
33 /* And the reverse. */
35 #define INSERT_WORDS64(d,i) \
38 asm ("movd %1, %0" : "=x" (d) : "rm" (i_)); \
41 /* Direct movement of float into integer register. */
43 #define GET_FLOAT_WORD(i,d) \
46 asm ("movd %1, %0" : "=rm" (i_) : "x" (d)); \
50 /* And the reverse. */
52 #define SET_FLOAT_WORD(d,i) \
55 asm ("movd %1, %0" : "=x" (d) : "rm" (i_)); \
61 ({ long int __di; EXTRACT_WORDS64 (__di, (double) (d)); \
62 (__di & 0x7fffffffffffffffl) > 0x7ff0000000000000l; })
64 ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
65 (__di & 0x7fffffff) > 0x7f800000; })
67 #define __isinf_ns(d) \
68 ({ long int __di; EXTRACT_WORDS64 (__di, (double) (d)); \
69 (__di & 0x7fffffffffffffffl) == 0x7ff0000000000000l; })
70 #define __isinf_nsf(d) \
71 ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
72 (__di & 0x7fffffff) == 0x7f800000; })
75 ({ long int __di; EXTRACT_WORDS64 (__di, (double) (d)); \
76 (__di & 0x7fffffffffffffffl) < 0x7ff0000000000000l; })
77 #define __finitef(d) \
78 ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
79 (__di & 0x7fffffff) < 0x7f800000; })
81 #define __ieee754_sqrt(d) \
83 asm ("sqrtsd %1, %0" : "=x" (__res) : "xm" ((double) (d))); \
85 #define __ieee754_sqrtf(d) \
87 asm ("sqrtss %1, %0" : "=x" (__res) : "xm" ((float) (d))); \
89 #define __ieee754_sqrtl(d) \
90 ({ long double __res; \
91 asm ("fsqrt" : "=t" (__res) : "0" ((long double) (d))); \
98 asm ("roundsd $4, %1, %0" : "=x" (__res) : "x" ((double) (d))); \
102 # define __rintf(d) \
104 asm ("roundss $4, %1, %0" : "=x" (__res) : "x" ((float) (d))); \
109 # define __floor(d) \
111 asm ("roundsd $1, %1, %0" : "=x" (__res) : "x" ((double) (d))); \
115 # define __floorf(d) \
117 asm ("roundss $1, %1, %0" : "=x" (__res) : "x" ((float) (d))); \