Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / powerpc / fpu / math_ldbl.h
blob36378c0239f2ba3d569c9018c44b2ca309c035cd
1 #ifndef _MATH_PRIVATE_H_
2 #error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
3 #endif
5 /* GCC does not optimize the default ldbl_pack code to not spill register
6 in the stack. The following optimization tells gcc that pack/unpack
7 is really a nop. We use fr1/fr2 because those are the regs used to
8 pass/return a single long double arg. */
9 static inline long double
10 ldbl_pack_ppc (double a, double aa)
12 register long double x __asm__ ("fr1");
13 register double xh __asm__ ("fr1");
14 register double xl __asm__ ("fr2");
15 xh = a;
16 xl = aa;
17 __asm__ ("" : "=f" (x) : "f" (xh), "f" (xl));
18 return x;
21 static inline void
22 ldbl_unpack_ppc (long double l, double *a, double *aa)
24 register long double x __asm__ ("fr1");
25 register double xh __asm__ ("fr1");
26 register double xl __asm__ ("fr2");
27 x = l;
28 __asm__ ("" : "=f" (xh), "=f" (xl) : "f" (x));
29 *a = xh;
30 *aa = xl;
33 #define ldbl_pack ldbl_pack_ppc
34 #define ldbl_unpack ldbl_unpack_ppc
36 #include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h>