569dc49461
gcc: * Makefile.in (FPBIT_FUNCS, DPBIT_FUNCS, TPBIT_FUNCS): Remove. (libgcc-support): Remove $(FPBIT), $(DPBIT), $(TPBIT) dependencies. (libgcc.mvars): Remove FPBIT, FPBIT_FUNCS, DPBIT, DPBIT_FUNCS, TPBIT, TPBIT_FUNCS. * config/fp-bit.c, config/fp-bit.h: Move to ../libgcc. * config/arm/t-strongarm-elf (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/arm/t-vxworks: Likewise. * config/arm/t-wince-pe: Likewise. * config/avr/t-avr (fp-bit.c, FPBIT): Remove. * config/bfin/t-bfin (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/bfin/t-bfin-elf: Likewise. * config/bfin/t-bfin-linux: Likewise. * config/bfin/t-bfin-uclinux: Likewise. * config/cris/t-cris (FPBIT, DPBIT, dp-bit.c, tmplibgcc_fp_bit.c): Remove. * config/fr30/t-fr30: Likewise. * config/frv/t-frv: Likewise. * config/h8300/t-h8300 (FPBIT, fp-bit.c): Remove. * config/iq2000/t-iq2000 (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/m32c/t-m32c: Likewise. * config/m32r/t-linux: (LIB2FUNCS_EXTRA, fp-bit.c, dp-bit.c): Remove. * config/m32r/t-m32r (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/mcore/t-mcore: Likewise. * config/mep/t-mep: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/t-linux64 (TPBIT, tp-bit.c): Remove. * config/mips/t-mips (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/mips/t-sdemtk (FPBIT, DPBIT): Remove. * config/mips/t-sr71k (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/mn10300/t-linux: Remove. * config/mn10300/t-mn10300 (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/pdp11/t-pdp11: Likewise. * config/picochip/t-picochip (FPBIT, fp-bit.c): Remove. * config/rs6000/ppc64-fp.c: Move to ../libgcc/config/rs6000. * config/rs6000/t-aix43 (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. (LIB2FUNCS_EXTRA): Remove $(srcdir)/config/rs6000/ppc64-fp.c. * config/rs6000/t-aix52: Likewise. * config/rs6000/t-darwin (LIB2FUNCS_EXTRA): Remove $(srcdir)/config/rs6000/ppc64-fp.c. * config/rs6000/t-fprules-fpbit: Remove. * config/rs6000/t-linux64 (LIB2FUNCS_EXTRA): Remove. * config/rs6000/t-lynx (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/sh/t-netbsd (FPBIT, DPBIT): Remove. * config/sh/t-sh (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/sparc/t-elf: Likewise. * config/sparc/t-leon: Likewise. * config/sparc/t-leon3: Likewise. * config/spu/t-spu-elf: Likewise. (DPBIT_FUNCS): Remove. * config/stormy16/t-stormy16 (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/v850/t-v850: Likewise. * config.gcc (avr-*-rtems*): Add avr/avr-lib.h to libgcc_tm_file. (avr-*-*): Likewise. (h8300-*-rtems*): Set libgcc_tm_file. (h8300-*-elf*): Likewise. (powerpc-*-eabisimaltivec*): Remove rs6000/t-fprules-fpbit from tmake_file. (powerpc-*-eabisim*): Likewise. (powerpc-*-elf*): Likewise. (powerpc-*-eabialtivec*): Likewise. (powerpc-xilinx-eabi*): Likewise. (powerpc-*-eabi*): Likewise. (powerpc-*-rtems*): Likewise. (powerpc-wrs-vxworks, powerpc-wrs-vxworksae): Likewise. (powerpcle-*-elf*): Likewise. (powerpcle-*-eabisim*): Likewise. (powerpcle-*-eabi*): Likewise. (rx-*-elf*): Add rx/rx-lib.h to libgcc_tm_file. (am33_2.0-*-linux*): Remove mn10300/t-linux from tmake_file. * doc/fragments.texi (Target Fragment, Floating Point Emulation): Remove. gcc/po: * EXCLUDES (config/fp-bit.c, config/fp-bit.h): Remove. libgcc: * Makefile.in (double_type_size, long_double_type_size): Set. Remove $(fpbit-in-libgcc) support. (FPBIT_FUNCS, DPBIT_FUNCS, TPBIT_FUNCS): New variables. (fpbit-src): New variable. ($(fpbit-o), $(fpbit-s-o)): Use $(fpbit-src) instead of $(FPBIT). Compile with -DFLOAT $(FPBIT_CFLAGS). Use $<. ($(dpbit-o), $(dpbit-s-o)): Use $(fpbit-src) instead of $(DPBIT). Compile with $(FPBIT_CFLAGS). Use $<. ($(tpbit-o), $(tpbit-s-o): Use $(fpbit-src) instead of $(TPBIT). Compile with -DFLOAT $(TPBIT_CFLAGS). Use $<. * configure.ac (double_type_size, long_double_type_size): Determine and substitute. * configure: Regenerate. * fp-bit.c, fp-bit.h: New files. * config/avr/avr-lib.h, config/h8300/h8300-lib.h: New files. * config/mips/t-irix6 (TPBIT, $(gcc_objdir)/tp-bit.c): Remove. * config/mips/t-mips: New file. * config/mips/t-sdemtk: New file. * config/rs6000/ppc64-fp.c: New file. * config/rs6000/t-darwin (LIB2ADD): Add $(srcdir)/config/rs6000/ppc64-fp.c. * config/rs6000/t-ppc64-fp: New file. * config/rx/rx-lib.h: New file. * config/rx/t-rx (FPBIT): Set to true. ($(gcc_objdir)/fp-bit.c): Remove. (DPBIT): Set to true only with -m64bit-doubles. ($(gcc_objdir)/dp-bit.c): Remove. * config/sparc/t-softfp: Remove. * config/spu/t-elf: New file. * config/t-fdpbit, config/t-fpbit: New files. * config.host (m32c*-*-*): Add t-fdpbit to tmake_file. (mips*-*-*): Likewise. (arm-wrs-vxworks): Likewise. (arm*-*-freebsd*): Likewise. (avr-*-rtems*): Add t-fpbit to tmake_file. (avr-*-*): Likewise. (bfin*-elf*): Add t-fdpbit to tmake_file. (bfin*-uclinux*): Likewise. (bfin*-linux-uclibc*): Likewise. (bfin*-rtems*): New case. Add t-fdpbit to tmake_file. (bfin*-*): Add t-fdpbit to tmake_file. (crisv32-*-elf): Likewise. (cris-*-linux*): Likewise. (fr30-*-elf): Likewise. (frv-*-elf, frv-*-*linux*): Likewise. (h8300-*-rtems*, h8300-*-elf*): Add t-fpbit to tmake_file. (iq2000*-*-elf*): Add t-fdpbit to tmake_file. (m32r-*-elf*): Likewise. (m32rle-*-elf*): Likewise. (m32r-*-linux*): Likewise. (m32rle-*-linux*): Likewise. (mcore-*-elf): Add t-fdpbit to tmake_file. (microblaze*-*-*): Likewise. (mips-sgi-irix6.5*): Add t-tpbit to tmake_file. (mips*-*-netbsd*): Add mips/t-mips to tmake_file. (mips64*-*-linux*): Also handle mipsisa64*-*-linux*. Fix typo. Add mips/t-tpbit to tmake-file. (mips*-*-linux*): Fix typo. (mips*-sde-elf*): New case Add mips/t-sdemtk unless using newlib. (mipsisa64sr71k-*-elf*): Add t-fdpbit to tmake_file. (mipsisa64sb1-*-elf*): Add mips/t-mips to tmake_file. (mn10300-*-*): Likewise. (pdp11-*-*): Likewise. (picochip-*-*): Add t-fpbit to tmake_file. (powerpc-*-eabisimaltivec*): Likewise. (powerpc-*-eabisim*): Likewise. (powerpc-*-elf*): Likewise. (powerpc-*-eabialtivec*): Likewise. (powerpc-xilinx-eabi*): New case. Add t-fdpbit to tmake_file. (powerpc-*-eabi*): Add t-fdpbit to tmake_file. (powerpc-*-rtems*): Likewise. (powerpc-*-linux*, powerpc64-*-linux*): Add rs6000/t-ppc64-fp to tmake_file. (powerpc-wrs-vxworks, powerpc-wrs-vxworksae): Add t-fdpbit to tmake_file. (powerpc-*-lynxos*): Likewise. (powerpcle-*-elf*): Likewise. (powerpcle-*-eabisim*): Likewise. (powerpcle-*-eabi*): Likewise. (rs6000-ibm-aix4.[3456789]*, powerpc-ibm-aix4.[3456789]*): Add t-fdpbit, rs6000/t-ppc64-fp to tmake_file. (rs6000-ibm-aix5.1.*, powerpc-ibm-aix5.1.*): Likewise. (rs6000-ibm-aix[56789].*, powerpc-ibm-aix[56789].*): Likewise. (rx-*-elf): Add t-fdpbit to tmake_file. (sh-*-elf*, sh[12346l]*-*-elf*, sh-*-linux*) (sh[2346lbe]*-*-linux*, sh-*-netbsdelf*, shl*-*-netbsdelf*) (sh5-*-netbsd*, sh5l*-*-netbsd*, sh64-*-netbsd*) (sh64l*-*-netbsd*): Add t-fdpbit to tmake_file except on sh*-*-netbsd*. (sh-*-rtems*): Add t-fdpbit to tmake_file. (sh-wrs-vxworks): Likewise. (sparc-*-elf*): Replace sparc/t-softfp by t-fdpbit in tmake_file. (sparc-*-linux*): Add t-fdpbit to tmake_file for *-leon*. (sparc-*-rtems*, sparc64-*-rtems*): Split off ... (sparc64-*-rtems*): ... new case. (sparc-*-rtems*): Add t-fdpbit to tmake_file. (spu-*-elf*): Likewise. Add spu/t-elf to tmake_file. (v850*-*-*): Add t-fdpbit to tmake_file. (xstormy16-*-elf): Likewise. (am33_2.0-*-linux*): Add t-fdpbit to tmake_file. (mep*-*-*): Likewise. From-SVN: r177448
240 lines
6.4 KiB
C
240 lines
6.4 KiB
C
/* Functions needed for soft-float on powerpc64-linux, copied from
|
|
libgcc2.c with macros expanded to force the use of specific types.
|
|
|
|
Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
|
2000, 2001, 2002, 2003, 2004, 2006, 2009, 2011
|
|
Free Software Foundation, Inc.
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
version.
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
Under Section 7 of GPL version 3, you are granted additional
|
|
permissions described in the GCC Runtime Library Exception, version
|
|
3.1, as published by the Free Software Foundation.
|
|
|
|
You should have received a copy of the GNU General Public License and
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
|
|
#define TMODES
|
|
#include "fp-bit.h"
|
|
|
|
extern DItype __fixtfdi (TFtype);
|
|
extern DItype __fixdfdi (DFtype);
|
|
extern DItype __fixsfdi (SFtype);
|
|
extern USItype __fixunsdfsi (DFtype);
|
|
extern USItype __fixunssfsi (SFtype);
|
|
extern TFtype __floatditf (DItype);
|
|
extern TFtype __floatunditf (UDItype);
|
|
extern DFtype __floatdidf (DItype);
|
|
extern DFtype __floatundidf (UDItype);
|
|
extern SFtype __floatdisf (DItype);
|
|
extern SFtype __floatundisf (UDItype);
|
|
extern DItype __fixunstfdi (TFtype);
|
|
|
|
static DItype local_fixunssfdi (SFtype);
|
|
static DItype local_fixunsdfdi (DFtype);
|
|
|
|
DItype
|
|
__fixtfdi (TFtype a)
|
|
{
|
|
if (a < 0)
|
|
return - __fixunstfdi (-a);
|
|
return __fixunstfdi (a);
|
|
}
|
|
|
|
DItype
|
|
__fixdfdi (DFtype a)
|
|
{
|
|
if (a < 0)
|
|
return - local_fixunsdfdi (-a);
|
|
return local_fixunsdfdi (a);
|
|
}
|
|
|
|
DItype
|
|
__fixsfdi (SFtype a)
|
|
{
|
|
if (a < 0)
|
|
return - local_fixunssfdi (-a);
|
|
return local_fixunssfdi (a);
|
|
}
|
|
|
|
USItype
|
|
__fixunsdfsi (DFtype a)
|
|
{
|
|
if (a >= - (DFtype) (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
|
|
return (SItype) (a + (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
|
|
- (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1);
|
|
return (SItype) a;
|
|
}
|
|
|
|
USItype
|
|
__fixunssfsi (SFtype a)
|
|
{
|
|
if (a >= - (SFtype) (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
|
|
return (SItype) (a + (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
|
|
- (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1);
|
|
return (SItype) a;
|
|
}
|
|
|
|
TFtype
|
|
__floatditf (DItype u)
|
|
{
|
|
DFtype dh, dl;
|
|
|
|
dh = (SItype) (u >> (sizeof (SItype) * 8));
|
|
dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
|
|
dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
|
|
|
|
return (TFtype) dh + (TFtype) dl;
|
|
}
|
|
|
|
TFtype
|
|
__floatunditf (UDItype u)
|
|
{
|
|
DFtype dh, dl;
|
|
|
|
dh = (USItype) (u >> (sizeof (SItype) * 8));
|
|
dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
|
|
dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
|
|
|
|
return (TFtype) dh + (TFtype) dl;
|
|
}
|
|
|
|
DFtype
|
|
__floatdidf (DItype u)
|
|
{
|
|
DFtype d;
|
|
|
|
d = (SItype) (u >> (sizeof (SItype) * 8));
|
|
d *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
|
|
d += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
|
|
|
|
return d;
|
|
}
|
|
|
|
DFtype
|
|
__floatundidf (UDItype u)
|
|
{
|
|
DFtype d;
|
|
|
|
d = (USItype) (u >> (sizeof (SItype) * 8));
|
|
d *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
|
|
d += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
|
|
|
|
return d;
|
|
}
|
|
|
|
SFtype
|
|
__floatdisf (DItype u)
|
|
{
|
|
DFtype f;
|
|
|
|
if (53 < (sizeof (DItype) * 8)
|
|
&& 53 > ((sizeof (DItype) * 8) - 53 + 24))
|
|
{
|
|
if (! (- ((DItype) 1 << 53) < u
|
|
&& u < ((DItype) 1 << 53)))
|
|
{
|
|
if ((UDItype) u & (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1))
|
|
{
|
|
u &= ~ (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1);
|
|
u |= ((UDItype) 1 << ((sizeof (DItype) * 8) - 53));
|
|
}
|
|
}
|
|
}
|
|
f = (SItype) (u >> (sizeof (SItype) * 8));
|
|
f *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
|
|
f += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
|
|
|
|
return (SFtype) f;
|
|
}
|
|
|
|
SFtype
|
|
__floatundisf (UDItype u)
|
|
{
|
|
DFtype f;
|
|
|
|
if (53 < (sizeof (DItype) * 8)
|
|
&& 53 > ((sizeof (DItype) * 8) - 53 + 24))
|
|
{
|
|
if (u >= ((UDItype) 1 << 53))
|
|
{
|
|
if ((UDItype) u & (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1))
|
|
{
|
|
u &= ~ (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1);
|
|
u |= ((UDItype) 1 << ((sizeof (DItype) * 8) - 53));
|
|
}
|
|
}
|
|
}
|
|
f = (USItype) (u >> (sizeof (SItype) * 8));
|
|
f *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
|
|
f += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
|
|
|
|
return (SFtype) f;
|
|
}
|
|
|
|
DItype
|
|
__fixunstfdi (TFtype a)
|
|
{
|
|
if (a < 0)
|
|
return 0;
|
|
|
|
/* Compute high word of result, as a flonum. */
|
|
const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
|
|
/* Convert that to fixed (but not to DItype!),
|
|
and shift it into the high word. */
|
|
UDItype v = (USItype) b;
|
|
v <<= (sizeof (SItype) * 8);
|
|
/* Remove high part from the TFtype, leaving the low part as flonum. */
|
|
a -= (TFtype) v;
|
|
/* Convert that to fixed (but not to DItype!) and add it in.
|
|
Sometimes A comes out negative. This is significant, since
|
|
A has more bits than a long int does. */
|
|
if (a < 0)
|
|
v -= (USItype) (-a);
|
|
else
|
|
v += (USItype) a;
|
|
return v;
|
|
}
|
|
|
|
/* This version is needed to prevent recursion; fixunsdfdi in libgcc
|
|
calls fixdfdi, which in turn calls calls fixunsdfdi. */
|
|
|
|
static DItype
|
|
local_fixunsdfdi (DFtype a)
|
|
{
|
|
USItype hi, lo;
|
|
|
|
hi = a / (((UDItype) 1) << (sizeof (SItype) * 8));
|
|
lo = (a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (SItype) * 8)));
|
|
return ((UDItype) hi << (sizeof (SItype) * 8)) | lo;
|
|
}
|
|
|
|
/* This version is needed to prevent recursion; fixunssfdi in libgcc
|
|
calls fixsfdi, which in turn calls calls fixunssfdi. */
|
|
|
|
static DItype
|
|
local_fixunssfdi (SFtype original_a)
|
|
{
|
|
DFtype a = original_a;
|
|
USItype hi, lo;
|
|
|
|
hi = a / (((UDItype) 1) << (sizeof (SItype) * 8));
|
|
lo = (a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (SItype) * 8)));
|
|
return ((UDItype) hi << (sizeof (SItype) * 8)) | lo;
|
|
}
|
|
|
|
#endif /* __powerpc64__ */
|