(root)/
glibc-2.38/
sysdeps/
powerpc/
fpu/
math_ldbl.h
       1  /* Manipulation of the bit representation of 'long double' quantities.
       2     Copyright (C) 2006-2023 Free Software Foundation, Inc.
       3     This file is part of the GNU C Library.
       4  
       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.
       9  
      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.
      14  
      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/>.  */
      18  
      19  #ifndef _MATH_LDBL_H_PPC_
      20  #define _MATH_LDBL_H_PPC_ 1
      21  
      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)
      28  {
      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;
      36  }
      37  
      38  static inline void
      39  ldbl_unpack_ppc (long double l, double *a, double *aa)
      40  {
      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;
      48  }
      49  
      50  #define ldbl_pack   ldbl_pack_ppc
      51  #define ldbl_unpack ldbl_unpack_ppc
      52  
      53  #include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h>
      54  
      55  #endif /* math_ldbl.h */