2004-01-07 00:49:39 +01:00
|
|
|
/* 128-bit long double support routines for Darwin.
|
2018-01-03 11:03:58 +01:00
|
|
|
Copyright (C) 1993-2018 Free Software Foundation, Inc.
|
2004-01-07 00:49:39 +01:00
|
|
|
|
|
|
|
This file is part of GCC.
|
|
|
|
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
2009-04-09 17:00:19 +02:00
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
2004-01-07 00:49:39 +01:00
|
|
|
version.
|
|
|
|
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
permissions described in the GCC Runtime Library Exception, version
|
|
|
|
3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License and
|
|
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
2004-01-07 00:49:39 +01:00
|
|
|
|
|
|
|
/* Implementations of floating-point long double basic arithmetic
|
|
|
|
functions called by the IBM C compiler when generating code for
|
|
|
|
PowerPC platforms. In particular, the following functions are
|
2005-02-16 00:16:49 +01:00
|
|
|
implemented: __gcc_qadd, __gcc_qsub, __gcc_qmul, and __gcc_qdiv.
|
|
|
|
Double-double algorithms are based on the paper "Doubled-Precision
|
|
|
|
IEEE Standard 754 Floating-Point Arithmetic" by W. Kahan, February 26,
|
|
|
|
1987. An alternative published reference is "Software for
|
|
|
|
Doubled-Precision Floating-Point Computations", by Seppo Linnainmaa,
|
|
|
|
ACM TOMS vol 7 no 3, September 1981, pages 272-283. */
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2004-01-10 06:47:14 +01:00
|
|
|
/* Each long double is made up of two IEEE doubles. The value of the
|
|
|
|
long double is the sum of the values of the two parts. The most
|
|
|
|
significant part is required to be the value of the long double
|
|
|
|
rounded to the nearest double, as specified by IEEE. For Inf
|
|
|
|
values, the least significant part is required to be one of +0.0 or
|
|
|
|
-0.0. No other requirements are made; so, for example, 1.0 may be
|
|
|
|
represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a
|
|
|
|
NaN is don't-care.
|
|
|
|
|
2013-06-04 16:11:28 +02:00
|
|
|
This code currently assumes the most significant double is in
|
|
|
|
the lower numbered register or lower addressed memory. */
|
2004-01-10 06:47:14 +01:00
|
|
|
|
2017-07-28 09:17:10 +02:00
|
|
|
#if (defined (__MACH__) || defined (__powerpc__) || defined (_AIX)) \
|
|
|
|
&& !defined (__rtems__)
|
2004-02-07 04:06:46 +01:00
|
|
|
|
2004-01-07 00:49:39 +01:00
|
|
|
#define fabs(x) __builtin_fabs(x)
|
2004-07-31 03:40:18 +02:00
|
|
|
#define isless(x, y) __builtin_isless (x, y)
|
|
|
|
#define inf() __builtin_inf()
|
2004-01-07 00:49:39 +01:00
|
|
|
|
|
|
|
#define unlikely(x) __builtin_expect ((x), 0)
|
|
|
|
|
2004-07-31 03:40:18 +02:00
|
|
|
#define nonfinite(a) unlikely (! isless (fabs (a), inf ()))
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* If we have __float128/_Float128, use __ibm128 instead of long double. On
|
|
|
|
other systems, use long double, because __ibm128 might not have been
|
|
|
|
created. */
|
|
|
|
#ifdef __FLOAT128__
|
|
|
|
#define IBM128_TYPE __ibm128
|
|
|
|
#else
|
|
|
|
#define IBM128_TYPE long double
|
|
|
|
#endif
|
|
|
|
|
2007-01-16 17:03:26 +01:00
|
|
|
/* Define ALIASNAME as a strong alias for NAME. */
|
|
|
|
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
|
|
|
|
# define _strong_alias(name, aliasname) \
|
|
|
|
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
|
|
|
|
|
2004-01-07 00:49:39 +01:00
|
|
|
/* All these routines actually take two long doubles as parameters,
|
|
|
|
but GCC currently generates poor code when a union is used to turn
|
|
|
|
a long double into a pair of doubles. */
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE __gcc_qadd (double, double, double, double);
|
|
|
|
IBM128_TYPE __gcc_qsub (double, double, double, double);
|
|
|
|
IBM128_TYPE __gcc_qmul (double, double, double, double);
|
|
|
|
IBM128_TYPE __gcc_qdiv (double, double, double, double);
|
2005-02-16 00:16:49 +01:00
|
|
|
|
2006-01-27 20:59:49 +01:00
|
|
|
#if defined __ELF__ && defined SHARED \
|
|
|
|
&& (defined __powerpc64__ || !(defined __linux__ || defined __gnu_hurd__))
|
c-common.c, [...]: Fix comment typos.
* c-common.c, c-parser.c, cfgbuild.c, cfghooks.c, cfghooks.h,
cfgrtl.c, cgraphunit.c, ddg.c, expr.h, gcse.c, ggc-page.c,
ggc-zone.c, gimplify.c, ipa-inline.c, longlong.h, targhooks.c,
tree-flow-inline.h, tree-pass.h, tree-ssa-dse.c,
tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c,
tree-ssa-operands.c, tree-vect-analyze.c,
tree-vect-transform.c, tree-vectorizer.c, tree.c,
config/arm/arm.c, config/bfin/bfin.c, config/frv/frv.c,
config/frv/frv.md, config/i386/i386.c, config/i386/sse.md,
config/m68hc11/m68hc11.c, config/m68hc11/m68hc11.h,
config/mcore/mcore.c, config/mips/mips.c, config/mips/mips.md,
config/rs6000/darwin-ldouble.c, config/rs6000/rs6000.c,
config/rs6000/rs6000.h, config/sh/sh.c, config/sh/sh.md,
config/sh/ushmedia.h, config/sparc/sparc.c,
config/sparc/sparc.md, config/stormy16/stormy-abi: Fix comment
typos. Follow spelling conventions.
* doc/invoke.texi, doc/tm.texi, doc/tree-ssa.texi: Fix typos.
Follow spelling conventions.
From-SVN: r100218
2005-05-26 20:15:27 +02:00
|
|
|
/* Provide definitions of the old symbol names to satisfy apps and
|
2005-02-16 00:16:49 +01:00
|
|
|
shared libs built against an older libgcc. To access the _xlq
|
|
|
|
symbols an explicit version reference is needed, so these won't
|
|
|
|
satisfy an unadorned reference like _xlqadd. If dot symbols are
|
|
|
|
not needed, the assembler will remove the aliases from the symbol
|
|
|
|
table. */
|
|
|
|
__asm__ (".symver __gcc_qadd,_xlqadd@GCC_3.4\n\t"
|
|
|
|
".symver __gcc_qsub,_xlqsub@GCC_3.4\n\t"
|
|
|
|
".symver __gcc_qmul,_xlqmul@GCC_3.4\n\t"
|
|
|
|
".symver __gcc_qdiv,_xlqdiv@GCC_3.4\n\t"
|
|
|
|
".symver .__gcc_qadd,._xlqadd@GCC_3.4\n\t"
|
|
|
|
".symver .__gcc_qsub,._xlqsub@GCC_3.4\n\t"
|
|
|
|
".symver .__gcc_qmul,._xlqmul@GCC_3.4\n\t"
|
|
|
|
".symver .__gcc_qdiv,._xlqdiv@GCC_3.4");
|
|
|
|
#endif
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Combine two 'double' values into one 'IBM128_TYPE' and return the result. */
|
|
|
|
static inline IBM128_TYPE
|
2014-07-31 18:22:58 +02:00
|
|
|
pack_ldouble (double dh, double dl)
|
2004-01-07 00:49:39 +01:00
|
|
|
{
|
2018-01-08 22:49:37 +01:00
|
|
|
#if defined (__LONG_DOUBLE_128__) && defined (__LONG_DOUBLE_IBM128__) \
|
2014-07-31 18:22:58 +02:00
|
|
|
&& !(defined (_SOFT_FLOAT) || defined (__NO_FPRS__))
|
|
|
|
return __builtin_pack_longdouble (dh, dl);
|
|
|
|
#else
|
|
|
|
union
|
|
|
|
{
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE ldval;
|
2014-07-31 18:22:58 +02:00
|
|
|
double dval[2];
|
|
|
|
} x;
|
|
|
|
x.dval[0] = dh;
|
|
|
|
x.dval[1] = dl;
|
|
|
|
return x.ldval;
|
|
|
|
#endif
|
|
|
|
}
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Add two 'IBM128_TYPE' values and return the result. */
|
|
|
|
IBM128_TYPE
|
2005-02-16 00:16:49 +01:00
|
|
|
__gcc_qadd (double a, double aa, double c, double cc)
|
2004-01-07 00:49:39 +01:00
|
|
|
{
|
2014-07-31 18:22:58 +02:00
|
|
|
double xh, xl, z, q, zz;
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2004-07-31 03:40:18 +02:00
|
|
|
z = a + c;
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2004-07-31 03:40:18 +02:00
|
|
|
if (nonfinite (z))
|
2004-01-07 00:49:39 +01:00
|
|
|
{
|
2013-12-03 19:57:37 +01:00
|
|
|
if (fabs (z) != inf())
|
|
|
|
return z;
|
2004-07-31 03:40:18 +02:00
|
|
|
z = cc + aa + c + a;
|
|
|
|
if (nonfinite (z))
|
|
|
|
return z;
|
2014-07-31 18:22:58 +02:00
|
|
|
xh = z; /* Will always be DBL_MAX. */
|
2004-07-31 03:40:18 +02:00
|
|
|
zz = aa + cc;
|
|
|
|
if (fabs(a) > fabs(c))
|
2014-07-31 18:22:58 +02:00
|
|
|
xl = a - z + c + zz;
|
2004-07-31 03:40:18 +02:00
|
|
|
else
|
2014-07-31 18:22:58 +02:00
|
|
|
xl = c - z + a + zz;
|
2004-01-07 00:49:39 +01:00
|
|
|
}
|
2004-07-31 03:40:18 +02:00
|
|
|
else
|
2004-01-07 00:49:39 +01:00
|
|
|
{
|
2004-07-31 03:40:18 +02:00
|
|
|
q = a - z;
|
|
|
|
zz = q + c + (a - (q + z)) + aa + cc;
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2006-02-03 12:44:08 +01:00
|
|
|
/* Keep -0 result. */
|
|
|
|
if (zz == 0.0)
|
|
|
|
return z;
|
|
|
|
|
|
|
|
xh = z + zz;
|
2004-07-31 03:40:18 +02:00
|
|
|
if (nonfinite (xh))
|
|
|
|
return xh;
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2014-07-31 18:22:58 +02:00
|
|
|
xl = z - xh + zz;
|
2004-01-07 00:49:39 +01:00
|
|
|
}
|
2014-07-31 18:22:58 +02:00
|
|
|
return pack_ldouble (xh, xl);
|
2004-01-07 00:49:39 +01:00
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE
|
2005-02-16 00:16:49 +01:00
|
|
|
__gcc_qsub (double a, double b, double c, double d)
|
2004-01-07 00:49:39 +01:00
|
|
|
{
|
2005-02-16 00:16:49 +01:00
|
|
|
return __gcc_qadd (a, b, -c, -d);
|
2004-01-07 00:49:39 +01:00
|
|
|
}
|
|
|
|
|
rs6000-c.c (rs6000_cpu_cpp_builtins): Define _SOFT_DOUBLE if doubles use software floating-point.
gcc:
* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define
_SOFT_DOUBLE if doubles use software floating-point.
* config/rs6000/libgcc-ppc-glibc.ver: Export additional long
double functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/darwin-ldouble.c: Also compile functions for
hard-float without FPRs. Use fmsub function for all __NO_FPRS__
cases. Compile extra functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/linuxspe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Remove
commented-out long double override.
(CPP_LONGDOUBLE_DEFAULT_SPEC): Likewise.
* config/rs6000/eabispe.h: Likewise.
* config/rs6000/rs6000.c (rs6000_override_options): Don't override
long double for non-SPE.
(rs6000_handle_option): Likewise.
(invalid_e500_subreg): Disallow more subregs involding DImode,
DFmode, TImode or TFmode.
(rs6000_legitimate_offset_address_p): Check TFmode offsets for
E500 double.
(legitimate_lo_sum_address_p): Also check for TFmode for E500
double.
(rs6000_legitimize_address): Also handle TFmode for E500 double.
(rs6000_legitimize_reload_address): Also handle TFmode for E500
double.
(rs6000_legitimate_address): Also check for TFmode for E500
double.
(rs6000_emit_move): Use DFmode subregs of TFmode for E500 double.
(spe_build_register_parallel): Handle TFmode and TCmode.
(rs6000_spe_function_arg): Handle TFmode and TCmode for E500
double.
(function_arg): Handle TFmode and TCmode for E500 double.
(rs6000_init_libfuncs): Initialize extra libfuncs for soft double
in general.
(print_operand): Handle TFmode and TImode for %y.
(rs6000_generate_compare): Handle TFmode comparisons for E500
double.
(spe_func_has_64bit_regs_p): Check for TFmode for E500 double.
(rs6000_function_value): Handle TFmode and TCmode for E500 double.
(rs6000_libcall_value): Handle TFmode and TCmode for E500 double.
* config/rs6000/rs6000.h (CANNOT_CHANGE_MODE_CLASS): Check for
TFmode for E500 double.
* config/rs6000/rs6000.md (FP): Allow TF for E500 double.
(floatsidf2): Enable for E500 double.
(movtf_softfloat): Use rs6000_nonimmediate_operand.
(extenddftf2): Change to extenddftf2_fprs.
(extenddftf2): Call gen_spe_extenddftf2 or gen_extenddftf2_fprs
depending on TARGET_E500_DOUBLE.
(extendsftf2): Enable for E500 double.
(trunctfdf2): Enable for E500 double.
(trunctfsf2): Change to trunctfsf2_fprs.
(trunctfsf2): Call gen_spe_trunctfsf2 or gen_trunctfsf2_fprs
depending on TARGET_E500_DOUBLE.
(floatsitf2): Enable for E500 double.
(fix_trunctfsi2): Change to fix_trunctfsi2_fprs.
(fix_trunctfsi2): Call gen_spe_fix_trunctfsi2 or
gen_fix_trunctfsi2_fprs depending on TARGET_E500_DOUBLE.
(negtf2): Change to negtf2_internal.
(negtf2): New expander.
(abstf2): Enable for E500 double. Call gen_spe_abstf2_tst,
gen_spe_abstf2_cmp or gen_abstf2_internal depending on
TARGET_E500_DOUBLE and flag_unsafe_math_optimizations.
(movdi_internal32): Use rs6000_nonimmediate_operand.
(unnamed splitter): Likewise.
* config/rs6000/spe.md (CMPTFEQ_GPR, TSTTFEQ_GPR, CMPTFGT_GPR,
TSTTFGT_GPR, CMPTFLT_GPR, TSTTFLT_GPR): New unspecs.
(SPE64TF, DITI): New mode macros.
(frob_df_di): Change to frob_<SPE64:mode>_<DITI:mode>; allow more
modes.
(frob_tf_ti): New.
(frob_<mode>_di_2): New.
(frob_tf_di_8_2): New.
(frob_di_df): Change to frob_di_<mode>; allow more modes.
(frob_ti_tf): New.
(frob_di_df_2): Change to frob_<DITI:mode>_<SPE64:mode>_2; allow
more modes.
(frob_ti_<mode>_8_2): New.
(frob_ti_tf_2): New.
(mov_si<mode>_e500_subreg0, mov_si<mode>_e500_subreg0_2,
mov_si<mode>_e500_subreg4, mov_si<mode>_e500_subreg4_2): Allow
TFmode.
(mov_sitf_e500_subreg8, mov_sitf_e500_subreg8_2,
mov_sitf_e500_subreg12, mov_sitf_e500_subreg12_2): New.
(spe_trunctfdf2_internal1, spe_trunctfsf2, spe_extenddftf2,
spe_fix_trunctfsi2, spe_fix_trunctfsi2_internal,
spe_negtf2_internal, spe_abstf2_cmp, spe_abstf2_tst): New.
(cmptfeq_gpr, tsttfeq_gpr, cmptfgt_gpr, tsttfgt_gpr, cmptflt_gpr,
tsttflt_gp): New.
libgcc:
* config/rs6000/t-ldbl128: Always use -mlong-double-128.
From-SVN: r121085
2007-01-23 20:38:33 +01:00
|
|
|
#ifdef __NO_FPRS__
|
2007-01-16 17:03:26 +01:00
|
|
|
static double fmsub (double, double, double);
|
|
|
|
#endif
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE
|
2005-02-16 00:16:49 +01:00
|
|
|
__gcc_qmul (double a, double b, double c, double d)
|
2004-01-07 00:49:39 +01:00
|
|
|
{
|
2014-07-31 18:22:58 +02:00
|
|
|
double xh, xl, t, tau, u, v, w;
|
2004-01-07 00:49:39 +01:00
|
|
|
|
|
|
|
t = a * c; /* Highest order double term. */
|
|
|
|
|
2004-07-31 03:40:18 +02:00
|
|
|
if (unlikely (t == 0) /* Preserve -0. */
|
|
|
|
|| nonfinite (t))
|
2004-01-10 06:47:14 +01:00
|
|
|
return t;
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2004-07-31 03:40:18 +02:00
|
|
|
/* Sum terms of two highest orders. */
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2004-07-31 03:40:18 +02:00
|
|
|
/* Use fused multiply-add to get low part of a * c. */
|
rs6000-c.c (rs6000_cpu_cpp_builtins): Define _SOFT_DOUBLE if doubles use software floating-point.
gcc:
* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define
_SOFT_DOUBLE if doubles use software floating-point.
* config/rs6000/libgcc-ppc-glibc.ver: Export additional long
double functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/darwin-ldouble.c: Also compile functions for
hard-float without FPRs. Use fmsub function for all __NO_FPRS__
cases. Compile extra functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/linuxspe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Remove
commented-out long double override.
(CPP_LONGDOUBLE_DEFAULT_SPEC): Likewise.
* config/rs6000/eabispe.h: Likewise.
* config/rs6000/rs6000.c (rs6000_override_options): Don't override
long double for non-SPE.
(rs6000_handle_option): Likewise.
(invalid_e500_subreg): Disallow more subregs involding DImode,
DFmode, TImode or TFmode.
(rs6000_legitimate_offset_address_p): Check TFmode offsets for
E500 double.
(legitimate_lo_sum_address_p): Also check for TFmode for E500
double.
(rs6000_legitimize_address): Also handle TFmode for E500 double.
(rs6000_legitimize_reload_address): Also handle TFmode for E500
double.
(rs6000_legitimate_address): Also check for TFmode for E500
double.
(rs6000_emit_move): Use DFmode subregs of TFmode for E500 double.
(spe_build_register_parallel): Handle TFmode and TCmode.
(rs6000_spe_function_arg): Handle TFmode and TCmode for E500
double.
(function_arg): Handle TFmode and TCmode for E500 double.
(rs6000_init_libfuncs): Initialize extra libfuncs for soft double
in general.
(print_operand): Handle TFmode and TImode for %y.
(rs6000_generate_compare): Handle TFmode comparisons for E500
double.
(spe_func_has_64bit_regs_p): Check for TFmode for E500 double.
(rs6000_function_value): Handle TFmode and TCmode for E500 double.
(rs6000_libcall_value): Handle TFmode and TCmode for E500 double.
* config/rs6000/rs6000.h (CANNOT_CHANGE_MODE_CLASS): Check for
TFmode for E500 double.
* config/rs6000/rs6000.md (FP): Allow TF for E500 double.
(floatsidf2): Enable for E500 double.
(movtf_softfloat): Use rs6000_nonimmediate_operand.
(extenddftf2): Change to extenddftf2_fprs.
(extenddftf2): Call gen_spe_extenddftf2 or gen_extenddftf2_fprs
depending on TARGET_E500_DOUBLE.
(extendsftf2): Enable for E500 double.
(trunctfdf2): Enable for E500 double.
(trunctfsf2): Change to trunctfsf2_fprs.
(trunctfsf2): Call gen_spe_trunctfsf2 or gen_trunctfsf2_fprs
depending on TARGET_E500_DOUBLE.
(floatsitf2): Enable for E500 double.
(fix_trunctfsi2): Change to fix_trunctfsi2_fprs.
(fix_trunctfsi2): Call gen_spe_fix_trunctfsi2 or
gen_fix_trunctfsi2_fprs depending on TARGET_E500_DOUBLE.
(negtf2): Change to negtf2_internal.
(negtf2): New expander.
(abstf2): Enable for E500 double. Call gen_spe_abstf2_tst,
gen_spe_abstf2_cmp or gen_abstf2_internal depending on
TARGET_E500_DOUBLE and flag_unsafe_math_optimizations.
(movdi_internal32): Use rs6000_nonimmediate_operand.
(unnamed splitter): Likewise.
* config/rs6000/spe.md (CMPTFEQ_GPR, TSTTFEQ_GPR, CMPTFGT_GPR,
TSTTFGT_GPR, CMPTFLT_GPR, TSTTFLT_GPR): New unspecs.
(SPE64TF, DITI): New mode macros.
(frob_df_di): Change to frob_<SPE64:mode>_<DITI:mode>; allow more
modes.
(frob_tf_ti): New.
(frob_<mode>_di_2): New.
(frob_tf_di_8_2): New.
(frob_di_df): Change to frob_di_<mode>; allow more modes.
(frob_ti_tf): New.
(frob_di_df_2): Change to frob_<DITI:mode>_<SPE64:mode>_2; allow
more modes.
(frob_ti_<mode>_8_2): New.
(frob_ti_tf_2): New.
(mov_si<mode>_e500_subreg0, mov_si<mode>_e500_subreg0_2,
mov_si<mode>_e500_subreg4, mov_si<mode>_e500_subreg4_2): Allow
TFmode.
(mov_sitf_e500_subreg8, mov_sitf_e500_subreg8_2,
mov_sitf_e500_subreg12, mov_sitf_e500_subreg12_2): New.
(spe_trunctfdf2_internal1, spe_trunctfsf2, spe_extenddftf2,
spe_fix_trunctfsi2, spe_fix_trunctfsi2_internal,
spe_negtf2_internal, spe_abstf2_cmp, spe_abstf2_tst): New.
(cmptfeq_gpr, tsttfeq_gpr, cmptfgt_gpr, tsttfgt_gpr, cmptflt_gpr,
tsttflt_gp): New.
libgcc:
* config/rs6000/t-ldbl128: Always use -mlong-double-128.
From-SVN: r121085
2007-01-23 20:38:33 +01:00
|
|
|
#ifndef __NO_FPRS__
|
2004-01-07 00:49:39 +01:00
|
|
|
asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t));
|
2007-01-16 17:03:26 +01:00
|
|
|
#else
|
|
|
|
tau = fmsub (a, c, t);
|
|
|
|
#endif
|
2004-01-07 00:49:39 +01:00
|
|
|
v = a*d;
|
|
|
|
w = b*c;
|
|
|
|
tau += v + w; /* Add in other second-order terms. */
|
|
|
|
u = t + tau;
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Construct IBM128_TYPE result. */
|
2004-07-31 03:40:18 +02:00
|
|
|
if (nonfinite (u))
|
|
|
|
return u;
|
2014-07-31 18:22:58 +02:00
|
|
|
xh = u;
|
|
|
|
xl = (t - u) + tau;
|
|
|
|
return pack_ldouble (xh, xl);
|
2004-01-07 00:49:39 +01:00
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE
|
2005-02-16 00:16:49 +01:00
|
|
|
__gcc_qdiv (double a, double b, double c, double d)
|
2004-01-07 00:49:39 +01:00
|
|
|
{
|
2014-07-31 18:22:58 +02:00
|
|
|
double xh, xl, s, sigma, t, tau, u, v, w;
|
2004-01-07 00:49:39 +01:00
|
|
|
|
|
|
|
t = a / c; /* highest order double term */
|
|
|
|
|
2004-07-31 03:40:18 +02:00
|
|
|
if (unlikely (t == 0) /* Preserve -0. */
|
|
|
|
|| nonfinite (t))
|
2004-01-10 06:47:14 +01:00
|
|
|
return t;
|
2004-01-07 00:49:39 +01:00
|
|
|
|
2014-01-03 03:05:44 +01:00
|
|
|
/* Finite nonzero result requires corrections to the highest order
|
|
|
|
term. These corrections require the low part of c * t to be
|
|
|
|
exactly represented in double. */
|
|
|
|
if (fabs (a) <= 0x1p-969)
|
|
|
|
{
|
|
|
|
a *= 0x1p106;
|
|
|
|
b *= 0x1p106;
|
|
|
|
c *= 0x1p106;
|
|
|
|
d *= 0x1p106;
|
|
|
|
}
|
2004-01-07 00:49:39 +01:00
|
|
|
|
darwin.c, [...]: Fix comment formatting.
* config/darwin.c, config/darwin.h, config/freebsd-spec.h,
config/arm/arm.c, config/arm/arm.md,
config/cris/cris-protos.h, config/fr30/fr30.c,
config/fr30/fr30.h, config/h8300/h8300.c, config/i386/i386.h,
config/i860/i860.c, config/i860/i860.h, config/ia64/ia64-c.c,
config/ia64/ia64.c, config/ia64/ia64.h, config/ip2k/ip2k.h,
config/ip2k/ip2k.md, config/ip2k/libgcc.S,
config/m32r/linux.h, config/m32r/m32r.c, config/m32r/m32r.h,
config/m68k/m68k.c, config/m68k/netbsd-elf.h,
config/mips/mips.c, config/mmix/mmix.c, config/mmix/mmix.md,
config/ns32k/netbsd.h, config/ns32k/ns32k.c,
config/ns32k/ns32k.h, config/pdp11/pdp11.h,
config/rs6000/darwin-ldouble.c, config/s390/s390.h,
config/s390/s390.md, config/sparc/netbsd-elf.h,
config/sparc/openbsd.h, config/sparc/sparc.c,
config/xtensa/lib2funcs.S: Fix comment formatting.
From-SVN: r77268
2004-02-04 21:01:05 +01:00
|
|
|
s = c * t; /* (s,sigma) = c*t exactly. */
|
2004-01-07 00:49:39 +01:00
|
|
|
w = -(-b + d * t); /* Written to get fnmsub for speed, but not
|
|
|
|
numerically necessary. */
|
|
|
|
|
|
|
|
/* Use fused multiply-add to get low part of c * t. */
|
rs6000-c.c (rs6000_cpu_cpp_builtins): Define _SOFT_DOUBLE if doubles use software floating-point.
gcc:
* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define
_SOFT_DOUBLE if doubles use software floating-point.
* config/rs6000/libgcc-ppc-glibc.ver: Export additional long
double functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/darwin-ldouble.c: Also compile functions for
hard-float without FPRs. Use fmsub function for all __NO_FPRS__
cases. Compile extra functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/linuxspe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Remove
commented-out long double override.
(CPP_LONGDOUBLE_DEFAULT_SPEC): Likewise.
* config/rs6000/eabispe.h: Likewise.
* config/rs6000/rs6000.c (rs6000_override_options): Don't override
long double for non-SPE.
(rs6000_handle_option): Likewise.
(invalid_e500_subreg): Disallow more subregs involding DImode,
DFmode, TImode or TFmode.
(rs6000_legitimate_offset_address_p): Check TFmode offsets for
E500 double.
(legitimate_lo_sum_address_p): Also check for TFmode for E500
double.
(rs6000_legitimize_address): Also handle TFmode for E500 double.
(rs6000_legitimize_reload_address): Also handle TFmode for E500
double.
(rs6000_legitimate_address): Also check for TFmode for E500
double.
(rs6000_emit_move): Use DFmode subregs of TFmode for E500 double.
(spe_build_register_parallel): Handle TFmode and TCmode.
(rs6000_spe_function_arg): Handle TFmode and TCmode for E500
double.
(function_arg): Handle TFmode and TCmode for E500 double.
(rs6000_init_libfuncs): Initialize extra libfuncs for soft double
in general.
(print_operand): Handle TFmode and TImode for %y.
(rs6000_generate_compare): Handle TFmode comparisons for E500
double.
(spe_func_has_64bit_regs_p): Check for TFmode for E500 double.
(rs6000_function_value): Handle TFmode and TCmode for E500 double.
(rs6000_libcall_value): Handle TFmode and TCmode for E500 double.
* config/rs6000/rs6000.h (CANNOT_CHANGE_MODE_CLASS): Check for
TFmode for E500 double.
* config/rs6000/rs6000.md (FP): Allow TF for E500 double.
(floatsidf2): Enable for E500 double.
(movtf_softfloat): Use rs6000_nonimmediate_operand.
(extenddftf2): Change to extenddftf2_fprs.
(extenddftf2): Call gen_spe_extenddftf2 or gen_extenddftf2_fprs
depending on TARGET_E500_DOUBLE.
(extendsftf2): Enable for E500 double.
(trunctfdf2): Enable for E500 double.
(trunctfsf2): Change to trunctfsf2_fprs.
(trunctfsf2): Call gen_spe_trunctfsf2 or gen_trunctfsf2_fprs
depending on TARGET_E500_DOUBLE.
(floatsitf2): Enable for E500 double.
(fix_trunctfsi2): Change to fix_trunctfsi2_fprs.
(fix_trunctfsi2): Call gen_spe_fix_trunctfsi2 or
gen_fix_trunctfsi2_fprs depending on TARGET_E500_DOUBLE.
(negtf2): Change to negtf2_internal.
(negtf2): New expander.
(abstf2): Enable for E500 double. Call gen_spe_abstf2_tst,
gen_spe_abstf2_cmp or gen_abstf2_internal depending on
TARGET_E500_DOUBLE and flag_unsafe_math_optimizations.
(movdi_internal32): Use rs6000_nonimmediate_operand.
(unnamed splitter): Likewise.
* config/rs6000/spe.md (CMPTFEQ_GPR, TSTTFEQ_GPR, CMPTFGT_GPR,
TSTTFGT_GPR, CMPTFLT_GPR, TSTTFLT_GPR): New unspecs.
(SPE64TF, DITI): New mode macros.
(frob_df_di): Change to frob_<SPE64:mode>_<DITI:mode>; allow more
modes.
(frob_tf_ti): New.
(frob_<mode>_di_2): New.
(frob_tf_di_8_2): New.
(frob_di_df): Change to frob_di_<mode>; allow more modes.
(frob_ti_tf): New.
(frob_di_df_2): Change to frob_<DITI:mode>_<SPE64:mode>_2; allow
more modes.
(frob_ti_<mode>_8_2): New.
(frob_ti_tf_2): New.
(mov_si<mode>_e500_subreg0, mov_si<mode>_e500_subreg0_2,
mov_si<mode>_e500_subreg4, mov_si<mode>_e500_subreg4_2): Allow
TFmode.
(mov_sitf_e500_subreg8, mov_sitf_e500_subreg8_2,
mov_sitf_e500_subreg12, mov_sitf_e500_subreg12_2): New.
(spe_trunctfdf2_internal1, spe_trunctfsf2, spe_extenddftf2,
spe_fix_trunctfsi2, spe_fix_trunctfsi2_internal,
spe_negtf2_internal, spe_abstf2_cmp, spe_abstf2_tst): New.
(cmptfeq_gpr, tsttfeq_gpr, cmptfgt_gpr, tsttfgt_gpr, cmptflt_gpr,
tsttflt_gp): New.
libgcc:
* config/rs6000/t-ldbl128: Always use -mlong-double-128.
From-SVN: r121085
2007-01-23 20:38:33 +01:00
|
|
|
#ifndef __NO_FPRS__
|
2004-01-07 00:49:39 +01:00
|
|
|
asm ("fmsub %0,%1,%2,%3" : "=f"(sigma) : "f"(c), "f"(t), "f"(s));
|
2007-01-16 17:03:26 +01:00
|
|
|
#else
|
|
|
|
sigma = fmsub (c, t, s);
|
|
|
|
#endif
|
2004-01-07 00:49:39 +01:00
|
|
|
v = a - s;
|
|
|
|
|
darwin.c, [...]: Fix comment formatting.
* config/darwin.c, config/darwin.h, config/freebsd-spec.h,
config/arm/arm.c, config/arm/arm.md,
config/cris/cris-protos.h, config/fr30/fr30.c,
config/fr30/fr30.h, config/h8300/h8300.c, config/i386/i386.h,
config/i860/i860.c, config/i860/i860.h, config/ia64/ia64-c.c,
config/ia64/ia64.c, config/ia64/ia64.h, config/ip2k/ip2k.h,
config/ip2k/ip2k.md, config/ip2k/libgcc.S,
config/m32r/linux.h, config/m32r/m32r.c, config/m32r/m32r.h,
config/m68k/m68k.c, config/m68k/netbsd-elf.h,
config/mips/mips.c, config/mmix/mmix.c, config/mmix/mmix.md,
config/ns32k/netbsd.h, config/ns32k/ns32k.c,
config/ns32k/ns32k.h, config/pdp11/pdp11.h,
config/rs6000/darwin-ldouble.c, config/s390/s390.h,
config/s390/s390.md, config/sparc/netbsd-elf.h,
config/sparc/openbsd.h, config/sparc/sparc.c,
config/xtensa/lib2funcs.S: Fix comment formatting.
From-SVN: r77268
2004-02-04 21:01:05 +01:00
|
|
|
tau = ((v-sigma)+w)/c; /* Correction to t. */
|
2004-01-07 00:49:39 +01:00
|
|
|
u = t + tau;
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Construct IBM128_TYPE result. */
|
2004-07-31 03:40:18 +02:00
|
|
|
if (nonfinite (u))
|
|
|
|
return u;
|
2014-07-31 18:22:58 +02:00
|
|
|
xh = u;
|
|
|
|
xl = (t - u) + tau;
|
|
|
|
return pack_ldouble (xh, xl);
|
2004-01-07 00:49:39 +01:00
|
|
|
}
|
2004-02-07 04:06:46 +01:00
|
|
|
|
rs6000-c.c (rs6000_cpu_cpp_builtins): Define _SOFT_DOUBLE if doubles use software floating-point.
gcc:
* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define
_SOFT_DOUBLE if doubles use software floating-point.
* config/rs6000/libgcc-ppc-glibc.ver: Export additional long
double functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/darwin-ldouble.c: Also compile functions for
hard-float without FPRs. Use fmsub function for all __NO_FPRS__
cases. Compile extra functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/linuxspe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Remove
commented-out long double override.
(CPP_LONGDOUBLE_DEFAULT_SPEC): Likewise.
* config/rs6000/eabispe.h: Likewise.
* config/rs6000/rs6000.c (rs6000_override_options): Don't override
long double for non-SPE.
(rs6000_handle_option): Likewise.
(invalid_e500_subreg): Disallow more subregs involding DImode,
DFmode, TImode or TFmode.
(rs6000_legitimate_offset_address_p): Check TFmode offsets for
E500 double.
(legitimate_lo_sum_address_p): Also check for TFmode for E500
double.
(rs6000_legitimize_address): Also handle TFmode for E500 double.
(rs6000_legitimize_reload_address): Also handle TFmode for E500
double.
(rs6000_legitimate_address): Also check for TFmode for E500
double.
(rs6000_emit_move): Use DFmode subregs of TFmode for E500 double.
(spe_build_register_parallel): Handle TFmode and TCmode.
(rs6000_spe_function_arg): Handle TFmode and TCmode for E500
double.
(function_arg): Handle TFmode and TCmode for E500 double.
(rs6000_init_libfuncs): Initialize extra libfuncs for soft double
in general.
(print_operand): Handle TFmode and TImode for %y.
(rs6000_generate_compare): Handle TFmode comparisons for E500
double.
(spe_func_has_64bit_regs_p): Check for TFmode for E500 double.
(rs6000_function_value): Handle TFmode and TCmode for E500 double.
(rs6000_libcall_value): Handle TFmode and TCmode for E500 double.
* config/rs6000/rs6000.h (CANNOT_CHANGE_MODE_CLASS): Check for
TFmode for E500 double.
* config/rs6000/rs6000.md (FP): Allow TF for E500 double.
(floatsidf2): Enable for E500 double.
(movtf_softfloat): Use rs6000_nonimmediate_operand.
(extenddftf2): Change to extenddftf2_fprs.
(extenddftf2): Call gen_spe_extenddftf2 or gen_extenddftf2_fprs
depending on TARGET_E500_DOUBLE.
(extendsftf2): Enable for E500 double.
(trunctfdf2): Enable for E500 double.
(trunctfsf2): Change to trunctfsf2_fprs.
(trunctfsf2): Call gen_spe_trunctfsf2 or gen_trunctfsf2_fprs
depending on TARGET_E500_DOUBLE.
(floatsitf2): Enable for E500 double.
(fix_trunctfsi2): Change to fix_trunctfsi2_fprs.
(fix_trunctfsi2): Call gen_spe_fix_trunctfsi2 or
gen_fix_trunctfsi2_fprs depending on TARGET_E500_DOUBLE.
(negtf2): Change to negtf2_internal.
(negtf2): New expander.
(abstf2): Enable for E500 double. Call gen_spe_abstf2_tst,
gen_spe_abstf2_cmp or gen_abstf2_internal depending on
TARGET_E500_DOUBLE and flag_unsafe_math_optimizations.
(movdi_internal32): Use rs6000_nonimmediate_operand.
(unnamed splitter): Likewise.
* config/rs6000/spe.md (CMPTFEQ_GPR, TSTTFEQ_GPR, CMPTFGT_GPR,
TSTTFGT_GPR, CMPTFLT_GPR, TSTTFLT_GPR): New unspecs.
(SPE64TF, DITI): New mode macros.
(frob_df_di): Change to frob_<SPE64:mode>_<DITI:mode>; allow more
modes.
(frob_tf_ti): New.
(frob_<mode>_di_2): New.
(frob_tf_di_8_2): New.
(frob_di_df): Change to frob_di_<mode>; allow more modes.
(frob_ti_tf): New.
(frob_di_df_2): Change to frob_<DITI:mode>_<SPE64:mode>_2; allow
more modes.
(frob_ti_<mode>_8_2): New.
(frob_ti_tf_2): New.
(mov_si<mode>_e500_subreg0, mov_si<mode>_e500_subreg0_2,
mov_si<mode>_e500_subreg4, mov_si<mode>_e500_subreg4_2): Allow
TFmode.
(mov_sitf_e500_subreg8, mov_sitf_e500_subreg8_2,
mov_sitf_e500_subreg12, mov_sitf_e500_subreg12_2): New.
(spe_trunctfdf2_internal1, spe_trunctfsf2, spe_extenddftf2,
spe_fix_trunctfsi2, spe_fix_trunctfsi2_internal,
spe_negtf2_internal, spe_abstf2_cmp, spe_abstf2_tst): New.
(cmptfeq_gpr, tsttfeq_gpr, cmptfgt_gpr, tsttfgt_gpr, cmptflt_gpr,
tsttflt_gp): New.
libgcc:
* config/rs6000/t-ldbl128: Always use -mlong-double-128.
From-SVN: r121085
2007-01-23 20:38:33 +01:00
|
|
|
#if defined (_SOFT_DOUBLE) && defined (__LONG_DOUBLE_128__)
|
2007-01-16 17:03:26 +01:00
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE __gcc_qneg (double, double);
|
2007-01-16 17:03:26 +01:00
|
|
|
int __gcc_qeq (double, double, double, double);
|
|
|
|
int __gcc_qne (double, double, double, double);
|
|
|
|
int __gcc_qge (double, double, double, double);
|
|
|
|
int __gcc_qle (double, double, double, double);
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE __gcc_stoq (float);
|
|
|
|
IBM128_TYPE __gcc_dtoq (double);
|
2007-01-16 17:03:26 +01:00
|
|
|
float __gcc_qtos (double, double);
|
|
|
|
double __gcc_qtod (double, double);
|
|
|
|
int __gcc_qtoi (double, double);
|
|
|
|
unsigned int __gcc_qtou (double, double);
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE __gcc_itoq (int);
|
|
|
|
IBM128_TYPE __gcc_utoq (unsigned int);
|
2007-01-16 17:03:26 +01:00
|
|
|
|
|
|
|
extern int __eqdf2 (double, double);
|
|
|
|
extern int __ledf2 (double, double);
|
|
|
|
extern int __gedf2 (double, double);
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Negate 'IBM128_TYPE' value and return the result. */
|
|
|
|
IBM128_TYPE
|
2007-01-16 17:03:26 +01:00
|
|
|
__gcc_qneg (double a, double aa)
|
|
|
|
{
|
2014-07-31 18:22:58 +02:00
|
|
|
return pack_ldouble (-a, -aa);
|
2007-01-16 17:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Compare two 'IBM128_TYPE' values for equality. */
|
2007-01-16 17:03:26 +01:00
|
|
|
int
|
|
|
|
__gcc_qeq (double a, double aa, double c, double cc)
|
|
|
|
{
|
|
|
|
if (__eqdf2 (a, c) == 0)
|
|
|
|
return __eqdf2 (aa, cc);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
strong_alias (__gcc_qeq, __gcc_qne);
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Compare two 'IBM128_TYPE' values for less than or equal. */
|
2007-01-16 17:03:26 +01:00
|
|
|
int
|
|
|
|
__gcc_qle (double a, double aa, double c, double cc)
|
|
|
|
{
|
|
|
|
if (__eqdf2 (a, c) == 0)
|
|
|
|
return __ledf2 (aa, cc);
|
|
|
|
return __ledf2 (a, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
strong_alias (__gcc_qle, __gcc_qlt);
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Compare two 'IBM128_TYPE' values for greater than or equal. */
|
2007-01-16 17:03:26 +01:00
|
|
|
int
|
|
|
|
__gcc_qge (double a, double aa, double c, double cc)
|
|
|
|
{
|
|
|
|
if (__eqdf2 (a, c) == 0)
|
|
|
|
return __gedf2 (aa, cc);
|
|
|
|
return __gedf2 (a, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
strong_alias (__gcc_qge, __gcc_qgt);
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Convert single to IBM128_TYPE. */
|
|
|
|
IBM128_TYPE
|
2007-01-16 17:03:26 +01:00
|
|
|
__gcc_stoq (float a)
|
|
|
|
{
|
2014-07-31 18:22:58 +02:00
|
|
|
return pack_ldouble ((double) a, 0.0);
|
2007-01-16 17:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Convert double to IBM128_TYPE. */
|
|
|
|
IBM128_TYPE
|
2007-01-16 17:03:26 +01:00
|
|
|
__gcc_dtoq (double a)
|
|
|
|
{
|
2014-07-31 18:22:58 +02:00
|
|
|
return pack_ldouble (a, 0.0);
|
2007-01-16 17:03:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Convert IBM128_TYPE to single. */
|
2007-01-16 17:03:26 +01:00
|
|
|
float
|
|
|
|
__gcc_qtos (double a, double aa __attribute__ ((__unused__)))
|
|
|
|
{
|
|
|
|
return (float) a;
|
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Convert IBM128_TYPE to double. */
|
2007-01-16 17:03:26 +01:00
|
|
|
double
|
|
|
|
__gcc_qtod (double a, double aa __attribute__ ((__unused__)))
|
|
|
|
{
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Convert IBM128_TYPE to int. */
|
2007-01-16 17:03:26 +01:00
|
|
|
int
|
|
|
|
__gcc_qtoi (double a, double aa)
|
|
|
|
{
|
|
|
|
double z = a + aa;
|
|
|
|
return (int) z;
|
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Convert IBM128_TYPE to unsigned int. */
|
2007-01-16 17:03:26 +01:00
|
|
|
unsigned int
|
|
|
|
__gcc_qtou (double a, double aa)
|
|
|
|
{
|
|
|
|
double z = a + aa;
|
|
|
|
return (unsigned int) z;
|
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Convert int to IBM128_TYPE. */
|
|
|
|
IBM128_TYPE
|
2007-01-16 17:03:26 +01:00
|
|
|
__gcc_itoq (int a)
|
|
|
|
{
|
|
|
|
return __gcc_dtoq ((double) a);
|
|
|
|
}
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Convert unsigned int to IBM128_TYPE. */
|
|
|
|
IBM128_TYPE
|
2007-01-16 17:03:26 +01:00
|
|
|
__gcc_utoq (unsigned int a)
|
|
|
|
{
|
|
|
|
return __gcc_dtoq ((double) a);
|
|
|
|
}
|
|
|
|
|
rs6000-c.c (rs6000_cpu_cpp_builtins): Define _SOFT_DOUBLE if doubles use software floating-point.
gcc:
* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define
_SOFT_DOUBLE if doubles use software floating-point.
* config/rs6000/libgcc-ppc-glibc.ver: Export additional long
double functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/darwin-ldouble.c: Also compile functions for
hard-float without FPRs. Use fmsub function for all __NO_FPRS__
cases. Compile extra functions if _SOFT_DOUBLE, not _SOFT_FLOAT.
* config/rs6000/linuxspe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Remove
commented-out long double override.
(CPP_LONGDOUBLE_DEFAULT_SPEC): Likewise.
* config/rs6000/eabispe.h: Likewise.
* config/rs6000/rs6000.c (rs6000_override_options): Don't override
long double for non-SPE.
(rs6000_handle_option): Likewise.
(invalid_e500_subreg): Disallow more subregs involding DImode,
DFmode, TImode or TFmode.
(rs6000_legitimate_offset_address_p): Check TFmode offsets for
E500 double.
(legitimate_lo_sum_address_p): Also check for TFmode for E500
double.
(rs6000_legitimize_address): Also handle TFmode for E500 double.
(rs6000_legitimize_reload_address): Also handle TFmode for E500
double.
(rs6000_legitimate_address): Also check for TFmode for E500
double.
(rs6000_emit_move): Use DFmode subregs of TFmode for E500 double.
(spe_build_register_parallel): Handle TFmode and TCmode.
(rs6000_spe_function_arg): Handle TFmode and TCmode for E500
double.
(function_arg): Handle TFmode and TCmode for E500 double.
(rs6000_init_libfuncs): Initialize extra libfuncs for soft double
in general.
(print_operand): Handle TFmode and TImode for %y.
(rs6000_generate_compare): Handle TFmode comparisons for E500
double.
(spe_func_has_64bit_regs_p): Check for TFmode for E500 double.
(rs6000_function_value): Handle TFmode and TCmode for E500 double.
(rs6000_libcall_value): Handle TFmode and TCmode for E500 double.
* config/rs6000/rs6000.h (CANNOT_CHANGE_MODE_CLASS): Check for
TFmode for E500 double.
* config/rs6000/rs6000.md (FP): Allow TF for E500 double.
(floatsidf2): Enable for E500 double.
(movtf_softfloat): Use rs6000_nonimmediate_operand.
(extenddftf2): Change to extenddftf2_fprs.
(extenddftf2): Call gen_spe_extenddftf2 or gen_extenddftf2_fprs
depending on TARGET_E500_DOUBLE.
(extendsftf2): Enable for E500 double.
(trunctfdf2): Enable for E500 double.
(trunctfsf2): Change to trunctfsf2_fprs.
(trunctfsf2): Call gen_spe_trunctfsf2 or gen_trunctfsf2_fprs
depending on TARGET_E500_DOUBLE.
(floatsitf2): Enable for E500 double.
(fix_trunctfsi2): Change to fix_trunctfsi2_fprs.
(fix_trunctfsi2): Call gen_spe_fix_trunctfsi2 or
gen_fix_trunctfsi2_fprs depending on TARGET_E500_DOUBLE.
(negtf2): Change to negtf2_internal.
(negtf2): New expander.
(abstf2): Enable for E500 double. Call gen_spe_abstf2_tst,
gen_spe_abstf2_cmp or gen_abstf2_internal depending on
TARGET_E500_DOUBLE and flag_unsafe_math_optimizations.
(movdi_internal32): Use rs6000_nonimmediate_operand.
(unnamed splitter): Likewise.
* config/rs6000/spe.md (CMPTFEQ_GPR, TSTTFEQ_GPR, CMPTFGT_GPR,
TSTTFGT_GPR, CMPTFLT_GPR, TSTTFLT_GPR): New unspecs.
(SPE64TF, DITI): New mode macros.
(frob_df_di): Change to frob_<SPE64:mode>_<DITI:mode>; allow more
modes.
(frob_tf_ti): New.
(frob_<mode>_di_2): New.
(frob_tf_di_8_2): New.
(frob_di_df): Change to frob_di_<mode>; allow more modes.
(frob_ti_tf): New.
(frob_di_df_2): Change to frob_<DITI:mode>_<SPE64:mode>_2; allow
more modes.
(frob_ti_<mode>_8_2): New.
(frob_ti_tf_2): New.
(mov_si<mode>_e500_subreg0, mov_si<mode>_e500_subreg0_2,
mov_si<mode>_e500_subreg4, mov_si<mode>_e500_subreg4_2): Allow
TFmode.
(mov_sitf_e500_subreg8, mov_sitf_e500_subreg8_2,
mov_sitf_e500_subreg12, mov_sitf_e500_subreg12_2): New.
(spe_trunctfdf2_internal1, spe_trunctfsf2, spe_extenddftf2,
spe_fix_trunctfsi2, spe_fix_trunctfsi2_internal,
spe_negtf2_internal, spe_abstf2_cmp, spe_abstf2_tst): New.
(cmptfeq_gpr, tsttfeq_gpr, cmptfgt_gpr, tsttfgt_gpr, cmptflt_gpr,
tsttflt_gp): New.
libgcc:
* config/rs6000/t-ldbl128: Always use -mlong-double-128.
From-SVN: r121085
2007-01-23 20:38:33 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __NO_FPRS__
|
|
|
|
|
darwin-ldouble.c (__gcc_qunord): Define if __NO_FPRS__, not just if _SOFT_DOUBLE.
* config/rs6000/darwin-ldouble.c (__gcc_qunord): Define if
__NO_FPRS__, not just if _SOFT_DOUBLE.
* config/rs6000/libgcc-ppc-glibc.ver (__gcc_qunord): Likewise.
* config/rs6000/rs6000.c (rs6000_init_libfuncs): Use __gcc_qunord
also for E500 double.
* config/rs6000/rs6000.md (buneq, bunge, bungt, bunle, bunlt,
suneq, sunge, sungt, sunle, sunlt): Disable for (TARGET_HARD_FLOAT
&& !TARGET_FPRS).
From-SVN: r124332
2007-05-01 19:41:48 +02:00
|
|
|
int __gcc_qunord (double, double, double, double);
|
|
|
|
|
|
|
|
extern int __eqdf2 (double, double);
|
|
|
|
extern int __unorddf2 (double, double);
|
|
|
|
|
2018-01-08 22:49:37 +01:00
|
|
|
/* Compare two 'IBM128_TYPE' values for unordered. */
|
darwin-ldouble.c (__gcc_qunord): Define if __NO_FPRS__, not just if _SOFT_DOUBLE.
* config/rs6000/darwin-ldouble.c (__gcc_qunord): Define if
__NO_FPRS__, not just if _SOFT_DOUBLE.
* config/rs6000/libgcc-ppc-glibc.ver (__gcc_qunord): Likewise.
* config/rs6000/rs6000.c (rs6000_init_libfuncs): Use __gcc_qunord
also for E500 double.
* config/rs6000/rs6000.md (buneq, bunge, bungt, bunle, bunlt,
suneq, sunge, sungt, sunle, sunlt): Disable for (TARGET_HARD_FLOAT
&& !TARGET_FPRS).
From-SVN: r124332
2007-05-01 19:41:48 +02:00
|
|
|
int
|
|
|
|
__gcc_qunord (double a, double aa, double c, double cc)
|
|
|
|
{
|
|
|
|
if (__eqdf2 (a, c) == 0)
|
|
|
|
return __unorddf2 (aa, cc);
|
|
|
|
return __unorddf2 (a, c);
|
|
|
|
}
|
|
|
|
|
soft-fp: Move to ../libgcc.
gcc:
* config/soft-fp: Move to ../libgcc.
* Makefile.in (SFP_MACHINE): Remove.
(libgcc-support): Remove $(SFP_MACHINE) dependency.
* config/arm/sfp-machine.h: Move to ../libgcc/config/arm.
* config/arm/t-arm-softfp: Move to
../libgcc/config/arm/t-softfp.
* config/c6x/sfp-machine.h: Move to ../libgcc/config/c6x.
* config/c6x/t-c6x-softfp: Remove.
* config/i386/sfp-machine.h: Move to ../libgcc/config/i386.
* config/i386/t-fprules-softfp: Move to
../libgcc/config/t-softfp-tf.
* config/ia64/sfp-machine.h: Move to ../libgcc/config/ia64.
* config/ia64/t-fprules-softfp: Remove.
* config/lm32/sfp-machine.h: Move to ../libgcc/config/lm32.
* config/lm32/t-fprules-softfp: Remove.
* config/moxie/sfp-machine.h: Remove.
* config/moxie/t-moxie-softfp: Remove.
* config/rs6000/darwin-ldouble-format: Move to
../libgcc/config/rs6000/ibm-ldouble-format.
* config/rs6000/darwin-ldouble.c: Move to
../libgcc/config/rs6000/ibm-ldouble.c
* config/rs6000/libgcc-ppc-glibc.ver: Move to ../libgcc/config/rs6000.
* config/rs6000/libgcc-ppc64.ver: Likewise.
* config/rs6000/sfp-machine.h: Likewise.
* config/rs6000/t-aix43 (SHLIB_MAPFILES): Remove
$(srcdir)/config/rs6000/libgcc-ppc64.ver.
(LIB2FUNCS_EXTRA): Remove.
(TARGET_LIBGCC2_CFLAGS): Remove.
* config/rs6000/t-aix52: Likewise
* config/rs6000/t-darwin (LIB2FUNCS_EXTRA): Remove
$(srcdir)/config/rs6000/darwin-ldouble.c.
(SHLIB_MAPFILES): Remove.
* config/rs6000/t-darwin64 (LIB2FUNCS_EXTRA): Remove
$(srcdir)/config/rs6000/darwin-ldouble.c.
* config/rs6000/t-fprules-softfp: Move to
../libgcc/config/t-softfp-sfdf.
* config/rs6000/t-freebsd: Move to ../libgcc/config/rs6000.
* config/rs6000/t-linux64 (softfp_wrap_start, softfp_wrap_end): Remove.
* config/rs6000/t-ppccomm (LIB2FUNCS_EXTRA): Remove
$(srcdir)/config/rs6000/darwin-ldouble.c.
* config/score/sfp-machine.h: Move to ../libgcc/config/score.
* config/score/t-score-softfp: Remove.
* config.gcc (arm*-*-linux*): Remove arm/t-arm-softfp,
soft-fp/t-softfp from tmake_file.
(arm*-*-uclinux*): Likewise.
(arm*-*-ecos-elf): Likewise.
(arm*-*-eabi*, arm*-*-symbianelf*): Likewise.
(arm*-*-rtems*): Likewise.
(arm*-*-elf): Likewise.
(moxie-*-elf): Remove moxie/t-moxie-softfp, soft-fp/t-softfp from
tmake_file.
(moxie-*-uclinux*): Likewise.
(moxie-*-rtems*): Likewise.
(lm32-*-elf*): Remove lm32/t-fprules-softfp, soft-fp/t-softfp from
tmake_file.
(lm32-*-rtems*): Likewise.
(lm32-*-uclinux*): Likewise.
(powerpc-*-freebsd*): Remove rs6000/t-freebsd,
rs6000/t-fprules-softfp, soft-fp/t-softfp from tmake_file.
(powerpc-*-linux*, powerpc64-*-linux*): Remove
rs6000/t-fprules-softfp, soft-fp/t-softfp from tmake_file.
(score-*-elf): Remove score/t-score-softfp, soft-fp/t-softfp from
tmake_file.
(tic6x-*-elf): Remove c6x/t-c6x-softfp, soft-fp/t-softfp from
tmake_file.
(tic6x-*-uclinux): Likewise.
(i[34567]86-*-darwin*, x86_64-*-darwin*): Remove i386/t-fprules-softfp,
soft-fp/t-softfp from tmake_file.
(i[34567]86-*-linux*, x86_64-*-linux*, i[34567]86-*-kfreebsd*-gnu)
(x86_64-*-kfreebsd*-gnu, i[34567]86-*-gnu*): Likewise.
(i[34567]86-*-solaris2*, x86_64-*-solaris2.1[0-9]*): Likewise.
(i[34567]86-*-cygwin*, i[34567]86-*-mingw*, x86_64-*-mingw*):
Likewise.
(i[34567]86-*-freebsd*, x86_64-*-freebsd*): Likewise.
libgcc:
* config/t-softfp: Remove.
* soft-fp: Moved from ../gcc/config.
* soft-fp/README: Remove t-softfp reference.
* soft-fp/t-softfp: Move to config/t-softfp.
(softfp_machine_header): Remove.
(softfp_file_list): Remove config subdir.
(soft-fp-objects): New variable.
($(soft-fp-objects)): Set INTERNAL_CFLAGS.
(LIB2FUNCS_EXTRA): Add to LIB2ADD instead.
(SFP_MACHINE, $(SFP_MACHINE)): Remove.
* config/t-softfp-excl: New file.
* config/t-softfp-sfdf: New file.
* config/t-softfp-tf: New file.
* config/no-sfp-machine.h: New file.
* config/arm/sfp-machine.h: New file.
* config/arm/t-softfp: New file.
* config/c6x/sfp-machine.h: New file.
* config/i386/32/t-fprules-softfp: Rename to ...
* config/i386/32/t-softfp: ... this.
(tifunctions, LIB2ADD): Remove.
(softfp_int_modes): Override.
* config/i386/64/t-softfp-compat (tf-functions): Remove config
subdir.
* config/i386/64/eqtf2.c: Likewise.
* config/i386/64/getf2.c: Likewise.
* config/i386/64/letf2.c: Likewise.
* config/ia64/sft-machine.h: New file.
* config/ia64/t-fprules-softfp: Rename to ...
* config/ia64/t-softfp: ... this.
* config/lm32/sfp-machine.h: New file.
* config/moxie/t-moxie-softfp: Remove.
* config/rs6000/ibm-ldouble-format: New file.
* config/rs6000/ibm-ldouble.c: New file.
* config/rs6000/libgcc-ppc-glibc.ver: New file
* config/rs6000/libgcc-ppc64.ver: New file
* config/rs6000/sfp-machine.h: New file.
* config/rs6000/t-freebsd: New file.
* config/rs6000/t-ibm-ldouble: New file.
* config/rs6000/t-ldbl128: Use $(srcdir) to refer to
libgcc-ppc-glibc.ver.
* config/rs6000/t-linux64: New file.
* config/rs6000/t-ppccomm (LIB2ADD): Add
$(srcdir)/config/rs6000/ibm-ldouble.c.
* config/rs6000/t-ppccomm-ldbl: New file.
* config/score/sfp-machine.h: New file.
* config.host (sfp_machine_header): Explain.
(arm*-*-linux*): Add t-softfp-sfdf, t-softfp-excl, arm/t-softfp,
t-softfp to tmake_file.
(arm*-*-uclinux*): Likewise.
(arm*-*-ecos-elf): Likewise.
(arm*-*-eabi*, arm*-*-symbianelf*): Likewise.
(arm*-*-rtems*): Likewise.
(arm*-*-elf): Likewise.
(ia64*-*-linux*): Replace ia64/t-fprules-softfp by ia64/t-softfp
in tmake_file.
Add t-softfp-tf, t-softfp-excl, t-softfp to tmake_file.
(lm32-*-elf*, lm32-*-rtems*): Add t-softfp-sfdf, t-softfp to tmake_file.
(lm32-*-uclinux*): Likewise.
(moxie-*-*): Replace moxie/t-moxie-softfp by t-softfp-sfdf,
t-softfp-excl, t-softfp.
(powerpc-*-darwin*): Add rs6000/t-ibm-ldouble to tmake_file.
(powerpc64-*-darwin*): Likewise.
(powerpc-*-freebsd*): Add t-softfp-sfdf, t-softfp-excl, t-softfp
to tmake_file.
(powerpc-*-eabisimaltivec*): Add rs6000/t-ppccomm-ldbl to
tmake_file.
(powerpc-*-eabisim*): Likewise.
(powerpc-*-elf*): Likewise.
(powerpc-*-eabialtivec*): Likewise.
(powerpc-xilinx-eabi*): Likewise.
(powerpc-*-rtems*): Likewise.
(powerpc-*-linux*, powerpc64-*-linux*): Add t-softfp-sfdf,
t-softfp-excl, t-softfp to tmake_file.
(powerpc-wrs-vxworks, powerpc-wrs-vxworksae): Add
rs6000/t-ppccomm-ldbl to tmake_file.
(powerpcle-*-elf*): Likewise.
(powerpcle-*-eabisim*): Likewise.
(powerpcle-*-eabi*): Likewise.
(rs6000-ibm-aix4.[3456789]*, powerpc-ibm-aix4.[3456789]*): Add
rs6000/t-ibm-ldouble to tmake_file.
(rs6000-ibm-aix5.1.*, powerpc-ibm-aix5.1.*): Likewise.
(rs6000-ibm-aix[56789].*, powerpc-ibm-aix[56789].*): Likewise.
(score-*-elf): Add t-softfp-sfdf, t-softfp-excl, t-softfp to tmake_file.
(tic6x-*-*): Likewise.
(i[34567]86-*-darwin*, x86_64-*-darwin*,
i[34567]86-*-kfreebsd*-gnu, x86_64-*-kfreebsd*-gnu,
i[34567]86-*-linux*, x86_64-*-linux*, i[34567]86-*-gnu*,
i[34567]86-*-solaris2*, x86_64-*-solaris2.1[0-9]*,
i[34567]86-*-cygwin*, i[34567]86-*-mingw*, x86_64-*-mingw*,
i[34567]86-*-freebsd*, x86_64-*-freebsd*): Add t-softfp-tf,
t-softfp to tmake_file.
* configure.ac (sfp_machine_header): Provide default if unset.
Substitute.
Link sfp-machine.h to config/$sfp_machine_header.
* configure: Regenerate.
From-SVN: r177452
2011-08-05 17:13:48 +02:00
|
|
|
#include "soft-fp/soft-fp.h"
|
|
|
|
#include "soft-fp/double.h"
|
|
|
|
#include "soft-fp/quad.h"
|
2007-01-16 17:03:26 +01:00
|
|
|
|
|
|
|
/* Compute floating point multiply-subtract with higher (quad) precision. */
|
|
|
|
static double
|
|
|
|
fmsub (double a, double b, double c)
|
|
|
|
{
|
|
|
|
FP_DECL_EX;
|
|
|
|
FP_DECL_D(A);
|
|
|
|
FP_DECL_D(B);
|
|
|
|
FP_DECL_D(C);
|
|
|
|
FP_DECL_Q(X);
|
|
|
|
FP_DECL_Q(Y);
|
|
|
|
FP_DECL_Q(Z);
|
|
|
|
FP_DECL_Q(U);
|
|
|
|
FP_DECL_Q(V);
|
|
|
|
FP_DECL_D(R);
|
|
|
|
double r;
|
2018-01-08 22:49:37 +01:00
|
|
|
IBM128_TYPE u, x, y, z;
|
2007-01-16 17:03:26 +01:00
|
|
|
|
|
|
|
FP_INIT_ROUNDMODE;
|
|
|
|
FP_UNPACK_RAW_D (A, a);
|
|
|
|
FP_UNPACK_RAW_D (B, b);
|
|
|
|
FP_UNPACK_RAW_D (C, c);
|
|
|
|
|
|
|
|
/* Extend double to quad. */
|
|
|
|
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
|
|
|
|
FP_EXTEND(Q,D,4,2,X,A);
|
|
|
|
FP_EXTEND(Q,D,4,2,Y,B);
|
|
|
|
FP_EXTEND(Q,D,4,2,Z,C);
|
|
|
|
#else
|
|
|
|
FP_EXTEND(Q,D,2,1,X,A);
|
|
|
|
FP_EXTEND(Q,D,2,1,Y,B);
|
|
|
|
FP_EXTEND(Q,D,2,1,Z,C);
|
|
|
|
#endif
|
|
|
|
FP_PACK_RAW_Q(x,X);
|
|
|
|
FP_PACK_RAW_Q(y,Y);
|
|
|
|
FP_PACK_RAW_Q(z,Z);
|
|
|
|
FP_HANDLE_EXCEPTIONS;
|
|
|
|
|
|
|
|
/* Multiply. */
|
|
|
|
FP_INIT_ROUNDMODE;
|
|
|
|
FP_UNPACK_Q(X,x);
|
|
|
|
FP_UNPACK_Q(Y,y);
|
|
|
|
FP_MUL_Q(U,X,Y);
|
|
|
|
FP_PACK_Q(u,U);
|
|
|
|
FP_HANDLE_EXCEPTIONS;
|
|
|
|
|
|
|
|
/* Subtract. */
|
|
|
|
FP_INIT_ROUNDMODE;
|
|
|
|
FP_UNPACK_SEMIRAW_Q(U,u);
|
|
|
|
FP_UNPACK_SEMIRAW_Q(Z,z);
|
|
|
|
FP_SUB_Q(V,U,Z);
|
|
|
|
|
|
|
|
/* Truncate quad to double. */
|
|
|
|
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
|
2008-05-23 16:36:54 +02:00
|
|
|
V_f[3] &= 0x0007ffff;
|
2007-01-16 17:03:26 +01:00
|
|
|
FP_TRUNC(D,Q,2,4,R,V);
|
|
|
|
#else
|
2008-05-23 16:36:54 +02:00
|
|
|
V_f1 &= 0x0007ffffffffffffL;
|
2007-01-16 17:03:26 +01:00
|
|
|
FP_TRUNC(D,Q,1,2,R,V);
|
|
|
|
#endif
|
|
|
|
FP_PACK_SEMIRAW_D(r,R);
|
|
|
|
FP_HANDLE_EXCEPTIONS;
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2004-02-07 04:06:46 +01:00
|
|
|
#endif
|