Blame sysdeps/powerpc/fpu/math_ldbl.h

Packit 6c4009
/* Manipulation of the bit representation of 'long double' quantities.
Packit 6c4009
   Copyright (C) 2006-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _MATH_LDBL_H_PPC_
Packit 6c4009
#define _MATH_LDBL_H_PPC_ 1
Packit 6c4009
Packit 6c4009
/* GCC does not optimize the default ldbl_pack code to not spill register
Packit 6c4009
   in the stack. The following optimization tells gcc that pack/unpack
Packit 6c4009
   is really a nop.  We use fr1/fr2 because those are the regs used to
Packit 6c4009
   pass/return a single long double arg.  */
Packit 6c4009
static inline long double
Packit 6c4009
ldbl_pack_ppc (double a, double aa)
Packit 6c4009
{
Packit 6c4009
  register long double x __asm__ ("fr1");
Packit 6c4009
  register double xh __asm__ ("fr1");
Packit 6c4009
  register double xl __asm__ ("fr2");
Packit 6c4009
  xh = a;
Packit 6c4009
  xl = aa;
Packit 6c4009
  __asm__ ("" : "=f" (x) : "f" (xh), "f" (xl));
Packit 6c4009
  return x;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
static inline void
Packit 6c4009
ldbl_unpack_ppc (long double l, double *a, double *aa)
Packit 6c4009
{
Packit 6c4009
  register long double x __asm__ ("fr1");
Packit 6c4009
  register double xh __asm__ ("fr1");
Packit 6c4009
  register double xl __asm__ ("fr2");
Packit 6c4009
  x = l;
Packit 6c4009
  __asm__ ("" : "=f" (xh), "=f" (xl) : "f" (x));
Packit 6c4009
  *a = xh;
Packit 6c4009
  *aa = xl;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
#define ldbl_pack   ldbl_pack_ppc
Packit 6c4009
#define ldbl_unpack ldbl_unpack_ppc
Packit 6c4009
Packit 6c4009
#include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h>
Packit 6c4009
Packit 6c4009
#endif /* math_ldbl.h */