i * libgcc1-test.c, libgcc1.c, config/i386/perform.h: Delete file.
* testsuite/gcc.dg/complete-port.c: New (revised version of
libgcc1-test.c)
* po/POTFILES.in: Remove libgcc1-test.c and libgcc1.c.
* Makefile.in: Delete variables: OLDCC, CCLIBFLAGS, OLDAR,
OLDAR_FLAGS, LIBGCC1, LIBGCC1_TEST, CROSS_LIBGCC1,
LIB1FUNCS, and LIB1FUNCS_EXTRA. Delete rules: libgcc1-test,
libgcc1-test.o. Clarify commentary now that libgcc1 no longer exists.
* cross-make: Don't set LIBGCC1.
* mklibgcc.in: Delete all code for building from libgcc1.c.
Always honor LIB1ASMFUNCS if set.
* crtstuff.c, floatlib.c, longlong.h, config/fp-bit.c,
config/arc/lib1funcs.asm, config/arm/lib1funcs.asm,
config/d30v/libgcc1.asm, config/fr30/lib1funcs.asm,
config/h8300/lib1funcs.asm, config/i386/cygwin.asm,
config/i386/uwin.asm, config/m68hc11/larith.asm,
config/m68k/lb1sf68.asm, config/mcore/lib1.asm,
config/mn10200/lib1funcs.asm, config/sh/lib1funcs.asm,
config/sparc/lb1spc.asm, config/sparc/lb1spl.asm,
config/v850/lib1funcs.asm, config/c4x/libgcc.S:
Delete or update references to libgcc1 in commentary.
* config/t-libc-ok, config/t-linux, config/t-linux-aout,
config/t-netbsd, config/a29k/t-a29kbare, config/a29k/t-vx29k,
config/alpha/t-interix, config/alpha/t-osf, config/alpha/t-vms,
config/arc/t-arc, config/arm/t-arm-aout, config/arm/t-arm-coff,
config/arm/t-arm-elf, config/arm/t-linux, config/arm/t-pe,
config/arm/t-semi, config/arm/t-strongarm-coff,
config/arm/t-strongarm-elf, config/arm/t-strongarm-pe,
config/arm/t-xscale-coff, config/arm/t-xscale-elf, config/avr/t-avr,
config/c4x/t-c4x, config/d30v/t-d30v, config/fr30/t-fr30,
config/h8300/t-h8300, config/i386/t-beos, config/i386/t-cygwin,
config/i386/t-i386elf, config/i386/t-interix, config/i386/t-netware,
config/i386/t-next, config/i386/t-rtems-i386, config/i386/t-sol2,
config/i960/t-960bare, config/i960/t-vxworks960, config/ia64/t-ia64,
config/m32r/t-m32r, config/m68hc11/t-m68hc11-gas, config/m68k/t-lynx,
config/m68k/t-m68kbare, config/m68k/t-m68kelf,
config/m68k/t-mot3300-gald, config/m68k/t-mot3300-gas,
config/m68k/t-next, config/m68k/t-vxworks68, config/m88k/t-bug,
config/m88k/t-dgux, config/m88k/t-dgux-gas, config/m88k/t-dguxbcs,
config/m88k/t-luna, config/m88k/t-luna-gas, config/m88k/t-m88k,
config/m88k/t-m88k-gas, config/m88k/t-sysv4, config/mcore/t-mcore,
config/mcore/t-mcore-pe, config/mips/t-bsd, config/mips/t-bsd-gas,
config/mips/t-cross64, config/mips/t-ecoff, config/mips/t-elf,
config/mips/t-iris6, config/mips/t-r3900, config/mips/t-svr3,
config/mips/t-svr3-gas, config/mips/t-svr4, config/mips/t-svr4-gas,
config/mips/t-ultrix, config/mn10200/t-mn10200,
config/mn10300/t-mn10300, config/pa/t-linux, config/pa/t-linux64,
config/pa/t-pa, config/pa/t-pa64, config/pa/t-pro,
config/pdp11/t-pdp11, config/pj/t-pj, config/rs6000/t-aix43,
config/rs6000/t-beos, config/rs6000/t-darwin, config/rs6000/t-newas,
config/rs6000/t-ppccomm, config/rs6000/t-rs6000, config/sh/t-linux,
config/sh/t-sh, config/sparc/t-chorus-elf, config/sparc/t-elf,
config/sparc/t-sol2, config/sparc/t-sp86x, config/sparc/t-sparcbare,
config/sparc/t-sparclite, config/sparc/t-splet,
config/sparc/t-sunos41, config/sparc/t-vxsparc,
config/sparc/t-vxsparc64, config/v850/t-v850:
Don't set any of LIBGCC1, CROSS_LIBGCC1, or LIBGCC1_TEST.
* config/alpha/alpha.h, config/i386/i386.h, config/i860/i860.h:
Don't set FLOAT_VALUE_TYPE, FLOAT_ARG_TYPE, INTIFY, or FLOATIFY.
* config/d30v/d30v.h: Don't mention LIBGCC_NEEDS_DOUBLE,
FLOAT_VALUE_TYPE, FLOAT_ARG_TYPE, FLOATIFY, INTIFY,
nongcc_SI_type, nongcc_word_type, or perform_*
* config/i860/fx2800: Don't define perform_umodsi3 or perform_modsi3.
* config/i386/386bsd.h, config/i386/beos-elf.h,
config/i386/linux-aout.h, config/i386/linux-oldld.h,
config/i386/linux.h, config/i386/mach.h, config/i386/netbsd.h,
config/i386/openbsd.h, config/i386/osfrose.h, config/i386/rtemself.h:
Don't include i386/perform.h.
* config/a29k/t-a29k, config/arm/t-semiaof, config/i370/t-i370,
config/i370/t-linux, config/i370/t-mvs, config/i370/t-oe,
config/i386/t-djgpp, config/i386/t-i386bare, config/i386/t-vsta,
config/ia64/t-hpux, config/mips/t-mips, config/mips/t-mips-gas,
config/mips/t-osfrose, config/sparc/t-sp64, config/sparc/t-sunos40,
config/vax/t-openbsd, config/vax/t-vax: Delete.
* config.gcc: Remove references to deleted files.
(arm-semi-aof): Use arm/t-semi for tmake_file.
* gcc.texi, install.texi, invoke.texi, tm.texi:
Delete or rewrite text which is no longer relevant now that
libgcc1 no longer exists.
* config/t-openbsd, config/alpha/t-interix, config/i386/t-interix:
No need to set INSTALL_ASSERT_H. (Missed in previous sweep.)
From-SVN: r42188
2001-05-17 05:16:18 +02:00
|
|
|
/* This is a software floating point library which can be used
|
|
|
|
for targets without hardware floating point.
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003
|
2001-01-31 12:04:33 +01:00
|
|
|
Free Software Foundation, Inc.
|
1994-07-16 22:45:33 +02:00
|
|
|
|
|
|
|
This file 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 2, or (at your option) any
|
|
|
|
later version.
|
|
|
|
|
|
|
|
In addition to the permissions in the GNU General Public License, the
|
|
|
|
Free Software Foundation gives you unlimited permission to link the
|
|
|
|
compiled version of this file with other programs, and to distribute
|
|
|
|
those programs without any restriction coming from the use of this
|
|
|
|
file. (The General Public License restrictions do apply in other
|
|
|
|
respects; for example, they cover modification of the file, and
|
|
|
|
distribution when not linked into another program.)
|
|
|
|
|
|
|
|
This file 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.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING. If not, write to
|
1995-06-15 14:55:05 +02:00
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1994-07-16 22:45:33 +02:00
|
|
|
|
|
|
|
/* As a special exception, if you link this library with other files,
|
|
|
|
some of which are compiled with GCC, to produce an executable,
|
|
|
|
this library does not by itself cause the resulting executable
|
|
|
|
to be covered by the GNU General Public License.
|
|
|
|
This exception does not however invalidate any other reasons why
|
|
|
|
the executable file might be covered by the GNU General Public License. */
|
|
|
|
|
|
|
|
/* This implements IEEE 754 format arithmetic, but does not provide a
|
1994-07-12 00:32:24 +02:00
|
|
|
mechanism for setting the rounding mode, or for generating or handling
|
|
|
|
exceptions.
|
|
|
|
|
|
|
|
The original code by Steve Chamberlain, hacked by Mark Eichin and Jim
|
1994-07-16 22:45:33 +02:00
|
|
|
Wilson, all of Cygnus Support. */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
/* The intended way to use this file is to make two copies, add `#define FLOAT'
|
|
|
|
to one copy, then compile both copies and add them to libgcc.a. */
|
|
|
|
|
configure.in: Kill tm.h.
* configure.in: Kill tm.h. Include the files in the $tm_file
list in all three of config.h, hconfig.h, tconfig.h, after the
relevant set of xm_files. Put TARGET_CPU_DEFAULT in all
three, include insn-codes.h in all three (#ifndef GENERATOR_FILE).
* configure: Regenerate.
* Makefile.in (clean): Don't delete tm.h.
* system.h: If SUCCESS_EXIT_CODE and FATAL_EXIT_CODE are not
defined, set them from EXIT_SUCCESS and EXIT_FAILURE. If
those are not defined, set SEC and FEC to 0 and 1.
* gcc.texi: Update to match.
* crtstuff.c: Include tconfig.h, not auto-host.h and tm.h.
* config/fp-bit.c, config/m68k/aux-crt2.asm,
config/m68k/aux-crtn.asm, config/m68k/aux-mcount.c:
Include tconfig.h, not tm.h.
* config/xm-lynx.h, config/xm-std32.h,
config/a29k/xm-a29k.h, config/a29k/xm-unix.h,
config/alpha/xm-alpha.h, config/arc/xm-arc.h,
config/avr/xm-avr.h, config/c4x/xm-c4x.h,
config/clipper/xm-clix.h, config/convex/xm-convex.h,
config/d30v/xm-d30v.h, config/dsp16xx/xm-dsp16xx.h,
config/elxsi/xm-elxsi.h, config/fr30/xm-fr30.h,
config/h8300/xm-h8300.h, config/i370/xm-linux.h,
config/i386/xm-i386.h, config/i860/xm-i860.h,
config/i960/xm-i960.h, config/ia64/xm-ia64.h,
config/m32r/xm-m32r.h, config/m68hc11/xm-m68hc11.h,
config/m88k/xm-m88k.h, config/mcore/xm-mcore.h,
config/mips/xm-mips.h, config/mn10200/xm-mn10200.h,
config/mn10300/xm-mn10300.h, config/ns32k/xm-ns32k.h,
config/pa/xm-linux.h, config/pa/xm-pa.h,
config/pa/xm-pa64hpux.h, config/pa/xm-pahpux.h,
config/pa/xm-papro.h, config/pdp11/xm-pdp11.h,
config/pj/xm-pj.h, config/romp/xm-romp.h,
config/rs6000/xm-beos.h, config/rs6000/xm-rs6000.h,
config/rs6000/xm-sysv4.h, config/sh/xm-sh.h,
config/sparc/xm-sparc.h, config/sparc/xm-sysv4.h,
config/v850/xm-v850.h, config/vax/xm-vax.h,
config/we32k/xm-we32k.h:
Don't include tm.h.
Don't define SUCCESS_EXIT_CODE or FATAL_EXIT_CODE.
* config/i370/xm-i370.h, config/i370/xm-mvs.h,
config/i370/xm-oe.h: Don't include tm.h. Don't define
SUCCESS_EXIT_CODE.
* config/vax/xm-vms.h: Don't include tm.h.
* config/xm-lynx.h, config/avr/xm-avr.h,
config/fr30/xm-fr30.h, config/pdp11/xm-pdp11.h,
Delete; made empty by above changes.
* config/i386/xm-lynx.h, config/m68k/xm-lynx.h,
config/rs6000/xm-lynx.h, config/sparc/xm-lynx.h:
Don't include config/xm-lynx.h or tm.h.
* config/xm-gnu.h: Don't include fcntl.h.
* config/sparc/xm-lynx.h: Don't include sys/types.h and
sys/wait.h.
* config/clipper/xm-clix.h, config/vax/xm-vax.h: Don't define isinf.
From-SVN: r40199
2001-03-03 04:32:55 +01:00
|
|
|
#include "tconfig.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tm.h"
|
2000-07-03 17:06:12 +02:00
|
|
|
#include "fp-bit.h"
|
1997-12-21 14:45:24 +01:00
|
|
|
|
2002-09-19 15:51:24 +02:00
|
|
|
/* The following macros can be defined to change the behavior of this file:
|
1994-07-12 00:32:24 +02:00
|
|
|
FLOAT: Implement a `float', aka SFmode, fp library. If this is not
|
|
|
|
defined, then this file implements a `double', aka DFmode, fp library.
|
|
|
|
FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e.
|
|
|
|
don't include float->double conversion which requires the double library.
|
|
|
|
This is useful only for machines which can't support doubles, e.g. some
|
|
|
|
8-bit processors.
|
|
|
|
CMPtype: Specify the type that floating point compares should return.
|
|
|
|
This defaults to SItype, aka int.
|
|
|
|
US_SOFTWARE_GOFAST: This makes all entry points use the same names as the
|
i * libgcc1-test.c, libgcc1.c, config/i386/perform.h: Delete file.
* testsuite/gcc.dg/complete-port.c: New (revised version of
libgcc1-test.c)
* po/POTFILES.in: Remove libgcc1-test.c and libgcc1.c.
* Makefile.in: Delete variables: OLDCC, CCLIBFLAGS, OLDAR,
OLDAR_FLAGS, LIBGCC1, LIBGCC1_TEST, CROSS_LIBGCC1,
LIB1FUNCS, and LIB1FUNCS_EXTRA. Delete rules: libgcc1-test,
libgcc1-test.o. Clarify commentary now that libgcc1 no longer exists.
* cross-make: Don't set LIBGCC1.
* mklibgcc.in: Delete all code for building from libgcc1.c.
Always honor LIB1ASMFUNCS if set.
* crtstuff.c, floatlib.c, longlong.h, config/fp-bit.c,
config/arc/lib1funcs.asm, config/arm/lib1funcs.asm,
config/d30v/libgcc1.asm, config/fr30/lib1funcs.asm,
config/h8300/lib1funcs.asm, config/i386/cygwin.asm,
config/i386/uwin.asm, config/m68hc11/larith.asm,
config/m68k/lb1sf68.asm, config/mcore/lib1.asm,
config/mn10200/lib1funcs.asm, config/sh/lib1funcs.asm,
config/sparc/lb1spc.asm, config/sparc/lb1spl.asm,
config/v850/lib1funcs.asm, config/c4x/libgcc.S:
Delete or update references to libgcc1 in commentary.
* config/t-libc-ok, config/t-linux, config/t-linux-aout,
config/t-netbsd, config/a29k/t-a29kbare, config/a29k/t-vx29k,
config/alpha/t-interix, config/alpha/t-osf, config/alpha/t-vms,
config/arc/t-arc, config/arm/t-arm-aout, config/arm/t-arm-coff,
config/arm/t-arm-elf, config/arm/t-linux, config/arm/t-pe,
config/arm/t-semi, config/arm/t-strongarm-coff,
config/arm/t-strongarm-elf, config/arm/t-strongarm-pe,
config/arm/t-xscale-coff, config/arm/t-xscale-elf, config/avr/t-avr,
config/c4x/t-c4x, config/d30v/t-d30v, config/fr30/t-fr30,
config/h8300/t-h8300, config/i386/t-beos, config/i386/t-cygwin,
config/i386/t-i386elf, config/i386/t-interix, config/i386/t-netware,
config/i386/t-next, config/i386/t-rtems-i386, config/i386/t-sol2,
config/i960/t-960bare, config/i960/t-vxworks960, config/ia64/t-ia64,
config/m32r/t-m32r, config/m68hc11/t-m68hc11-gas, config/m68k/t-lynx,
config/m68k/t-m68kbare, config/m68k/t-m68kelf,
config/m68k/t-mot3300-gald, config/m68k/t-mot3300-gas,
config/m68k/t-next, config/m68k/t-vxworks68, config/m88k/t-bug,
config/m88k/t-dgux, config/m88k/t-dgux-gas, config/m88k/t-dguxbcs,
config/m88k/t-luna, config/m88k/t-luna-gas, config/m88k/t-m88k,
config/m88k/t-m88k-gas, config/m88k/t-sysv4, config/mcore/t-mcore,
config/mcore/t-mcore-pe, config/mips/t-bsd, config/mips/t-bsd-gas,
config/mips/t-cross64, config/mips/t-ecoff, config/mips/t-elf,
config/mips/t-iris6, config/mips/t-r3900, config/mips/t-svr3,
config/mips/t-svr3-gas, config/mips/t-svr4, config/mips/t-svr4-gas,
config/mips/t-ultrix, config/mn10200/t-mn10200,
config/mn10300/t-mn10300, config/pa/t-linux, config/pa/t-linux64,
config/pa/t-pa, config/pa/t-pa64, config/pa/t-pro,
config/pdp11/t-pdp11, config/pj/t-pj, config/rs6000/t-aix43,
config/rs6000/t-beos, config/rs6000/t-darwin, config/rs6000/t-newas,
config/rs6000/t-ppccomm, config/rs6000/t-rs6000, config/sh/t-linux,
config/sh/t-sh, config/sparc/t-chorus-elf, config/sparc/t-elf,
config/sparc/t-sol2, config/sparc/t-sp86x, config/sparc/t-sparcbare,
config/sparc/t-sparclite, config/sparc/t-splet,
config/sparc/t-sunos41, config/sparc/t-vxsparc,
config/sparc/t-vxsparc64, config/v850/t-v850:
Don't set any of LIBGCC1, CROSS_LIBGCC1, or LIBGCC1_TEST.
* config/alpha/alpha.h, config/i386/i386.h, config/i860/i860.h:
Don't set FLOAT_VALUE_TYPE, FLOAT_ARG_TYPE, INTIFY, or FLOATIFY.
* config/d30v/d30v.h: Don't mention LIBGCC_NEEDS_DOUBLE,
FLOAT_VALUE_TYPE, FLOAT_ARG_TYPE, FLOATIFY, INTIFY,
nongcc_SI_type, nongcc_word_type, or perform_*
* config/i860/fx2800: Don't define perform_umodsi3 or perform_modsi3.
* config/i386/386bsd.h, config/i386/beos-elf.h,
config/i386/linux-aout.h, config/i386/linux-oldld.h,
config/i386/linux.h, config/i386/mach.h, config/i386/netbsd.h,
config/i386/openbsd.h, config/i386/osfrose.h, config/i386/rtemself.h:
Don't include i386/perform.h.
* config/a29k/t-a29k, config/arm/t-semiaof, config/i370/t-i370,
config/i370/t-linux, config/i370/t-mvs, config/i370/t-oe,
config/i386/t-djgpp, config/i386/t-i386bare, config/i386/t-vsta,
config/ia64/t-hpux, config/mips/t-mips, config/mips/t-mips-gas,
config/mips/t-osfrose, config/sparc/t-sp64, config/sparc/t-sunos40,
config/vax/t-openbsd, config/vax/t-vax: Delete.
* config.gcc: Remove references to deleted files.
(arm-semi-aof): Use arm/t-semi for tmake_file.
* gcc.texi, install.texi, invoke.texi, tm.texi:
Delete or rewrite text which is no longer relevant now that
libgcc1 no longer exists.
* config/t-openbsd, config/alpha/t-interix, config/i386/t-interix:
No need to set INSTALL_ASSERT_H. (Missed in previous sweep.)
From-SVN: r42188
2001-05-17 05:16:18 +02:00
|
|
|
US Software goFast library.
|
1994-07-12 00:32:24 +02:00
|
|
|
_DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding
|
2000-03-16 18:20:57 +01:00
|
|
|
two integers to the FLO_union_type.
|
|
|
|
NO_DENORMALS: Disable handling of denormals.
|
1994-07-12 00:32:24 +02:00
|
|
|
NO_NANS: Disable nan and infinity handling
|
|
|
|
SMALL_MACHINE: Useful when operations on QIs and HIs are faster
|
|
|
|
than on an SI */
|
|
|
|
|
1996-04-04 18:45:26 +02:00
|
|
|
/* We don't currently support extended floats (long doubles) on machines
|
|
|
|
without hardware to deal with them.
|
|
|
|
|
|
|
|
These stubs are just to keep the linker from complaining about unresolved
|
|
|
|
references which can be pulled in from libio & libstdc++, even if the
|
|
|
|
user isn't using long doubles. However, they may generate an unresolved
|
|
|
|
external to abort if abort is not used by the function, and the stubs
|
|
|
|
are referenced from within libc, since libgcc goes before and after the
|
|
|
|
system library. */
|
|
|
|
|
2002-07-31 01:55:09 +02:00
|
|
|
#ifdef DECLARE_LIBRARY_RENAMES
|
|
|
|
DECLARE_LIBRARY_RENAMES
|
|
|
|
#endif
|
|
|
|
|
1996-04-04 18:45:26 +02:00
|
|
|
#ifdef EXTENDED_FLOAT_STUBS
|
2002-10-07 10:47:09 +02:00
|
|
|
extern void abort (void);
|
|
|
|
void __extendsfxf2 (void) { abort(); }
|
|
|
|
void __extenddfxf2 (void) { abort(); }
|
|
|
|
void __truncxfdf2 (void) { abort(); }
|
|
|
|
void __truncxfsf2 (void) { abort(); }
|
|
|
|
void __fixxfsi (void) { abort(); }
|
|
|
|
void __floatsixf (void) { abort(); }
|
|
|
|
void __addxf3 (void) { abort(); }
|
|
|
|
void __subxf3 (void) { abort(); }
|
|
|
|
void __mulxf3 (void) { abort(); }
|
|
|
|
void __divxf3 (void) { abort(); }
|
|
|
|
void __negxf2 (void) { abort(); }
|
|
|
|
void __eqxf2 (void) { abort(); }
|
|
|
|
void __nexf2 (void) { abort(); }
|
|
|
|
void __gtxf2 (void) { abort(); }
|
|
|
|
void __gexf2 (void) { abort(); }
|
|
|
|
void __lexf2 (void) { abort(); }
|
|
|
|
void __ltxf2 (void) { abort(); }
|
|
|
|
|
|
|
|
void __extendsftf2 (void) { abort(); }
|
|
|
|
void __extenddftf2 (void) { abort(); }
|
|
|
|
void __trunctfdf2 (void) { abort(); }
|
|
|
|
void __trunctfsf2 (void) { abort(); }
|
|
|
|
void __fixtfsi (void) { abort(); }
|
|
|
|
void __floatsitf (void) { abort(); }
|
|
|
|
void __addtf3 (void) { abort(); }
|
|
|
|
void __subtf3 (void) { abort(); }
|
|
|
|
void __multf3 (void) { abort(); }
|
|
|
|
void __divtf3 (void) { abort(); }
|
|
|
|
void __negtf2 (void) { abort(); }
|
|
|
|
void __eqtf2 (void) { abort(); }
|
|
|
|
void __netf2 (void) { abort(); }
|
|
|
|
void __gttf2 (void) { abort(); }
|
|
|
|
void __getf2 (void) { abort(); }
|
|
|
|
void __letf2 (void) { abort(); }
|
|
|
|
void __lttf2 (void) { abort(); }
|
1996-04-04 18:45:26 +02:00
|
|
|
#else /* !EXTENDED_FLOAT_STUBS, rest of file */
|
|
|
|
|
1994-07-12 00:32:24 +02:00
|
|
|
/* IEEE "special" number predicates */
|
|
|
|
|
|
|
|
#ifdef NO_NANS
|
|
|
|
|
|
|
|
#define nan() 0
|
|
|
|
#define isnan(x) 0
|
|
|
|
#define isinf(x) 0
|
|
|
|
#else
|
|
|
|
|
1999-09-13 11:14:21 +02:00
|
|
|
#if defined L_thenan_sf
|
2000-07-03 17:06:12 +02:00
|
|
|
const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} };
|
1999-09-13 11:14:21 +02:00
|
|
|
#elif defined L_thenan_df
|
2000-07-03 17:06:12 +02:00
|
|
|
const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} };
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#elif defined L_thenan_tf
|
|
|
|
const fp_number_type __thenan_tf = { CLASS_SNAN, 0, 0, {(fractype) 0} };
|
|
|
|
#elif defined TFLOAT
|
|
|
|
extern const fp_number_type __thenan_tf;
|
1999-09-13 11:14:21 +02:00
|
|
|
#elif defined FLOAT
|
|
|
|
extern const fp_number_type __thenan_sf;
|
|
|
|
#else
|
|
|
|
extern const fp_number_type __thenan_df;
|
|
|
|
#endif
|
|
|
|
|
1994-07-12 00:32:24 +02:00
|
|
|
INLINE
|
|
|
|
static fp_number_type *
|
2000-07-03 17:06:12 +02:00
|
|
|
nan (void)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
2002-09-29 15:16:44 +02:00
|
|
|
/* Discard the const qualifier... */
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#ifdef TFLOAT
|
|
|
|
return (fp_number_type *) (& __thenan_tf);
|
|
|
|
#elif defined FLOAT
|
1999-09-13 11:14:21 +02:00
|
|
|
return (fp_number_type *) (& __thenan_sf);
|
|
|
|
#else
|
|
|
|
return (fp_number_type *) (& __thenan_df);
|
|
|
|
#endif
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
INLINE
|
|
|
|
static int
|
|
|
|
isnan ( fp_number_type * x)
|
|
|
|
{
|
|
|
|
return x->class == CLASS_SNAN || x->class == CLASS_QNAN;
|
|
|
|
}
|
|
|
|
|
|
|
|
INLINE
|
|
|
|
static int
|
|
|
|
isinf ( fp_number_type * x)
|
|
|
|
{
|
|
|
|
return x->class == CLASS_INFINITY;
|
|
|
|
}
|
|
|
|
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* NO_NANS */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
INLINE
|
|
|
|
static int
|
|
|
|
iszero ( fp_number_type * x)
|
|
|
|
{
|
|
|
|
return x->class == CLASS_ZERO;
|
|
|
|
}
|
|
|
|
|
|
|
|
INLINE
|
|
|
|
static void
|
|
|
|
flip_sign ( fp_number_type * x)
|
|
|
|
{
|
|
|
|
x->sign = !x->sign;
|
|
|
|
}
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
extern FLO_type pack_d ( fp_number_type * );
|
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf)
|
1997-12-21 14:45:24 +01:00
|
|
|
FLO_type
|
1994-07-12 00:32:24 +02:00
|
|
|
pack_d ( fp_number_type * src)
|
|
|
|
{
|
|
|
|
FLO_union_type dst;
|
|
|
|
fractype fraction = src->fraction.ll; /* wasn't unsigned before? */
|
1995-09-12 00:48:01 +02:00
|
|
|
int sign = src->sign;
|
|
|
|
int exp = 0;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src)))
|
|
|
|
{
|
|
|
|
/* We can't represent these values accurately. By using the
|
|
|
|
largest possible magnitude, we guarantee that the conversion
|
|
|
|
of infinity is at least as big as any finite number. */
|
|
|
|
exp = EXPMAX;
|
|
|
|
fraction = ((fractype) 1 << FRACBITS) - 1;
|
|
|
|
}
|
|
|
|
else if (isnan (src))
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
1995-09-12 00:48:01 +02:00
|
|
|
exp = EXPMAX;
|
1994-07-12 00:32:24 +02:00
|
|
|
if (src->class == CLASS_QNAN || 1)
|
|
|
|
{
|
real.h (EXP_BITS): Make room for...
* real.h (EXP_BITS): Make room for...
(struct real_value): ... added canonical bit.
(struct real_format): Added pnan.
(mips_single_format, mips_double_format, mips_extended_format,
mips_quad_format): New.
* real.c: Copy p to pnan in all formats.
(get_canonical_qnan, get_canonical_snan): Set canonical bit.
(real_nan): Use pnan to compute significand's shift.
(real_identical): Disregard significand in canonical
NaNs.
(real_hash): Likewise. Take signalling into account.
(encode_ieee_single, encode_ieee_double, encode_ieee_quad):
Disregard significand bits in canonical NaNs. Set all bits of
canonical NaN if !qnan_msb_set.
(encode_ibm_extended, decode_ibm_extended): Likewise. Use
qnan_msb_set to tell the base double format.
(ibm_extended_format): Use 53 as pnan.
(mips_single_format, mips_double_format, mips_extended_format,
mips_quad_format): Copied from the corresponding ieee/ibm
formats, with qnan_msb_set false.
* config/mips/iris6.h (MIPS_TFMODE_FORMAT): Use mips_extended_format.
* config/mips/linux64.h (MIPS_TFMODE_FORMAT): Use mips_quad_format.
* config/mips/mips.c (override_options): Use mips_single_format
and mips_double_format. Default TFmode to mips_quad_format.
* config/mips/t-linux64 (tp-bit.c): Define QUIET_NAN_NEGATED.
* config/mips/t-irix6: Likewise.
* config/mips/t-mips (fp-bit.c, dp-bit.c): Likewise.
* config/fp-bit.c (pack_d, unpack_d): Obey it.
From-SVN: r65146
2003-04-01 23:45:28 +02:00
|
|
|
#ifdef QUIET_NAN_NEGATED
|
|
|
|
fraction |= QUIET_NAN - 1;
|
|
|
|
#else
|
1995-09-12 00:48:01 +02:00
|
|
|
fraction |= QUIET_NAN;
|
real.h (EXP_BITS): Make room for...
* real.h (EXP_BITS): Make room for...
(struct real_value): ... added canonical bit.
(struct real_format): Added pnan.
(mips_single_format, mips_double_format, mips_extended_format,
mips_quad_format): New.
* real.c: Copy p to pnan in all formats.
(get_canonical_qnan, get_canonical_snan): Set canonical bit.
(real_nan): Use pnan to compute significand's shift.
(real_identical): Disregard significand in canonical
NaNs.
(real_hash): Likewise. Take signalling into account.
(encode_ieee_single, encode_ieee_double, encode_ieee_quad):
Disregard significand bits in canonical NaNs. Set all bits of
canonical NaN if !qnan_msb_set.
(encode_ibm_extended, decode_ibm_extended): Likewise. Use
qnan_msb_set to tell the base double format.
(ibm_extended_format): Use 53 as pnan.
(mips_single_format, mips_double_format, mips_extended_format,
mips_quad_format): Copied from the corresponding ieee/ibm
formats, with qnan_msb_set false.
* config/mips/iris6.h (MIPS_TFMODE_FORMAT): Use mips_extended_format.
* config/mips/linux64.h (MIPS_TFMODE_FORMAT): Use mips_quad_format.
* config/mips/mips.c (override_options): Use mips_single_format
and mips_double_format. Default TFmode to mips_quad_format.
* config/mips/t-linux64 (tp-bit.c): Define QUIET_NAN_NEGATED.
* config/mips/t-irix6: Likewise.
* config/mips/t-mips (fp-bit.c, dp-bit.c): Likewise.
* config/fp-bit.c (pack_d, unpack_d): Obey it.
From-SVN: r65146
2003-04-01 23:45:28 +02:00
|
|
|
#endif
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (isinf (src))
|
|
|
|
{
|
1995-09-12 00:48:01 +02:00
|
|
|
exp = EXPMAX;
|
|
|
|
fraction = 0;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
else if (iszero (src))
|
|
|
|
{
|
1995-09-12 00:48:01 +02:00
|
|
|
exp = 0;
|
|
|
|
fraction = 0;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
else if (fraction == 0)
|
|
|
|
{
|
1995-09-12 00:48:01 +02:00
|
|
|
exp = 0;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (src->normal_exp < NORMAL_EXPMIN)
|
|
|
|
{
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
#ifdef NO_DENORMALS
|
|
|
|
/* Go straight to a zero representation if denormals are not
|
|
|
|
supported. The denormal handling would be harmless but
|
|
|
|
isn't unnecessary. */
|
|
|
|
exp = 0;
|
|
|
|
fraction = 0;
|
|
|
|
#else /* NO_DENORMALS */
|
1994-07-12 00:32:24 +02:00
|
|
|
/* This number's exponent is too low to fit into the bits
|
|
|
|
available in the number, so we'll store 0 in the exponent and
|
|
|
|
shift the fraction to the right to make up for it. */
|
|
|
|
|
|
|
|
int shift = NORMAL_EXPMIN - src->normal_exp;
|
|
|
|
|
1995-09-12 00:48:01 +02:00
|
|
|
exp = 0;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (shift > FRAC_NBITS - NGARDS)
|
|
|
|
{
|
|
|
|
/* No point shifting, since it's more that 64 out. */
|
|
|
|
fraction = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-12 07:59:23 +01:00
|
|
|
int lowbit = (fraction & (((fractype)1 << shift) - 1)) ? 1 : 0;
|
2000-02-26 21:03:11 +01:00
|
|
|
fraction = (fraction >> shift) | lowbit;
|
|
|
|
}
|
|
|
|
if ((fraction & GARDMASK) == GARDMSB)
|
|
|
|
{
|
|
|
|
if ((fraction & (1 << NGARDS)))
|
|
|
|
fraction += GARDROUND + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Add to the guards to round up. */
|
|
|
|
fraction += GARDROUND;
|
|
|
|
}
|
|
|
|
/* Perhaps the rounding means we now need to change the
|
2000-03-23 00:16:21 +01:00
|
|
|
exponent, because the fraction is no longer denormal. */
|
|
|
|
if (fraction >= IMPLICIT_1)
|
2000-02-26 21:03:11 +01:00
|
|
|
{
|
|
|
|
exp += 1;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
fraction >>= NGARDS;
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
#endif /* NO_DENORMALS */
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS)
|
|
|
|
&& src->normal_exp > EXPBIAS)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
1995-09-12 00:48:01 +02:00
|
|
|
exp = EXPMAX;
|
|
|
|
fraction = 0;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1995-09-12 00:48:01 +02:00
|
|
|
exp = src->normal_exp + EXPBIAS;
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
if (!ROUND_TOWARDS_ZERO)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
/* IF the gard bits are the all zero, but the first, then we're
|
|
|
|
half way between two numbers, choose the one which makes the
|
|
|
|
lsb of the answer 0. */
|
|
|
|
if ((fraction & GARDMASK) == GARDMSB)
|
|
|
|
{
|
|
|
|
if (fraction & (1 << NGARDS))
|
|
|
|
fraction += GARDROUND + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Add a one to the guards to round up */
|
|
|
|
fraction += GARDROUND;
|
|
|
|
}
|
|
|
|
if (fraction >= IMPLICIT_2)
|
|
|
|
{
|
|
|
|
fraction >>= 1;
|
|
|
|
exp += 1;
|
|
|
|
}
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
fraction >>= NGARDS;
|
|
|
|
|
|
|
|
if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
/* Saturate on overflow. */
|
|
|
|
exp = EXPMAX;
|
|
|
|
fraction = ((fractype) 1 << FRACBITS) - 1;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1995-09-12 00:48:01 +02:00
|
|
|
|
|
|
|
/* We previously used bitfields to store the number, but this doesn't
|
1997-12-21 14:45:24 +01:00
|
|
|
handle little/big endian systems conveniently, so use shifts and
|
1995-09-12 00:48:01 +02:00
|
|
|
masks */
|
1995-09-15 23:06:46 +02:00
|
|
|
#ifdef FLOAT_BIT_ORDER_MISMATCH
|
1995-09-12 00:53:34 +02:00
|
|
|
dst.bits.fraction = fraction;
|
|
|
|
dst.bits.exp = exp;
|
|
|
|
dst.bits.sign = sign;
|
|
|
|
#else
|
2003-01-26 11:06:57 +01:00
|
|
|
# if defined TFLOAT && defined HALFFRACBITS
|
|
|
|
{
|
|
|
|
halffractype high, low;
|
|
|
|
|
|
|
|
high = (fraction >> (FRACBITS - HALFFRACBITS));
|
|
|
|
high &= (((fractype)1) << HALFFRACBITS) - 1;
|
|
|
|
high |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << HALFFRACBITS;
|
|
|
|
high |= ((fractype) (sign & 1)) << (HALFFRACBITS | EXPBITS);
|
|
|
|
|
|
|
|
low = (halffractype)fraction &
|
|
|
|
((((halffractype)1) << (FRACBITS - HALFFRACBITS)) - 1);
|
|
|
|
|
|
|
|
if (exp == EXPMAX || exp == 0 || low == 0)
|
|
|
|
low = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
exp -= HALFFRACBITS + 1;
|
|
|
|
|
|
|
|
while (exp > 0
|
|
|
|
&& low < ((halffractype)1 << HALFFRACBITS))
|
|
|
|
{
|
|
|
|
low <<= 1;
|
|
|
|
exp--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (exp <= 0)
|
|
|
|
{
|
|
|
|
halffractype roundmsb, round;
|
|
|
|
|
|
|
|
exp = -exp + 1;
|
|
|
|
|
|
|
|
roundmsb = (1 << (exp - 1));
|
|
|
|
round = low & ((roundmsb << 1) - 1);
|
|
|
|
|
|
|
|
low >>= exp;
|
|
|
|
exp = 0;
|
|
|
|
|
|
|
|
if (round > roundmsb || (round == roundmsb && (low & 1)))
|
|
|
|
{
|
|
|
|
low++;
|
|
|
|
if (low >= ((halffractype)1 << HALFFRACBITS))
|
|
|
|
/* We don't shift left, since it has just become the
|
|
|
|
smallest normal number, whose implicit 1 bit is
|
|
|
|
now indicated by the non-zero exponent. */
|
|
|
|
exp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
low &= ((halffractype)1 << HALFFRACBITS) - 1;
|
|
|
|
low |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << HALFFRACBITS;
|
|
|
|
low |= ((fractype) (sign & 1)) << (HALFFRACBITS | EXPBITS);
|
|
|
|
}
|
|
|
|
|
|
|
|
dst.value_raw = (((fractype) high) << HALFSHIFT) | low;
|
|
|
|
}
|
|
|
|
# else
|
1995-09-12 00:48:01 +02:00
|
|
|
dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1);
|
|
|
|
dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS;
|
|
|
|
dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS);
|
2003-01-26 11:06:57 +01:00
|
|
|
# endif
|
1995-09-12 00:53:34 +02:00
|
|
|
#endif
|
|
|
|
|
1995-09-15 23:06:46 +02:00
|
|
|
#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT)
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#ifdef TFLOAT
|
|
|
|
{
|
|
|
|
qrtrfractype tmp1 = dst.words[0];
|
|
|
|
qrtrfractype tmp2 = dst.words[1];
|
|
|
|
dst.words[0] = dst.words[3];
|
|
|
|
dst.words[1] = dst.words[2];
|
|
|
|
dst.words[2] = tmp2;
|
|
|
|
dst.words[3] = tmp1;
|
|
|
|
}
|
|
|
|
#else
|
1995-09-15 23:06:46 +02:00
|
|
|
{
|
|
|
|
halffractype tmp = dst.words[0];
|
|
|
|
dst.words[0] = dst.words[1];
|
|
|
|
dst.words[1] = tmp;
|
|
|
|
}
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#endif
|
1995-09-15 23:06:46 +02:00
|
|
|
#endif
|
|
|
|
|
1994-07-12 00:32:24 +02:00
|
|
|
return dst.value;
|
|
|
|
}
|
1997-12-21 14:45:24 +01:00
|
|
|
#endif
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_unpack_df) || defined(L_unpack_sf) || defined(L_unpack_tf)
|
1997-12-21 14:45:24 +01:00
|
|
|
void
|
1994-07-12 00:32:24 +02:00
|
|
|
unpack_d (FLO_union_type * src, fp_number_type * dst)
|
|
|
|
{
|
1995-09-12 00:48:01 +02:00
|
|
|
/* We previously used bitfields to store the number, but this doesn't
|
1997-12-21 14:45:24 +01:00
|
|
|
handle little/big endian systems conveniently, so use shifts and
|
1995-09-12 00:48:01 +02:00
|
|
|
masks */
|
1995-09-12 00:53:34 +02:00
|
|
|
fractype fraction;
|
|
|
|
int exp;
|
|
|
|
int sign;
|
|
|
|
|
1995-09-15 23:06:46 +02:00
|
|
|
#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT)
|
|
|
|
FLO_union_type swapped;
|
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#ifdef TFLOAT
|
|
|
|
swapped.words[0] = src->words[3];
|
|
|
|
swapped.words[1] = src->words[2];
|
|
|
|
swapped.words[2] = src->words[1];
|
|
|
|
swapped.words[3] = src->words[0];
|
|
|
|
#else
|
1995-09-15 23:06:46 +02:00
|
|
|
swapped.words[0] = src->words[1];
|
|
|
|
swapped.words[1] = src->words[0];
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#endif
|
1995-09-15 23:06:46 +02:00
|
|
|
src = &swapped;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FLOAT_BIT_ORDER_MISMATCH
|
1995-09-12 00:53:34 +02:00
|
|
|
fraction = src->bits.fraction;
|
|
|
|
exp = src->bits.exp;
|
|
|
|
sign = src->bits.sign;
|
|
|
|
#else
|
2003-01-26 11:06:57 +01:00
|
|
|
# if defined TFLOAT && defined HALFFRACBITS
|
|
|
|
{
|
|
|
|
halffractype high, low;
|
|
|
|
|
|
|
|
high = src->value_raw >> HALFSHIFT;
|
|
|
|
low = src->value_raw & (((fractype)1 << HALFSHIFT) - 1);
|
|
|
|
|
|
|
|
fraction = high & ((((fractype)1) << HALFFRACBITS) - 1);
|
|
|
|
fraction <<= FRACBITS - HALFFRACBITS;
|
|
|
|
exp = ((int)(high >> HALFFRACBITS)) & ((1 << EXPBITS) - 1);
|
|
|
|
sign = ((int)(high >> (((HALFFRACBITS + EXPBITS))))) & 1;
|
|
|
|
|
|
|
|
if (exp != EXPMAX && exp != 0 && low != 0)
|
|
|
|
{
|
|
|
|
int lowexp = ((int)(low >> HALFFRACBITS)) & ((1 << EXPBITS) - 1);
|
|
|
|
int shift;
|
|
|
|
fractype xlow;
|
|
|
|
|
|
|
|
xlow = low & ((((fractype)1) << HALFFRACBITS) - 1);
|
|
|
|
if (lowexp)
|
|
|
|
xlow |= (((halffractype)1) << HALFFRACBITS);
|
|
|
|
else
|
|
|
|
lowexp = 1;
|
|
|
|
shift = (FRACBITS - HALFFRACBITS) - (exp - lowexp);
|
|
|
|
if (shift > 0)
|
|
|
|
xlow <<= shift;
|
|
|
|
else if (shift < 0)
|
|
|
|
xlow >>= -shift;
|
|
|
|
fraction += xlow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# else
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
fraction = src->value_raw & ((((fractype)1) << FRACBITS) - 1);
|
1995-09-12 00:53:34 +02:00
|
|
|
exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1);
|
|
|
|
sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1;
|
2003-01-26 11:06:57 +01:00
|
|
|
# endif
|
1995-09-12 00:53:34 +02:00
|
|
|
#endif
|
1995-09-12 00:48:01 +02:00
|
|
|
|
|
|
|
dst->sign = sign;
|
|
|
|
if (exp == 0)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
|
|
|
/* Hmm. Looks like 0 */
|
2000-03-16 18:20:57 +01:00
|
|
|
if (fraction == 0
|
|
|
|
#ifdef NO_DENORMALS
|
|
|
|
|| 1
|
|
|
|
#endif
|
|
|
|
)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
|
|
|
/* tastes like zero */
|
|
|
|
dst->class = CLASS_ZERO;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-09-14 15:12:56 +02:00
|
|
|
/* Zero exponent with nonzero fraction - it's denormalized,
|
1994-07-12 00:32:24 +02:00
|
|
|
so there isn't a leading implicit one - we'll shift it so
|
|
|
|
it gets one. */
|
1995-09-12 00:48:01 +02:00
|
|
|
dst->normal_exp = exp - EXPBIAS + 1;
|
1994-07-12 00:32:24 +02:00
|
|
|
fraction <<= NGARDS;
|
|
|
|
|
|
|
|
dst->class = CLASS_NUMBER;
|
|
|
|
#if 1
|
|
|
|
while (fraction < IMPLICIT_1)
|
|
|
|
{
|
|
|
|
fraction <<= 1;
|
|
|
|
dst->normal_exp--;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
dst->fraction.ll = fraction;
|
|
|
|
}
|
|
|
|
}
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp == EXPMAX)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
|
|
|
/* Huge exponent*/
|
|
|
|
if (fraction == 0)
|
|
|
|
{
|
1995-05-16 14:14:26 +02:00
|
|
|
/* Attached to a zero fraction - means infinity */
|
1994-07-12 00:32:24 +02:00
|
|
|
dst->class = CLASS_INFINITY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-09-14 15:12:56 +02:00
|
|
|
/* Nonzero fraction, means nan */
|
real.h (EXP_BITS): Make room for...
* real.h (EXP_BITS): Make room for...
(struct real_value): ... added canonical bit.
(struct real_format): Added pnan.
(mips_single_format, mips_double_format, mips_extended_format,
mips_quad_format): New.
* real.c: Copy p to pnan in all formats.
(get_canonical_qnan, get_canonical_snan): Set canonical bit.
(real_nan): Use pnan to compute significand's shift.
(real_identical): Disregard significand in canonical
NaNs.
(real_hash): Likewise. Take signalling into account.
(encode_ieee_single, encode_ieee_double, encode_ieee_quad):
Disregard significand bits in canonical NaNs. Set all bits of
canonical NaN if !qnan_msb_set.
(encode_ibm_extended, decode_ibm_extended): Likewise. Use
qnan_msb_set to tell the base double format.
(ibm_extended_format): Use 53 as pnan.
(mips_single_format, mips_double_format, mips_extended_format,
mips_quad_format): Copied from the corresponding ieee/ibm
formats, with qnan_msb_set false.
* config/mips/iris6.h (MIPS_TFMODE_FORMAT): Use mips_extended_format.
* config/mips/linux64.h (MIPS_TFMODE_FORMAT): Use mips_quad_format.
* config/mips/mips.c (override_options): Use mips_single_format
and mips_double_format. Default TFmode to mips_quad_format.
* config/mips/t-linux64 (tp-bit.c): Define QUIET_NAN_NEGATED.
* config/mips/t-irix6: Likewise.
* config/mips/t-mips (fp-bit.c, dp-bit.c): Likewise.
* config/fp-bit.c (pack_d, unpack_d): Obey it.
From-SVN: r65146
2003-04-01 23:45:28 +02:00
|
|
|
#ifdef QUIET_NAN_NEGATED
|
|
|
|
if ((fraction & QUIET_NAN) == 0)
|
|
|
|
#else
|
1997-07-03 23:37:23 +02:00
|
|
|
if (fraction & QUIET_NAN)
|
real.h (EXP_BITS): Make room for...
* real.h (EXP_BITS): Make room for...
(struct real_value): ... added canonical bit.
(struct real_format): Added pnan.
(mips_single_format, mips_double_format, mips_extended_format,
mips_quad_format): New.
* real.c: Copy p to pnan in all formats.
(get_canonical_qnan, get_canonical_snan): Set canonical bit.
(real_nan): Use pnan to compute significand's shift.
(real_identical): Disregard significand in canonical
NaNs.
(real_hash): Likewise. Take signalling into account.
(encode_ieee_single, encode_ieee_double, encode_ieee_quad):
Disregard significand bits in canonical NaNs. Set all bits of
canonical NaN if !qnan_msb_set.
(encode_ibm_extended, decode_ibm_extended): Likewise. Use
qnan_msb_set to tell the base double format.
(ibm_extended_format): Use 53 as pnan.
(mips_single_format, mips_double_format, mips_extended_format,
mips_quad_format): Copied from the corresponding ieee/ibm
formats, with qnan_msb_set false.
* config/mips/iris6.h (MIPS_TFMODE_FORMAT): Use mips_extended_format.
* config/mips/linux64.h (MIPS_TFMODE_FORMAT): Use mips_quad_format.
* config/mips/mips.c (override_options): Use mips_single_format
and mips_double_format. Default TFmode to mips_quad_format.
* config/mips/t-linux64 (tp-bit.c): Define QUIET_NAN_NEGATED.
* config/mips/t-irix6: Likewise.
* config/mips/t-mips (fp-bit.c, dp-bit.c): Likewise.
* config/fp-bit.c (pack_d, unpack_d): Obey it.
From-SVN: r65146
2003-04-01 23:45:28 +02:00
|
|
|
#endif
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
1997-07-03 23:37:23 +02:00
|
|
|
dst->class = CLASS_QNAN;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1997-07-03 23:37:23 +02:00
|
|
|
dst->class = CLASS_SNAN;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
/* Keep the fraction part as the nan number */
|
|
|
|
dst->fraction.ll = fraction;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Nothing strange about this number */
|
1995-09-12 00:48:01 +02:00
|
|
|
dst->normal_exp = exp - EXPBIAS;
|
1994-07-12 00:32:24 +02:00
|
|
|
dst->class = CLASS_NUMBER;
|
|
|
|
dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1;
|
|
|
|
}
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_unpack_df || L_unpack_sf */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_addsub_sf) || defined(L_addsub_df) || defined(L_addsub_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
static fp_number_type *
|
|
|
|
_fpadd_parts (fp_number_type * a,
|
|
|
|
fp_number_type * b,
|
|
|
|
fp_number_type * tmp)
|
|
|
|
{
|
|
|
|
intfrac tfraction;
|
|
|
|
|
|
|
|
/* Put commonly used fields in local variables. */
|
|
|
|
int a_normal_exp;
|
|
|
|
int b_normal_exp;
|
|
|
|
fractype a_fraction;
|
|
|
|
fractype b_fraction;
|
|
|
|
|
|
|
|
if (isnan (a))
|
|
|
|
{
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (isnan (b))
|
|
|
|
{
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
if (isinf (a))
|
|
|
|
{
|
1994-12-19 21:48:30 +01:00
|
|
|
/* Adding infinities with opposite signs yields a NaN. */
|
|
|
|
if (isinf (b) && a->sign != b->sign)
|
|
|
|
return nan ();
|
1994-07-12 00:32:24 +02:00
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (isinf (b))
|
|
|
|
{
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
if (iszero (b))
|
|
|
|
{
|
1998-06-01 11:15:23 +02:00
|
|
|
if (iszero (a))
|
|
|
|
{
|
|
|
|
*tmp = *a;
|
|
|
|
tmp->sign = a->sign & b->sign;
|
|
|
|
return tmp;
|
|
|
|
}
|
1994-07-12 00:32:24 +02:00
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (iszero (a))
|
|
|
|
{
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Got two numbers. shift the smaller and increment the exponent till
|
|
|
|
they're the same */
|
|
|
|
{
|
|
|
|
int diff;
|
|
|
|
|
|
|
|
a_normal_exp = a->normal_exp;
|
|
|
|
b_normal_exp = b->normal_exp;
|
|
|
|
a_fraction = a->fraction.ll;
|
|
|
|
b_fraction = b->fraction.ll;
|
|
|
|
|
|
|
|
diff = a_normal_exp - b_normal_exp;
|
|
|
|
|
|
|
|
if (diff < 0)
|
|
|
|
diff = -diff;
|
|
|
|
if (diff < FRAC_NBITS)
|
|
|
|
{
|
|
|
|
/* ??? This does shifts one bit at a time. Optimize. */
|
|
|
|
while (a_normal_exp > b_normal_exp)
|
|
|
|
{
|
|
|
|
b_normal_exp++;
|
|
|
|
LSHIFT (b_fraction);
|
|
|
|
}
|
|
|
|
while (b_normal_exp > a_normal_exp)
|
|
|
|
{
|
|
|
|
a_normal_exp++;
|
|
|
|
LSHIFT (a_fraction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Somethings's up.. choose the biggest */
|
|
|
|
if (a_normal_exp > b_normal_exp)
|
|
|
|
{
|
|
|
|
b_normal_exp = a_normal_exp;
|
|
|
|
b_fraction = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
a_normal_exp = b_normal_exp;
|
|
|
|
a_fraction = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a->sign != b->sign)
|
|
|
|
{
|
|
|
|
if (a->sign)
|
|
|
|
{
|
|
|
|
tfraction = -a_fraction + b_fraction;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tfraction = a_fraction - b_fraction;
|
|
|
|
}
|
1998-09-19 23:44:10 +02:00
|
|
|
if (tfraction >= 0)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
|
|
|
tmp->sign = 0;
|
|
|
|
tmp->normal_exp = a_normal_exp;
|
|
|
|
tmp->fraction.ll = tfraction;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tmp->sign = 1;
|
|
|
|
tmp->normal_exp = a_normal_exp;
|
|
|
|
tmp->fraction.ll = -tfraction;
|
|
|
|
}
|
1995-05-16 14:14:26 +02:00
|
|
|
/* and renormalize it */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll)
|
|
|
|
{
|
|
|
|
tmp->fraction.ll <<= 1;
|
|
|
|
tmp->normal_exp--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tmp->sign = a->sign;
|
|
|
|
tmp->normal_exp = a_normal_exp;
|
|
|
|
tmp->fraction.ll = a_fraction + b_fraction;
|
|
|
|
}
|
|
|
|
tmp->class = CLASS_NUMBER;
|
|
|
|
/* Now the fraction is added, we have to shift down to renormalize the
|
|
|
|
number */
|
|
|
|
|
|
|
|
if (tmp->fraction.ll >= IMPLICIT_2)
|
|
|
|
{
|
|
|
|
LSHIFT (tmp->fraction.ll);
|
|
|
|
tmp->normal_exp++;
|
|
|
|
}
|
|
|
|
return tmp;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
FLO_type
|
|
|
|
add (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
|
|
|
fp_number_type tmp;
|
|
|
|
fp_number_type *res;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
|
|
|
|
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
res = _fpadd_parts (&a, &b, &tmp);
|
|
|
|
|
|
|
|
return pack_d (res);
|
|
|
|
}
|
|
|
|
|
|
|
|
FLO_type
|
|
|
|
sub (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
|
|
|
fp_number_type tmp;
|
|
|
|
fp_number_type *res;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
b.sign ^= 1;
|
|
|
|
|
|
|
|
res = _fpadd_parts (&a, &b, &tmp);
|
|
|
|
|
|
|
|
return pack_d (res);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_addsub_sf || L_addsub_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_mul_sf) || defined(L_mul_df) || defined(L_mul_tf)
|
2002-06-19 02:51:03 +02:00
|
|
|
static inline __attribute__ ((__always_inline__)) fp_number_type *
|
1994-07-12 00:32:24 +02:00
|
|
|
_fpmul_parts ( fp_number_type * a,
|
|
|
|
fp_number_type * b,
|
|
|
|
fp_number_type * tmp)
|
|
|
|
{
|
|
|
|
fractype low = 0;
|
|
|
|
fractype high = 0;
|
|
|
|
|
|
|
|
if (isnan (a))
|
|
|
|
{
|
|
|
|
a->sign = a->sign != b->sign;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (isnan (b))
|
|
|
|
{
|
|
|
|
b->sign = a->sign != b->sign;
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
if (isinf (a))
|
|
|
|
{
|
|
|
|
if (iszero (b))
|
|
|
|
return nan ();
|
|
|
|
a->sign = a->sign != b->sign;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (isinf (b))
|
|
|
|
{
|
|
|
|
if (iszero (a))
|
|
|
|
{
|
|
|
|
return nan ();
|
|
|
|
}
|
|
|
|
b->sign = a->sign != b->sign;
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
if (iszero (a))
|
|
|
|
{
|
|
|
|
a->sign = a->sign != b->sign;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (iszero (b))
|
|
|
|
{
|
|
|
|
b->sign = a->sign != b->sign;
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
2001-02-02 12:02:05 +01:00
|
|
|
/* Calculate the mantissa by multiplying both numbers to get a
|
|
|
|
twice-as-wide number. */
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(NO_DI_MODE) || defined(TFLOAT)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
Warning fixes:
* Makefile.in (xcoffout.o): Depend on toplev.h, output.h and dbxout.h.
* config/fp-bit.c (_fpmul_parts): Move variables `x', `ylow',
`yhigh' and `bit' into the scope in which they are used.
(_fpdiv_parts): Remove unused variables `low', `high', `r0', `r1',
`y0', `y1', `q', `remainder', `carry', `d0' and `d1'.
* rs6000.c: Move include of output.h below tree.h. Include toplev.h.
(any_operand): Mark unused parameters `op' and `mode' with
ATTRIBUTE_UNUSED.
(count_register_operand): Likewise for parameter `mode'.
(fpmem_operand): Likewise.
(short_cint_operand): Likewise.
(u_short_cint_operand): Likewise.
(non_short_cint_operand): Likewise.
(got_operand): Likewise.
(got_no_const_operand): Likewise.
(non_add_cint_operand): Likewise.
(non_logical_cint_operand): Likewise.
(mask_operand): Likewise.
(current_file_function_operand): Likewise.
(small_data_operand): Likewise for parameters `op' and `mode' but
only when !TARGET_ELF.
(init_cumulative_args): Mark parameters `libname' with
ATTRIBUTE_UNUSED.
(function_arg_pass_by_reference): Likewise for parameters `cum',
`mode' and `named'.
(expand_builtin_saveregs): Likewise for parameter `args'.
(load_multiple_operation): Likewise for parameter `mode'.
(store_multiple_operation): Likewise.
(branch_comparison_operator): Likewise.
(secondary_reload_class): Likewise.
(print_operand): Add parentheses around & operation.
(output_prolog): Mark parameter `size' with ATTRIBUTE_UNUSED.
(output_epilog): Likewise. Cast argument to fprintf to int.
(rs6000_adjust_cost): Mark parameter `dep_insn' with ATTRIBUTE_UNUSED.
(rs6000_valid_decl_attribute_p): Likewise for parameters `decl',
`attributes', `identifier' and `args'.
(rs6000_valid_type_attribute_p): Likewise for parameter `attributes'.
(rs6000_comp_type_attributes): Likewise for parameters `type1' and
`type2'.
(rs6000_set_default_type_attributes): Likewise for parameter `type'.
* rs6000.h (RTX_COSTS): Add parentheses around & operation.
(toc_section, private_data_section, trap_comparison_operator): Add
prototypes.
* dbxout.h (dbxout_parms, dbxout_reg_parms, dbxout_syms): Add
prototypes.
* xcoffout.c: Include toplev.h, outout.h and dbxout.h.
* xcoffout.h (stab_to_sclass, xcoffout_begin_function,
xcoffout_begin_block, xcoffout_end_epilogue,
xcoffout_end_function, xcoffout_end_block,
xcoff_output_standard_types, xcoffout_declare_function,
xcoffout_source_line): Add prototypes.
From-SVN: r20717
1998-06-25 15:05:20 +02:00
|
|
|
fractype x = a->fraction.ll;
|
|
|
|
fractype ylow = b->fraction.ll;
|
|
|
|
fractype yhigh = 0;
|
|
|
|
int bit;
|
|
|
|
|
1994-07-12 00:32:24 +02:00
|
|
|
/* ??? This does multiplies one bit at a time. Optimize. */
|
|
|
|
for (bit = 0; bit < FRAC_NBITS; bit++)
|
|
|
|
{
|
|
|
|
int carry;
|
|
|
|
|
|
|
|
if (x & 1)
|
|
|
|
{
|
|
|
|
carry = (low += ylow) < ylow;
|
|
|
|
high += yhigh + carry;
|
|
|
|
}
|
|
|
|
yhigh <<= 1;
|
|
|
|
if (ylow & FRACHIGH)
|
|
|
|
{
|
|
|
|
yhigh |= 1;
|
|
|
|
}
|
|
|
|
ylow <<= 1;
|
|
|
|
x >>= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#elif defined(FLOAT)
|
2001-02-02 12:02:05 +01:00
|
|
|
/* Multiplying two USIs to get a UDI, we're safe. */
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
2001-02-02 12:02:05 +01:00
|
|
|
UDItype answer = (UDItype)a->fraction.ll * (UDItype)b->fraction.ll;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
2001-02-02 12:02:05 +01:00
|
|
|
high = answer >> BITS_PER_SI;
|
1994-07-12 00:32:24 +02:00
|
|
|
low = answer;
|
|
|
|
}
|
|
|
|
#else
|
2001-02-02 12:02:05 +01:00
|
|
|
/* fractype is DImode, but we need the result to be twice as wide.
|
|
|
|
Assuming a widening multiply from DImode to TImode is not
|
|
|
|
available, build one by hand. */
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
2001-02-02 12:02:05 +01:00
|
|
|
USItype nl = a->fraction.ll;
|
|
|
|
USItype nh = a->fraction.ll >> BITS_PER_SI;
|
|
|
|
USItype ml = b->fraction.ll;
|
|
|
|
USItype mh = b->fraction.ll >> BITS_PER_SI;
|
2000-12-08 10:14:03 +01:00
|
|
|
UDItype pp_ll = (UDItype) ml * nl;
|
|
|
|
UDItype pp_hl = (UDItype) mh * nl;
|
|
|
|
UDItype pp_lh = (UDItype) ml * nh;
|
|
|
|
UDItype pp_hh = (UDItype) mh * nh;
|
1994-07-12 00:32:24 +02:00
|
|
|
UDItype res2 = 0;
|
|
|
|
UDItype res0 = 0;
|
|
|
|
UDItype ps_hh__ = pp_hl + pp_lh;
|
|
|
|
if (ps_hh__ < pp_hl)
|
2001-02-02 12:02:05 +01:00
|
|
|
res2 += (UDItype)1 << BITS_PER_SI;
|
|
|
|
pp_hl = (UDItype)(USItype)ps_hh__ << BITS_PER_SI;
|
1994-07-12 00:32:24 +02:00
|
|
|
res0 = pp_ll + pp_hl;
|
|
|
|
if (res0 < pp_ll)
|
|
|
|
res2++;
|
2001-02-02 12:02:05 +01:00
|
|
|
res2 += (ps_hh__ >> BITS_PER_SI) + pp_hh;
|
1994-07-12 00:32:24 +02:00
|
|
|
high = res2;
|
|
|
|
low = res0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
tmp->normal_exp = a->normal_exp + b->normal_exp
|
|
|
|
+ FRAC_NBITS - (FRACBITS + NGARDS);
|
1994-07-12 00:32:24 +02:00
|
|
|
tmp->sign = a->sign != b->sign;
|
|
|
|
while (high >= IMPLICIT_2)
|
|
|
|
{
|
|
|
|
tmp->normal_exp++;
|
|
|
|
if (high & 1)
|
|
|
|
{
|
|
|
|
low >>= 1;
|
|
|
|
low |= FRACHIGH;
|
|
|
|
}
|
|
|
|
high >>= 1;
|
|
|
|
}
|
|
|
|
while (high < IMPLICIT_1)
|
|
|
|
{
|
|
|
|
tmp->normal_exp--;
|
|
|
|
|
|
|
|
high <<= 1;
|
|
|
|
if (low & FRACHIGH)
|
|
|
|
high |= 1;
|
|
|
|
low <<= 1;
|
|
|
|
}
|
2002-09-29 15:16:44 +02:00
|
|
|
/* rounding is tricky. if we only round if it won't make us round later. */
|
1994-07-12 00:32:24 +02:00
|
|
|
#if 0
|
|
|
|
if (low & FRACHIGH2)
|
|
|
|
{
|
|
|
|
if (((high & GARDMASK) != GARDMSB)
|
|
|
|
&& (((high + 1) & GARDMASK) == GARDMSB))
|
|
|
|
{
|
2002-09-29 15:16:44 +02:00
|
|
|
/* don't round, it gets done again later. */
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
high++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
|
|
|
if (high & (1 << NGARDS))
|
|
|
|
{
|
|
|
|
/* half way, so round to even */
|
|
|
|
high += GARDROUND + 1;
|
|
|
|
}
|
|
|
|
else if (low)
|
|
|
|
{
|
|
|
|
/* but we really weren't half way */
|
|
|
|
high += GARDROUND + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tmp->fraction.ll = high;
|
|
|
|
tmp->class = CLASS_NUMBER;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
FLO_type
|
|
|
|
multiply (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
|
|
|
fp_number_type tmp;
|
|
|
|
fp_number_type *res;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
|
|
|
|
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
res = _fpmul_parts (&a, &b, &tmp);
|
|
|
|
|
|
|
|
return pack_d (res);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_mul_sf || L_mul_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_div_sf) || defined(L_div_df) || defined(L_div_tf)
|
2002-06-19 02:51:03 +02:00
|
|
|
static inline __attribute__ ((__always_inline__)) fp_number_type *
|
1994-07-12 00:32:24 +02:00
|
|
|
_fpdiv_parts (fp_number_type * a,
|
1998-10-09 21:17:54 +02:00
|
|
|
fp_number_type * b)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
Warning fixes:
* Makefile.in (xcoffout.o): Depend on toplev.h, output.h and dbxout.h.
* config/fp-bit.c (_fpmul_parts): Move variables `x', `ylow',
`yhigh' and `bit' into the scope in which they are used.
(_fpdiv_parts): Remove unused variables `low', `high', `r0', `r1',
`y0', `y1', `q', `remainder', `carry', `d0' and `d1'.
* rs6000.c: Move include of output.h below tree.h. Include toplev.h.
(any_operand): Mark unused parameters `op' and `mode' with
ATTRIBUTE_UNUSED.
(count_register_operand): Likewise for parameter `mode'.
(fpmem_operand): Likewise.
(short_cint_operand): Likewise.
(u_short_cint_operand): Likewise.
(non_short_cint_operand): Likewise.
(got_operand): Likewise.
(got_no_const_operand): Likewise.
(non_add_cint_operand): Likewise.
(non_logical_cint_operand): Likewise.
(mask_operand): Likewise.
(current_file_function_operand): Likewise.
(small_data_operand): Likewise for parameters `op' and `mode' but
only when !TARGET_ELF.
(init_cumulative_args): Mark parameters `libname' with
ATTRIBUTE_UNUSED.
(function_arg_pass_by_reference): Likewise for parameters `cum',
`mode' and `named'.
(expand_builtin_saveregs): Likewise for parameter `args'.
(load_multiple_operation): Likewise for parameter `mode'.
(store_multiple_operation): Likewise.
(branch_comparison_operator): Likewise.
(secondary_reload_class): Likewise.
(print_operand): Add parentheses around & operation.
(output_prolog): Mark parameter `size' with ATTRIBUTE_UNUSED.
(output_epilog): Likewise. Cast argument to fprintf to int.
(rs6000_adjust_cost): Mark parameter `dep_insn' with ATTRIBUTE_UNUSED.
(rs6000_valid_decl_attribute_p): Likewise for parameters `decl',
`attributes', `identifier' and `args'.
(rs6000_valid_type_attribute_p): Likewise for parameter `attributes'.
(rs6000_comp_type_attributes): Likewise for parameters `type1' and
`type2'.
(rs6000_set_default_type_attributes): Likewise for parameter `type'.
* rs6000.h (RTX_COSTS): Add parentheses around & operation.
(toc_section, private_data_section, trap_comparison_operator): Add
prototypes.
* dbxout.h (dbxout_parms, dbxout_reg_parms, dbxout_syms): Add
prototypes.
* xcoffout.c: Include toplev.h, outout.h and dbxout.h.
* xcoffout.h (stab_to_sclass, xcoffout_begin_function,
xcoffout_begin_block, xcoffout_end_epilogue,
xcoffout_end_function, xcoffout_end_block,
xcoff_output_standard_types, xcoffout_declare_function,
xcoffout_source_line): Add prototypes.
From-SVN: r20717
1998-06-25 15:05:20 +02:00
|
|
|
fractype bit;
|
1994-07-12 00:32:24 +02:00
|
|
|
fractype numerator;
|
|
|
|
fractype denominator;
|
|
|
|
fractype quotient;
|
|
|
|
|
|
|
|
if (isnan (a))
|
|
|
|
{
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (isnan (b))
|
|
|
|
{
|
|
|
|
return b;
|
|
|
|
}
|
1996-05-17 19:09:54 +02:00
|
|
|
|
|
|
|
a->sign = a->sign ^ b->sign;
|
|
|
|
|
1994-07-12 00:32:24 +02:00
|
|
|
if (isinf (a) || iszero (a))
|
|
|
|
{
|
|
|
|
if (a->class == b->class)
|
|
|
|
return nan ();
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isinf (b))
|
|
|
|
{
|
|
|
|
a->fraction.ll = 0;
|
|
|
|
a->normal_exp = 0;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (iszero (b))
|
|
|
|
{
|
|
|
|
a->class = CLASS_INFINITY;
|
1998-06-01 11:15:23 +02:00
|
|
|
return a;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate the mantissa by multiplying both 64bit numbers to get a
|
|
|
|
128 bit number */
|
|
|
|
{
|
|
|
|
/* quotient =
|
|
|
|
( numerator / denominator) * 2^(numerator exponent - denominator exponent)
|
|
|
|
*/
|
|
|
|
|
|
|
|
a->normal_exp = a->normal_exp - b->normal_exp;
|
|
|
|
numerator = a->fraction.ll;
|
|
|
|
denominator = b->fraction.ll;
|
|
|
|
|
|
|
|
if (numerator < denominator)
|
|
|
|
{
|
|
|
|
/* Fraction will be less than 1.0 */
|
|
|
|
numerator *= 2;
|
|
|
|
a->normal_exp--;
|
|
|
|
}
|
|
|
|
bit = IMPLICIT_1;
|
|
|
|
quotient = 0;
|
|
|
|
/* ??? Does divide one bit at a time. Optimize. */
|
|
|
|
while (bit)
|
|
|
|
{
|
|
|
|
if (numerator >= denominator)
|
|
|
|
{
|
|
|
|
quotient |= bit;
|
|
|
|
numerator -= denominator;
|
|
|
|
}
|
|
|
|
bit >>= 1;
|
|
|
|
numerator *= 2;
|
|
|
|
}
|
|
|
|
|
defaults.h (LARGEST_EXPONENT_IS_NORMAL, [...]): New.
* defaults.h (LARGEST_EXPONENT_IS_NORMAL, ROUND_TOWARDS_ZERO): New.
(MODE_HAS_NANS, MODE_HAS_INFINITIES): Evaluate to false if
LARGEST_EXPONENT_IS_NORMAL for the given mode.
(MODE_HAS_SIGN_DEPENDENT_ROUNDING): False when ROUND_TOWARDS_ZERO.
* real.c (eadd1): Make rounding dependent on !ROUND_TOWARDS_ZERO.
(ediv, emul, eldexp, esqrt): Likewise.
(etoe113, etoe64, etoe53, etoe24, etodec, etoibm, etoc4x): Likewise.
(e24toe): Only check NaNs & infinities if !LARGEST_EXPONENT_IS_NORMAL.
(saturate): New function.
(toe53, toe24): Saturate on overflow if LARGEST_EXPONENT_IS_NORMAL.
(make_nan): Use a saturation value instead of a NaN if
LARGEST_EXPONENT_IS_NORMAL. Warn when this happens.
* fp-bit.c (pack_d): Saturate on NaN, infinite or overflowing
inputs if LARGEST_EXPONENT_IS_NORMAL. Represent subnormals as
zero if NO_DENORMALS. Only round to nearest if !ROUND_TOWARDS_ZERO.
(unpack_d): No NaNs or infinities if LARGEST_EXPONENT_IS_NORMAL.
(_fpmul_parts, _fpdiv_parts): Only round to nearest if
!ROUND_TOWARDS_ZERO.
* doc/tm.texi (LARGEST_EXPONENT_IS_NORMAL): Document.
(ROUND_TOWARDS_ZERO): Document.
From-SVN: r50569
2002-03-11 12:13:45 +01:00
|
|
|
if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
|
|
|
if (quotient & (1 << NGARDS))
|
|
|
|
{
|
|
|
|
/* half way, so round to even */
|
|
|
|
quotient += GARDROUND + 1;
|
|
|
|
}
|
|
|
|
else if (numerator)
|
|
|
|
{
|
|
|
|
/* but we really weren't half way, more bits exist */
|
|
|
|
quotient += GARDROUND + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
a->fraction.ll = quotient;
|
|
|
|
return (a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FLO_type
|
|
|
|
divide (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
|
|
|
fp_number_type *res;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1998-10-09 21:17:54 +02:00
|
|
|
res = _fpdiv_parts (&a, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
return pack_d (res);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_div_sf || L_div_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df) \
|
|
|
|
|| defined(L_fpcmp_parts_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
/* according to the demo, fpcmp returns a comparison with 0... thus
|
|
|
|
a<b -> -1
|
|
|
|
a==b -> 0
|
|
|
|
a>b -> +1
|
|
|
|
*/
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
int
|
|
|
|
__fpcmp_parts (fp_number_type * a, fp_number_type * b)
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
|
|
|
#if 0
|
2002-09-29 15:16:44 +02:00
|
|
|
/* either nan -> unordered. Must be checked outside of this routine. */
|
1994-07-12 00:32:24 +02:00
|
|
|
if (isnan (a) && isnan (b))
|
|
|
|
{
|
|
|
|
return 1; /* still unordered! */
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (isnan (a) || isnan (b))
|
|
|
|
{
|
|
|
|
return 1; /* how to indicate unordered compare? */
|
|
|
|
}
|
|
|
|
if (isinf (a) && isinf (b))
|
|
|
|
{
|
|
|
|
/* +inf > -inf, but +inf != +inf */
|
|
|
|
/* b \a| +inf(0)| -inf(1)
|
|
|
|
______\+--------+--------
|
|
|
|
+inf(0)| a==b(0)| a<b(-1)
|
|
|
|
-------+--------+--------
|
|
|
|
-inf(1)| a>b(1) | a==b(0)
|
|
|
|
-------+--------+--------
|
2002-09-14 15:12:56 +02:00
|
|
|
So since unordered must be nonzero, just line up the columns...
|
1994-07-12 00:32:24 +02:00
|
|
|
*/
|
|
|
|
return b->sign - a->sign;
|
|
|
|
}
|
2002-09-29 15:16:44 +02:00
|
|
|
/* but not both... */
|
1994-07-12 00:32:24 +02:00
|
|
|
if (isinf (a))
|
|
|
|
{
|
|
|
|
return a->sign ? -1 : 1;
|
|
|
|
}
|
|
|
|
if (isinf (b))
|
|
|
|
{
|
|
|
|
return b->sign ? 1 : -1;
|
|
|
|
}
|
|
|
|
if (iszero (a) && iszero (b))
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (iszero (a))
|
|
|
|
{
|
|
|
|
return b->sign ? 1 : -1;
|
|
|
|
}
|
|
|
|
if (iszero (b))
|
|
|
|
{
|
|
|
|
return a->sign ? -1 : 1;
|
|
|
|
}
|
2002-09-29 15:16:44 +02:00
|
|
|
/* now both are "normal". */
|
1994-07-12 00:32:24 +02:00
|
|
|
if (a->sign != b->sign)
|
|
|
|
{
|
|
|
|
/* opposite signs */
|
|
|
|
return a->sign ? -1 : 1;
|
|
|
|
}
|
|
|
|
/* same sign; exponents? */
|
|
|
|
if (a->normal_exp > b->normal_exp)
|
|
|
|
{
|
|
|
|
return a->sign ? -1 : 1;
|
|
|
|
}
|
|
|
|
if (a->normal_exp < b->normal_exp)
|
|
|
|
{
|
|
|
|
return a->sign ? 1 : -1;
|
|
|
|
}
|
2002-09-29 15:16:44 +02:00
|
|
|
/* same exponents; check size. */
|
1994-07-12 00:32:24 +02:00
|
|
|
if (a->fraction.ll > b->fraction.ll)
|
|
|
|
{
|
|
|
|
return a->sign ? -1 : 1;
|
|
|
|
}
|
|
|
|
if (a->fraction.ll < b->fraction.ll)
|
|
|
|
{
|
|
|
|
return a->sign ? 1 : -1;
|
|
|
|
}
|
2002-09-29 15:16:44 +02:00
|
|
|
/* after all that, they're equal. */
|
1994-07-12 00:32:24 +02:00
|
|
|
return 0;
|
|
|
|
}
|
1997-12-21 14:45:24 +01:00
|
|
|
#endif
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_compare_sf) || defined(L_compare_df) || defined(L_compoare_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
CMPtype
|
|
|
|
compare (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
|
|
|
|
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
return __fpcmp_parts (&a, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_compare_sf || L_compare_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
#ifndef US_SOFTWARE_GOFAST
|
|
|
|
|
|
|
|
/* These should be optimized for their specific tasks someday. */
|
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_eq_sf) || defined(L_eq_df) || defined(L_eq_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
CMPtype
|
|
|
|
_eq_f2 (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (isnan (&a) || isnan (&b))
|
|
|
|
return 1; /* false, truth == 0 */
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
return __fpcmp_parts (&a, &b) ;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_eq_sf || L_eq_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_ne_sf) || defined(L_ne_df) || defined(L_ne_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
CMPtype
|
|
|
|
_ne_f2 (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
|
|
|
|
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (isnan (&a) || isnan (&b))
|
|
|
|
return 1; /* true, truth != 0 */
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
return __fpcmp_parts (&a, &b) ;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_ne_sf || L_ne_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_gt_sf) || defined(L_gt_df) || defined(L_gt_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
CMPtype
|
|
|
|
_gt_f2 (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (isnan (&a) || isnan (&b))
|
|
|
|
return -1; /* false, truth > 0 */
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
return __fpcmp_parts (&a, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_gt_sf || L_gt_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_ge_sf) || defined(L_ge_df) || defined(L_ge_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
CMPtype
|
|
|
|
_ge_f2 (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
|
|
|
|
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (isnan (&a) || isnan (&b))
|
|
|
|
return -1; /* false, truth >= 0 */
|
1997-12-21 14:45:24 +01:00
|
|
|
return __fpcmp_parts (&a, &b) ;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_ge_sf || L_ge_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_lt_sf) || defined(L_lt_df) || defined(L_lt_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
CMPtype
|
|
|
|
_lt_f2 (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (isnan (&a) || isnan (&b))
|
|
|
|
return 1; /* false, truth < 0 */
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
return __fpcmp_parts (&a, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_lt_sf || L_lt_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_le_sf) || defined(L_le_df) || defined(L_le_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
CMPtype
|
|
|
|
_le_f2 (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au, bu;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
|
|
|
|
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (isnan (&a) || isnan (&b))
|
|
|
|
return 1; /* false, truth <= 0 */
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
return __fpcmp_parts (&a, &b) ;
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_le_sf || L_le_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
2002-03-08 04:02:00 +01:00
|
|
|
#endif /* ! US_SOFTWARE_GOFAST */
|
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_unord_sf) || defined(L_unord_df) || defined(L_unord_tf)
|
2000-01-24 21:10:04 +01:00
|
|
|
CMPtype
|
|
|
|
_unord_f2 (FLO_type arg_a, FLO_type arg_b)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
fp_number_type b;
|
|
|
|
FLO_union_type au, bu;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
bu.value = arg_b;
|
|
|
|
|
|
|
|
unpack_d (&au, &a);
|
|
|
|
unpack_d (&bu, &b);
|
|
|
|
|
2000-01-25 18:25:26 +01:00
|
|
|
return (isnan (&a) || isnan (&b));
|
2000-01-24 21:10:04 +01:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_unord_sf || L_unord_df */
|
2000-01-24 21:10:04 +01:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_si_to_sf) || defined(L_si_to_df) || defined(L_si_to_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
FLO_type
|
|
|
|
si_to_float (SItype arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
|
|
|
|
in.class = CLASS_NUMBER;
|
|
|
|
in.sign = arg_a < 0;
|
|
|
|
if (!arg_a)
|
|
|
|
{
|
|
|
|
in.class = CLASS_ZERO;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
in.normal_exp = FRACBITS + NGARDS;
|
|
|
|
if (in.sign)
|
|
|
|
{
|
|
|
|
/* Special case for minint, since there is no +ve integer
|
|
|
|
representation for it */
|
2001-02-02 12:02:05 +01:00
|
|
|
if (arg_a == (- MAX_SI_INT - 1))
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
2001-02-02 12:02:05 +01:00
|
|
|
return (FLO_type)(- MAX_SI_INT - 1);
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
|
|
|
in.fraction.ll = (-arg_a);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
in.fraction.ll = arg_a;
|
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS)))
|
1994-07-12 00:32:24 +02:00
|
|
|
{
|
|
|
|
in.fraction.ll <<= 1;
|
|
|
|
in.normal_exp -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pack_d (&in);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_si_to_sf || L_si_to_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_usi_to_sf) || defined(L_usi_to_df) || defined(L_usi_to_tf)
|
2000-09-08 22:16:40 +02:00
|
|
|
FLO_type
|
|
|
|
usi_to_float (USItype arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
|
|
|
|
in.sign = 0;
|
|
|
|
if (!arg_a)
|
|
|
|
{
|
|
|
|
in.class = CLASS_ZERO;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
in.class = CLASS_NUMBER;
|
|
|
|
in.normal_exp = FRACBITS + NGARDS;
|
|
|
|
in.fraction.ll = arg_a;
|
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
while (in.fraction.ll > ((fractype)1 << (FRACBITS + NGARDS)))
|
2000-09-08 22:16:40 +02:00
|
|
|
{
|
|
|
|
in.fraction.ll >>= 1;
|
|
|
|
in.normal_exp += 1;
|
|
|
|
}
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS)))
|
2000-09-08 22:16:40 +02:00
|
|
|
{
|
|
|
|
in.fraction.ll <<= 1;
|
|
|
|
in.normal_exp -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pack_d (&in);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_sf_to_si) || defined(L_df_to_si) || defined(L_tf_to_si)
|
1994-07-12 00:32:24 +02:00
|
|
|
SItype
|
|
|
|
float_to_si (FLO_type arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
|
|
|
SItype tmp;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &a);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (iszero (&a))
|
|
|
|
return 0;
|
|
|
|
if (isnan (&a))
|
|
|
|
return 0;
|
2002-09-29 15:16:44 +02:00
|
|
|
/* get reasonable MAX_SI_INT... */
|
1994-07-12 00:32:24 +02:00
|
|
|
if (isinf (&a))
|
1997-06-27 19:23:33 +02:00
|
|
|
return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT;
|
1994-07-12 00:32:24 +02:00
|
|
|
/* it is a number, but a small one */
|
|
|
|
if (a.normal_exp < 0)
|
|
|
|
return 0;
|
2001-02-02 12:02:05 +01:00
|
|
|
if (a.normal_exp > BITS_PER_SI - 2)
|
1994-07-12 00:32:24 +02:00
|
|
|
return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT;
|
|
|
|
tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp);
|
|
|
|
return a.sign ? (-tmp) : (tmp);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_sf_to_si || L_df_to_si */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_sf_to_usi) || defined(L_df_to_usi) || defined(L_tf_to_usi)
|
|
|
|
#if defined US_SOFTWARE_GOFAST || defined(L_tf_to_usi)
|
1994-07-12 00:32:24 +02:00
|
|
|
/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines,
|
|
|
|
we also define them for GOFAST because the ones in libgcc2.c have the
|
|
|
|
wrong names and I'd rather define these here and keep GOFAST CYG-LOC's
|
|
|
|
out of libgcc2.c. We can't define these here if not GOFAST because then
|
|
|
|
there'd be duplicate copies. */
|
|
|
|
|
|
|
|
USItype
|
|
|
|
float_to_usi (FLO_type arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &a);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
if (iszero (&a))
|
|
|
|
return 0;
|
|
|
|
if (isnan (&a))
|
|
|
|
return 0;
|
|
|
|
/* it is a negative number */
|
|
|
|
if (a.sign)
|
|
|
|
return 0;
|
2002-09-29 15:16:44 +02:00
|
|
|
/* get reasonable MAX_USI_INT... */
|
1997-07-02 00:33:05 +02:00
|
|
|
if (isinf (&a))
|
|
|
|
return MAX_USI_INT;
|
1994-07-12 00:32:24 +02:00
|
|
|
/* it is a number, but a small one */
|
|
|
|
if (a.normal_exp < 0)
|
|
|
|
return 0;
|
2001-02-02 12:02:05 +01:00
|
|
|
if (a.normal_exp > BITS_PER_SI - 1)
|
1994-07-12 00:32:24 +02:00
|
|
|
return MAX_USI_INT;
|
|
|
|
else if (a.normal_exp > (FRACBITS + NGARDS))
|
1996-10-23 04:45:07 +02:00
|
|
|
return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS));
|
1994-07-12 00:32:24 +02:00
|
|
|
else
|
|
|
|
return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* US_SOFTWARE_GOFAST */
|
|
|
|
#endif /* L_sf_to_usi || L_df_to_usi */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_negate_sf) || defined(L_negate_df) || defined(L_negate_tf)
|
1994-07-12 00:32:24 +02:00
|
|
|
FLO_type
|
|
|
|
negate (FLO_type arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type a;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &a);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
flip_sign (&a);
|
|
|
|
return pack_d (&a);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_negate_sf || L_negate_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
#ifdef FLOAT
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
#if defined(L_make_sf)
|
1994-07-12 00:32:24 +02:00
|
|
|
SFtype
|
|
|
|
__make_fp(fp_class_type class,
|
|
|
|
unsigned int sign,
|
|
|
|
int exp,
|
|
|
|
USItype frac)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
|
|
|
|
in.class = class;
|
|
|
|
in.sign = sign;
|
|
|
|
in.normal_exp = exp;
|
|
|
|
in.fraction.ll = frac;
|
|
|
|
return pack_d (&in);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_make_sf */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
#ifndef FLOAT_ONLY
|
|
|
|
|
|
|
|
/* This enables one to build an fp library that supports float but not double.
|
|
|
|
Otherwise, we would get an undefined reference to __make_dp.
|
|
|
|
This is needed for some 8-bit ports that can't handle well values that
|
|
|
|
are 8-bytes in size, so we just don't support double for them at all. */
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
#if defined(L_sf_to_df)
|
1994-07-12 00:32:24 +02:00
|
|
|
DFtype
|
|
|
|
sf_to_df (SFtype arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &in);
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
return __make_dp (in.class, in.sign, in.normal_exp,
|
|
|
|
((UDItype) in.fraction.ll) << F_D_BITOFF);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_sf_to_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_sf_to_tf) && defined(TMODES)
|
|
|
|
TFtype
|
|
|
|
sf_to_tf (SFtype arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
FLO_union_type au;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &in);
|
|
|
|
|
|
|
|
return __make_tp (in.class, in.sign, in.normal_exp,
|
|
|
|
((UTItype) in.fraction.ll) << F_T_BITOFF);
|
|
|
|
}
|
|
|
|
#endif /* L_sf_to_df */
|
|
|
|
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* ! FLOAT_ONLY */
|
|
|
|
#endif /* FLOAT */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
|
|
|
#ifndef FLOAT
|
|
|
|
|
|
|
|
extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype);
|
|
|
|
|
1997-12-21 14:45:24 +01:00
|
|
|
#if defined(L_make_df)
|
1994-07-12 00:32:24 +02:00
|
|
|
DFtype
|
|
|
|
__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
|
|
|
|
in.class = class;
|
|
|
|
in.sign = sign;
|
|
|
|
in.normal_exp = exp;
|
|
|
|
in.fraction.ll = frac;
|
|
|
|
return pack_d (&in);
|
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_make_df */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1997-12-27 22:47:12 +01:00
|
|
|
#if defined(L_df_to_sf)
|
1994-07-12 00:32:24 +02:00
|
|
|
SFtype
|
|
|
|
df_to_sf (DFtype arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
1996-10-23 04:45:07 +02:00
|
|
|
USItype sffrac;
|
1999-08-29 12:48:44 +02:00
|
|
|
FLO_union_type au;
|
1994-07-12 00:32:24 +02:00
|
|
|
|
1999-08-29 12:48:44 +02:00
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &in);
|
1996-10-23 04:45:07 +02:00
|
|
|
|
|
|
|
sffrac = in.fraction.ll >> F_D_BITOFF;
|
|
|
|
|
|
|
|
/* We set the lowest guard bit in SFFRAC if we discarded any non
|
|
|
|
zero bits. */
|
|
|
|
if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0)
|
|
|
|
sffrac |= 1;
|
|
|
|
|
|
|
|
return __make_fp (in.class, in.sign, in.normal_exp, sffrac);
|
1994-07-12 00:32:24 +02:00
|
|
|
}
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* L_df_to_sf */
|
1994-07-12 00:32:24 +02:00
|
|
|
|
fp-bit.h: Define macros for TFmode floating-point constants in IEEE quad TFmode type.
* config/fp-bit.h: Define macros for TFmode floating-point
constants in IEEE quad TFmode type. Declare functions according
to L_ macros.
(TMODES): Define if __LDBL_MANT_DIG__ is 113.
(TFtype, TItype, UTItype): Define if TMODES is defined.
(MAX_UDI_INT, MAX_DI_INT, BITS_PER_DI): Likewise.
(F_T_BITOFF, D_T_BITOFF): Define.
(IMPLICIT_1, IMPLICIT_2): Cast constants to types that are
guaranteed to be wide enough.
* config/fp-bit.c: Check for L_ macros for tf functions.
(__thenan_tf): New.
(nan): Adjust.
(pack_d, unpack_d): Support IEEE 854 quad type.
(_fpmul_parts): Support TFmode. Compute exponent adjustment
from FRAC_NBITS, FRAC_BITS and NGARDS.
(usi_to_float): Cast constants to be shifted to fractype
instead of assuming long long is wide enough.
(sf_to_tf, df_to_tf, __make_tp, tf_to_df, tf_to_sf): New.
From-SVN: r61835
2003-01-26 10:33:46 +01:00
|
|
|
#if defined(L_df_to_tf) && defined(TMODES) \
|
|
|
|
&& !defined(FLOAT) && !defined(TFLOAT)
|
|
|
|
TFtype
|
|
|
|
df_to_tf (DFtype arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
FLO_union_type au;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &in);
|
|
|
|
|
|
|
|
return __make_tp (in.class, in.sign, in.normal_exp,
|
|
|
|
((UTItype) in.fraction.ll) << D_T_BITOFF);
|
|
|
|
}
|
|
|
|
#endif /* L_sf_to_df */
|
|
|
|
|
|
|
|
#ifdef TFLOAT
|
|
|
|
#if defined(L_make_tf)
|
|
|
|
TFtype
|
|
|
|
__make_tp(fp_class_type class,
|
|
|
|
unsigned int sign,
|
|
|
|
int exp,
|
|
|
|
UTItype frac)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
|
|
|
|
in.class = class;
|
|
|
|
in.sign = sign;
|
|
|
|
in.normal_exp = exp;
|
|
|
|
in.fraction.ll = frac;
|
|
|
|
return pack_d (&in);
|
|
|
|
}
|
|
|
|
#endif /* L_make_tf */
|
|
|
|
|
|
|
|
#if defined(L_tf_to_df)
|
|
|
|
DFtype
|
|
|
|
tf_to_df (TFtype arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
UDItype sffrac;
|
|
|
|
FLO_union_type au;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &in);
|
|
|
|
|
|
|
|
sffrac = in.fraction.ll >> D_T_BITOFF;
|
|
|
|
|
|
|
|
/* We set the lowest guard bit in SFFRAC if we discarded any non
|
|
|
|
zero bits. */
|
|
|
|
if ((in.fraction.ll & (((UTItype) 1 << D_T_BITOFF) - 1)) != 0)
|
|
|
|
sffrac |= 1;
|
|
|
|
|
|
|
|
return __make_dp (in.class, in.sign, in.normal_exp, sffrac);
|
|
|
|
}
|
|
|
|
#endif /* L_tf_to_df */
|
|
|
|
|
|
|
|
#if defined(L_tf_to_sf)
|
|
|
|
SFtype
|
|
|
|
tf_to_sf (TFtype arg_a)
|
|
|
|
{
|
|
|
|
fp_number_type in;
|
|
|
|
USItype sffrac;
|
|
|
|
FLO_union_type au;
|
|
|
|
|
|
|
|
au.value = arg_a;
|
|
|
|
unpack_d (&au, &in);
|
|
|
|
|
|
|
|
sffrac = in.fraction.ll >> F_T_BITOFF;
|
|
|
|
|
|
|
|
/* We set the lowest guard bit in SFFRAC if we discarded any non
|
|
|
|
zero bits. */
|
|
|
|
if ((in.fraction.ll & (((UTItype) 1 << F_T_BITOFF) - 1)) != 0)
|
|
|
|
sffrac |= 1;
|
|
|
|
|
|
|
|
return __make_fp (in.class, in.sign, in.normal_exp, sffrac);
|
|
|
|
}
|
|
|
|
#endif /* L_tf_to_sf */
|
|
|
|
#endif /* TFLOAT */
|
|
|
|
|
2000-07-03 17:06:12 +02:00
|
|
|
#endif /* ! FLOAT */
|
1996-04-04 18:45:26 +02:00
|
|
|
#endif /* !EXTENDED_FLOAT_STUBS */
|