malloc/Makefile: Split and sort tests
[glibc.git] / sysdeps / powerpc / fpu / math_ldbl.h
blob97a496f0e277cd3a1f491b8f2869f7a0f8d29f28
1 /* Manipulation of the bit representation of 'long double' quantities.
2 Copyright (C) 2006-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #ifndef _MATH_LDBL_H_PPC_
20 #define _MATH_LDBL_H_PPC_ 1
22 /* GCC does not optimize the default ldbl_pack code to not spill register
23 in the stack. The following optimization tells gcc that pack/unpack
24 is really a nop. We use fr1/fr2 because those are the regs used to
25 pass/return a single long double arg. */
26 static inline long double
27 ldbl_pack_ppc (double a, double aa)
29 register long double x __asm__ ("fr1");
30 register double xh __asm__ ("fr1");
31 register double xl __asm__ ("fr2");
32 xh = a;
33 xl = aa;
34 __asm__ ("" : "=f" (x) : "f" (xh), "f" (xl));
35 return x;
38 static inline void
39 ldbl_unpack_ppc (long double l, double *a, double *aa)
41 register long double x __asm__ ("fr1");
42 register double xh __asm__ ("fr1");
43 register double xl __asm__ ("fr2");
44 x = l;
45 __asm__ ("" : "=f" (xh), "=f" (xl) : "f" (x));
46 *a = xh;
47 *aa = xl;
50 #define ldbl_pack ldbl_pack_ppc
51 #define ldbl_unpack ldbl_unpack_ppc
53 #include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h>
55 #endif /* math_ldbl.h */