summaryrefslogtreecommitdiff
path: root/sysdeps/ia64/fpu/e_coshl.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-01-06 11:32:24 +0000
committerUlrich Drepper <drepper@redhat.com>2005-01-06 11:32:24 +0000
commitbb803bff5cb97b3de94896aba1c4ec0d67227524 (patch)
treefd7dc0ee4cdec5b9846bad73448537efc718f151 /sysdeps/ia64/fpu/e_coshl.S
parentef07fd10d992d6af9657dbbd58b2465828bec516 (diff)
downloadglibc-bb803bff5cb97b3de94896aba1c4ec0d67227524.tar.gz
2004-12-29 Jakub Jelinek <jakub@redhat.com> * sysdeps/ia64/fpu/libm_support.h (__libm_error_support): Use libc_hidden_proto instead of HIDDEN_PROTO. * sysdeps/ia64/fpu/libm-symbols.h (HIDDEN_PROTO): Remove. (__libm_error_support): If ASSEMBLER and in libc, define to HIDDEN_JUMPTARGET(__libm_error_support). 2004-12-28 David Mosberger <davidm@hpl.hp.com> * sysdeps/ia64/fpu/Makefile (duplicated-routines): New macro. (sysdep_routines): Replace libm_ldexp{,f,l} and libm_scalbn{,f,l} with $(duplicated-routines). (libm-sysdep_routines): Likewise, but substitute "s_" prefix for "m_" prefix. 2004-12-27 David Mosberger <davidm@hpl.hp.com> * sysdeps/ia64/fpu/libm-symbols.h: Add include of <sysdep.h> and undefine "ret" macro. Add __libm_error_support hidden definitions. * sysdeps/ia64/fpu/e_lgamma_r.c: Remove CVS-id comment. Add missing portion of copyright statement. * sysdeps/ia64/fpu/e_lgammaf_r.c: Likewise. * sysdeps/ia64/fpu/e_lgammal_r.c: Likewise. * sysdeps/ia64/fpu/w_lgamma.c: Remove CVS-id comment. Add missing portion of copyright statement. (__ieee754_lgamma): Rename from lgamma(). Make lgamma() a weak alias. (__ieee754_gamma): Likewise. * sysdeps/ia64/fpu/w_lgammaf.c: Likewise. * sysdeps/ia64/fpu/w_lgammal.c: Likewise. 2004-12-09 H. J. Lu <hjl@lucon.org> * sysdeps/ia64/fpu/s_nextafterl.c: Remove. * sysdeps/ia64/fpu/s_nexttoward.c: Likewise. * sysdeps/ia64/fpu/s_nexttowardf.c: Likewise. * sysdeps/ia64/fpu/e_atan2l.S: Remove (duplicate of e_atan2l.c). * sysdeps/ia64/fpu/e_expl.S: Likewise. * sysdeps/ia64/fpu/e_logl.c: Remove (conflicts with e_logl.S). 2004-11-18 David Mosberger <davidm@hpl.hp.com> * sysdeps/ia64/fpu/README: New file. * sysdeps/ia64/fpu/gen_import_file_list: New file. * sysdeps/ia64/fpu/import_check: Likewise. * sysdeps/ia64/fpu/import_diffs: Likewise. * sysdeps/ia64/fpu/import_file.awk: Likewise. * sysdeps/ia64/fpu/import_intel_libm: Likewise. * sysdeps/ia64/fpu/libm-symbols.h: Likewise. * sysdeps/ia64/fpu/e_acos.S: Update from Intel libm v2.1+. * sysdeps/ia64/fpu/e_acosf.S: Likewise. * sysdeps/ia64/fpu/e_acosl.S: Likewise. * sysdeps/ia64/fpu/e_asin.S: Likewise. * sysdeps/ia64/fpu/e_asinf.S: Likewise. * sysdeps/ia64/fpu/e_asinl.S: Likewise. * sysdeps/ia64/fpu/e_atan2.S: Likewise. * sysdeps/ia64/fpu/e_atan2f.S: Likewise. * sysdeps/ia64/fpu/e_cosh.S: Likewise. * sysdeps/ia64/fpu/e_coshf.S: Likewise. * sysdeps/ia64/fpu/e_coshl.S: Likewise. * sysdeps/ia64/fpu/e_exp.S: Likewise. * sysdeps/ia64/fpu/e_expf.S: Likewise. * sysdeps/ia64/fpu/e_fmod.S: Likewise. * sysdeps/ia64/fpu/e_fmodf.S: Likewise. * sysdeps/ia64/fpu/e_fmodl.S: Likewise. * sysdeps/ia64/fpu/e_hypot.S: Likewise. * sysdeps/ia64/fpu/e_hypotf.S: Likewise. * sysdeps/ia64/fpu/e_hypotl.S: Likewise. * sysdeps/ia64/fpu/e_log.S: Likewise. * sysdeps/ia64/fpu/e_log2.S: Likewise. * sysdeps/ia64/fpu/e_log2f.S: Likewise. * sysdeps/ia64/fpu/e_log2l.S: Likewise. * sysdeps/ia64/fpu/e_logf.S: Likewise. * sysdeps/ia64/fpu/e_pow.S: Likewise. * sysdeps/ia64/fpu/e_powf.S: Likewise. * sysdeps/ia64/fpu/e_powl.S: Likewise. * sysdeps/ia64/fpu/e_remainder.S: Likewise. * sysdeps/ia64/fpu/e_remainderf.S: Likewise. * sysdeps/ia64/fpu/e_remainderl.S: Likewise. * sysdeps/ia64/fpu/e_scalb.S: Likewise. * sysdeps/ia64/fpu/e_scalbf.S: Likewise. * sysdeps/ia64/fpu/e_scalbl.S: Likewise. * sysdeps/ia64/fpu/e_sinh.S: Likewise. * sysdeps/ia64/fpu/e_sinhf.S: Likewise. * sysdeps/ia64/fpu/e_sinhl.S: Likewise. * sysdeps/ia64/fpu/e_sqrt.S: Likewise. * sysdeps/ia64/fpu/e_sqrtf.S: Likewise. * sysdeps/ia64/fpu/e_sqrtl.S: Likewise. * sysdeps/ia64/fpu/libm_error.c: Likewise. * sysdeps/ia64/fpu/libm_reduce.c: Likewise. * sysdeps/ia64/fpu/libm_support.h: Likewise. * sysdeps/ia64/fpu/s_atan.S: Likewise. * sysdeps/ia64/fpu/s_atanf.S: Likewise. * sysdeps/ia64/fpu/s_atanl.S: Likewise. * sysdeps/ia64/fpu/s_cbrt.S: Likewise. * sysdeps/ia64/fpu/s_cbrtf.S: Likewise. * sysdeps/ia64/fpu/s_cbrtl.S: Likewise. * sysdeps/ia64/fpu/s_ceil.S: Likewise. * sysdeps/ia64/fpu/s_ceilf.S: Likewise. * sysdeps/ia64/fpu/s_ceill.S: Likewise. * sysdeps/ia64/fpu/s_cos.S: Likewise. * sysdeps/ia64/fpu/s_cosf.S: Likewise. * sysdeps/ia64/fpu/s_cosl.S: Likewise. * sysdeps/ia64/fpu/s_expm1.S: Likewise. * sysdeps/ia64/fpu/s_expm1f.S: Likewise. * sysdeps/ia64/fpu/s_expm1l.S: Likewise. * sysdeps/ia64/fpu/s_fabs.S: Likewise. * sysdeps/ia64/fpu/s_fabsf.S: Likewise. * sysdeps/ia64/fpu/s_fabsl.S: Likewise. * sysdeps/ia64/fpu/s_floor.S: Likewise. * sysdeps/ia64/fpu/s_floorf.S: Likewise. * sysdeps/ia64/fpu/s_floorl.S: Likewise. * sysdeps/ia64/fpu/s_frexp.c: Likewise. * sysdeps/ia64/fpu/s_frexpf.c: Likewise. * sysdeps/ia64/fpu/s_frexpl.c: Likewise. * sysdeps/ia64/fpu/s_ilogb.S: Likewise. * sysdeps/ia64/fpu/s_ilogbf.S: Likewise. * sysdeps/ia64/fpu/s_ilogbl.S: Likewise. * sysdeps/ia64/fpu/s_log1p.S: Likewise. * sysdeps/ia64/fpu/s_log1pf.S: Likewise. * sysdeps/ia64/fpu/s_log1pl.S: Likewise. * sysdeps/ia64/fpu/s_logb.S: Likewise. * sysdeps/ia64/fpu/s_logbf.S: Likewise. * sysdeps/ia64/fpu/s_logbl.S: Likewise. * sysdeps/ia64/fpu/s_modf.S: Likewise. * sysdeps/ia64/fpu/s_modff.S: Likewise. * sysdeps/ia64/fpu/s_modfl.S: Likewise. * sysdeps/ia64/fpu/s_nearbyint.S: Likewise. * sysdeps/ia64/fpu/s_nearbyintf.S: Likewise. * sysdeps/ia64/fpu/s_nearbyintl.S: Likewise. * sysdeps/ia64/fpu/s_rint.S: Likewise. * sysdeps/ia64/fpu/s_rintf.S: Likewise. * sysdeps/ia64/fpu/s_rintl.S: Likewise. * sysdeps/ia64/fpu/s_round.S: Likewise. * sysdeps/ia64/fpu/s_roundf.S: Likewise. * sysdeps/ia64/fpu/s_roundl.S: Likewise. * sysdeps/ia64/fpu/s_significand.S: Likewise. * sysdeps/ia64/fpu/s_significandf.S: Likewise. * sysdeps/ia64/fpu/s_significandl.S: Likewise. * sysdeps/ia64/fpu/s_tan.S: Likewise. * sysdeps/ia64/fpu/s_tanf.S: Likewise. * sysdeps/ia64/fpu/s_tanl.S: Likewise. * sysdeps/ia64/fpu/s_trunc.S: Likewise. * sysdeps/ia64/fpu/s_truncf.S: Likewise. * sysdeps/ia64/fpu/s_truncl.S: Likewise. * sysdeps/ia64/fpu/e_acosh.S: New file from Intel libm v2.1+. * sysdeps/ia64/fpu/e_acoshf.S: Likewise. * sysdeps/ia64/fpu/e_acoshl.S: Likewise. * sysdeps/ia64/fpu/e_atanh.S: Likewise. * sysdeps/ia64/fpu/e_atanhf.S: Likewise. * sysdeps/ia64/fpu/e_atanhl.S: Likewise. * sysdeps/ia64/fpu/e_exp10.S: Likewise. * sysdeps/ia64/fpu/e_exp10f.S: Likewise. * sysdeps/ia64/fpu/e_exp10l.S: Likewise. * sysdeps/ia64/fpu/e_exp2.S: Likewise. * sysdeps/ia64/fpu/e_exp2f.S: Likewise. * sysdeps/ia64/fpu/e_exp2l.S: Likewise. * sysdeps/ia64/fpu/e_lgamma_r.S: Likewise. * sysdeps/ia64/fpu/e_lgammaf_r.S: Likewise. * sysdeps/ia64/fpu/e_lgammal_r.S: Likewise. * sysdeps/ia64/fpu/e_logl.S: Likewise. * sysdeps/ia64/fpu/libm_frexp.S: Likewise. * sysdeps/ia64/fpu/libm_frexpf.S: Likewise. * sysdeps/ia64/fpu/libm_frexpl.S: Likewise. * sysdeps/ia64/fpu/s_libm_ldexp.S: Likewise. * sysdeps/ia64/fpu/s_libm_ldexpf.S: Likewise. * sysdeps/ia64/fpu/s_libm_ldexpl.S: Likewise. * sysdeps/ia64/fpu/s_libm_scalbn.S: Likewise. * sysdeps/ia64/fpu/s_libm_scalbnf.S: Likewise. * sysdeps/ia64/fpu/s_libm_scalbnl.S: Likewise. * sysdeps/ia64/fpu/libm_lgamma.S: Likewise. * sysdeps/ia64/fpu/libm_lgammaf.S: Likewise. * sysdeps/ia64/fpu/libm_lgammal.S: Likewise. * sysdeps/ia64/fpu/libm_sincos.S: Likewise. * sysdeps/ia64/fpu/libm_sincos_large.S: Likewise. * sysdeps/ia64/fpu/libm_sincosf.S: Likewise. * sysdeps/ia64/fpu/libm_sincosl.S: Likewise. * sysdeps/ia64/fpu/libm_scalblnf.S: Likewise. * sysdeps/ia64/fpu/s_asinh.S: Likewise. * sysdeps/ia64/fpu/s_asinhf.S: Likewise. * sysdeps/ia64/fpu/s_asinhl.S: Likewise. * sysdeps/ia64/fpu/s_erf.S: Likewise. * sysdeps/ia64/fpu/s_erfc.S: Likewise. * sysdeps/ia64/fpu/s_erfcf.S: Likewise. * sysdeps/ia64/fpu/s_erfcl.S: Likewise. * sysdeps/ia64/fpu/s_erff.S: Likewise. * sysdeps/ia64/fpu/s_erfl.S: Likewise. * sysdeps/ia64/fpu/s_fdim.S: Likewise. * sysdeps/ia64/fpu/s_fdimf.S: Likewise. * sysdeps/ia64/fpu/s_fdiml.S: Likewise. * sysdeps/ia64/fpu/s_fma.S: Likewise. * sysdeps/ia64/fpu/s_fmaf.S: Likewise. * sysdeps/ia64/fpu/s_fmal.S: Likewise. * sysdeps/ia64/fpu/s_fmax.S: Likewise. * sysdeps/ia64/fpu/s_fmaxf.S: Likewise. * sysdeps/ia64/fpu/s_fmaxl.S: Likewise. * sysdeps/ia64/fpu/s_ldexp.c: Likewise. * sysdeps/ia64/fpu/s_ldexpf.c: Likewise. * sysdeps/ia64/fpu/s_ldexpl.c: Likewise. * sysdeps/ia64/fpu/s_nextafter.S: Likewise. * sysdeps/ia64/fpu/s_nextafterf.S: Likewise. * sysdeps/ia64/fpu/s_nextafterl.S: Likewise. * sysdeps/ia64/fpu/s_nexttoward.S: Likewise. * sysdeps/ia64/fpu/s_nexttowardf.S: Likewise. * sysdeps/ia64/fpu/s_nexttowardl.S: Likewise. * sysdeps/ia64/fpu/s_tanh.S: Likewise. * sysdeps/ia64/fpu/s_tanhf.S: Likewise. * sysdeps/ia64/fpu/s_tanhl.S: Likewise. * sysdeps/ia64/fpu/s_scalblnf.c: Likewise. * sysdeps/ia64/fpu/w_lgamma.c: Likewise. * sysdeps/ia64/fpu/w_lgammaf.c: Likewise. * sysdeps/ia64/fpu/w_lgammal.c: Likewise. * sysdeps/ia64/fpu/w_tgamma.S: Likewise. * sysdeps/ia64/fpu/w_tgammaf.S: Likewise. * sysdeps/ia64/fpu/w_tgammal.S: Likewise. * sysdeps/ia64/fpu/e_gamma_r.c: New empty dummy-file. * sysdeps/ia64/fpu/e_gammaf_r.c: Likewise. * sysdeps/ia64/fpu/e_gammal_r.c: Likewise. * sysdeps/ia64/fpu/w_acosh.c: Likewise. * sysdeps/ia64/fpu/w_acoshf.c: Likewise. * sysdeps/ia64/fpu/w_acoshl.c: Likewise. * sysdeps/ia64/fpu/w_atanh.c: Likewise. * sysdeps/ia64/fpu/w_atanhf.c: Likewise. * sysdeps/ia64/fpu/w_atanhl.c: Likewise. * sysdeps/ia64/fpu/w_exp10.c: Likewise. * sysdeps/ia64/fpu/w_exp10f.c: Likewise. * sysdeps/ia64/fpu/w_exp10l.c: Likewise. * sysdeps/ia64/fpu/w_exp2.c: Likewise. * sysdeps/ia64/fpu/w_exp2f.c: Likewise. * sysdeps/ia64/fpu/w_exp2l.c: Likewise. * sysdeps/ia64/fpu/w_expl.c: Likewise. * sysdeps/ia64/fpu/e_expl.S: Likewise. * sysdeps/ia64/fpu/w_lgamma_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise. * sysdeps/ia64/fpu/w_lgammal_r.c: Likewise. * sysdeps/ia64/fpu/w_log2.c: Likewise. * sysdeps/ia64/fpu/w_log2f.c: Likewise. * sysdeps/ia64/fpu/w_log2l.c: Likewise. * sysdeps/ia64/fpu/w_sinh.c: Likewise. * sysdeps/ia64/fpu/w_sinhf.c: Likewise. * sysdeps/ia64/fpu/w_sinhl.c: Likewise. * sysdeps/ia64/fpu/libm_atan2_reg.S: Remove. * sysdeps/ia64/fpu/s_ldexp.S: Likewise. * sysdeps/ia64/fpu/s_ldexpf.S: Likewise. * sysdeps/ia64/fpu/s_ldexpl.S: Likewise. * sysdeps/ia64/fpu/s_scalbn.S: Likewise. * sysdeps/ia64/fpu/s_scalbnf.S: Likewise. * sysdeps/ia64/fpu/s_scalbnl.S: Likewise. * sysdeps/ia64/fpu/s_sincos.c: Make it an empty dummy-file. * sysdeps/ia64/fpu/s_sincosf.c: Likewise. * sysdeps/ia64/fpu/s_sincosl.c: Likewise. * sysdeps/ia64/fpu/e_atan2l.S: Add "Not needed" comment. * sysdeps/ia64/fpu/s_copysign.S: Add __libm_copysign{,f,l} alias for use by libm_error.c * sysdeps/ia64/fpu/Makefile (libm-sysdep_routines): Remove libm_atan2_reg, libm_tan, libm_frexp4{f,l}. Mention s_erfc{,f,l}, libm_frexp{,f,l}, libm_ldexp{,f,l}, libm_sincos{,f,l}, libm_sincos_large, libm_lgamma{,f,l}, libm_scalbn{,f,l}, libm_scalblnf. (sysdep_routines): Remove libm_frexp4{,f,l}. Mention libm_frexp{,f,l}, libm_ldexp{,f,l}, and libm_scalbn{,f,l}. (sysdep-CPPFLAGS): Add -include libm-symbols.h, -D__POSIX__, _D_LIB_VERSIONIMF=_LIB_VERSION, -DSIZE_LONG_INT_64, and -DSIZE_LONG_LONG_INT_64.
Diffstat (limited to 'sysdeps/ia64/fpu/e_coshl.S')
-rw-r--r--sysdeps/ia64/fpu/e_coshl.S1661
1 files changed, 796 insertions, 865 deletions
diff --git a/sysdeps/ia64/fpu/e_coshl.S b/sysdeps/ia64/fpu/e_coshl.S
index daac20d9a3..cef8be0b1a 100644
--- a/sysdeps/ia64/fpu/e_coshl.S
+++ b/sysdeps/ia64/fpu/e_coshl.S
@@ -1,10 +1,10 @@
.file "coshl.s"
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2002, Intel Corporation
// All rights reserved.
-//
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
// * The name of Intel Corporation may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.
-//
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,1129 +35,1060 @@
//
// Intel Corporation is the author of this code, and requests that all
// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
//
// History
//==============================================================
-// 2/02/00 Initial version
-// 4/04/00 Unwind support added
-// 8/15/00 Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
// set [the previously overwritten] GR_Parameter_RESULT.
-// 1/23/01 Set inexact flag for large args.
+// 01/23/01 Set inexact flag for large args.
+// 05/07/01 Reworked to improve speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 12/06/02 Improved performance
//
// API
//==============================================================
-// float = cosh(float)
-// double = cosh(double)
// long double = coshl(long double)
// input floating point f8
// output floating point f8
-
-
+//
+// Registers used
+//==============================================================
+// general registers:
+// r14 -> r40
+// predicate registers used:
+// p6 -> p11
+// floating-point registers used:
+// f9 -> f15; f32 -> f90;
+// f8 has input, then output
+//
// Overview of operation
//==============================================================
-// There are four paths
-
-// 1. |x| < 0.25 COSH_BY_POLY
-// 2. |x| < 32 COSH_BY_TBL
-// 3. |x| < 2^14 COSH_BY_EXP
-// 4. |x| >= 2^14 COSH_HUGE
-
-// For paths 1, and 2 SAFE is always 1.
-// For path 4, Safe is always 0.
-// SAFE = 1 means we cannot overflow.
-
-#include "libm_support.h"
-
+// There are seven paths
+// 1. 0 < |x| < 0.25 COSH_BY_POLY
+// 2. 0.25 <=|x| < 32 COSH_BY_TBL
+// 3. 32 <= |x| < 11357.21655 COSH_BY_EXP (merged path with COSH_BY_TBL)
+// 4. |x| >= 11357.21655 COSH_HUGE
+// 5. x=0 Done with early exit
+// 6. x=inf,nan Done with early exit
+// 7. x=denormal COSH_DENORM
+//
+// For double extended we get overflow for x >= 400c b174 ddc0 31ae c0ea
+// >= 11357.21655
+//
+//
+// 1. COSH_BY_POLY 0 < |x| < 0.25
+// ===============
+// Evaluate cosh(x) by a 12th order polynomial
+// Care is take for the order of multiplication; and P2 is not exactly 1/4!,
+// P3 is not exactly 1/6!, etc.
+// cosh(x) = 1 + (P1*x^2 + P2*x^4 + P3*x^6 + P4*x^8 + P5*x^10 + P6*x^12)
+//
+// 2. COSH_BY_TBL 0.25 <= |x| < 32.0
+// =============
+// cosh(x) = cosh(B+R)
+// = cosh(B)cosh(R) + sinh(B)sinh(R)
+//
+// ax = |x| = M*log2/64 + R
+// B = M*log2/64
+// M = 64*N + j
+// We will calculate M and get N as (M-j)/64
+// The division is a shift.
+// exp(B) = exp(N*log2 + j*log2/64)
+// = 2^N * 2^(j*log2/64)
+// cosh(B) = 1/2(e^B + e^-B)
+// = 1/2(2^N * 2^(j*log2/64) + 2^-N * 2^(-j*log2/64))
+// cosh(B) = (2^(N-1) * 2^(j*log2/64) + 2^(-N-1) * 2^(-j*log2/64))
+// sinh(B) = (2^(N-1) * 2^(j*log2/64) - 2^(-N-1) * 2^(-j*log2/64))
+// 2^(j*log2/64) is stored as Tjhi + Tjlo , j= -32,....,32
+// Tjhi is double-extended (80-bit) and Tjlo is single(32-bit)
+//
+// R = ax - M*log2/64
+// R = ax - M*log2_by_64_hi - M*log2_by_64_lo
+// exp(R) = 1 + R +R^2(1/2! + R(1/3! + R(1/4! + ... + R(1/n!)...)
+// = 1 + p_odd + p_even
+// where the p_even uses the A coefficients and the p_even uses
+// the B coefficients
+//
+// So sinh(R) = 1 + p_odd + p_even -(1 -p_odd -p_even)/2 = p_odd
+// cosh(R) = 1 + p_even
+// cosh(B) = C_hi + C_lo
+// sinh(B) = S_hi
+// cosh(x) = cosh(B)cosh(R) + sinh(B)sinh(R)
+//
+// 3. COSH_BY_EXP 32.0 <= |x| < 11357.21655 ( 400c b174 ddc0 31ae c0ea )
+// ==============
+// Can approximate result by exp(x)/2 in this region.
+// Y_hi = Tjhi
+// Y_lo = Tjhi * (p_odd + p_even) + Tjlo
+// cosh(x) = Y_hi + Y_lo
+//
+// 4. COSH_HUGE |x| >= 11357.21655 ( 400c b174 ddc0 31ae c0ea )
+// ============
+// Set error tag and call error support
+//
+//
// Assembly macros
//==============================================================
-cosh_FR_X = f44
-FR_RESULT = f44
-cosh_FR_SGNX = f40
-cosh_FR_all_ones = f45
-
-FR_X = f8
-FR_Y = f0
-cosh_FR_Inv_log2by64 = f9
-cosh_FR_log2by64_lo = f11
-cosh_FR_log2by64_hi = f10
-
-cosh_FR_A1 = f9
-cosh_FR_A2 = f10
-cosh_FR_A3 = f11
-
-cosh_FR_Rcub = f12
-cosh_FR_M_temp = f13
-cosh_FR_R_temp = f13
-cosh_FR_Rsq = f13
-cosh_FR_R = f14
-
-cosh_FR_M = f38
-
-cosh_FR_tmp = f15
-cosh_FR_B1 = f15
-cosh_FR_B2 = f32
-cosh_FR_B3 = f33
-
-cosh_FR_peven_temp1 = f34
-cosh_FR_peven_temp2 = f35
-cosh_FR_peven = f36
-
-cosh_FR_podd_temp1 = f34
-cosh_FR_podd_temp2 = f35
-cosh_FR_podd = f37
-
-cosh_FR_J_temp = f9
-cosh_FR_J = f10
-
-cosh_FR_Mmj = f39
-
-cosh_FR_N_temp1 = f11
-cosh_FR_N_temp2 = f12
-cosh_FR_N = f13
-
-cosh_FR_spos = f14
-cosh_FR_sneg = f15
-
-cosh_FR_Tjhi = f32
-cosh_FR_Tjlo = f33
-cosh_FR_Tmjhi = f34
-cosh_FR_Tmjlo = f35
-
-GR_mJ = r35
-GR_J = r36
-
-AD_mJ = r38
-AD_J = r39
-
-cosh_GR_all_ones = r40
-
-GR_SAVE_PFS = r41
-GR_SAVE_B0 = r42
-GR_SAVE_GP = r43
-GR_Parameter_X = r44
-GR_Parameter_Y = r45
-GR_Parameter_RESULT = r46
-GR_Parameter_TAG = r47
+r_ad5 = r14
+r_rshf_2to57 = r15
+r_exp_denorm = r15
+r_ad_mJ_lo = r15
+r_ad_J_lo = r16
+r_2Nm1 = r17
+r_2mNm1 = r18
+r_exp_x = r18
+r_ad_J_hi = r19
+r_ad2o = r19
+r_ad_mJ_hi = r20
+r_mj = r21
+r_ad2e = r22
+r_ad3 = r23
+r_ad1 = r24
+r_Mmj = r24
+r_rshf = r25
+r_M = r25
+r_N = r25
+r_jshf = r26
+r_exp_2tom57 = r26
+r_j = r26
+r_exp_mask = r27
+r_signexp_x = r28
+r_signexp_0_5 = r28
+r_exp_0_25 = r29
+r_sig_inv_ln2 = r30
+r_exp_32 = r30
+r_exp_huge = r30
+r_ad4 = r31
+
+GR_SAVE_PFS = r34
+GR_SAVE_B0 = r35
+GR_SAVE_GP = r36
+
+GR_Parameter_X = r37
+GR_Parameter_Y = r38
+GR_Parameter_RESULT = r39
+GR_Parameter_TAG = r40
+
+
+f_ABS_X = f9
+f_X2 = f10
+f_X4 = f11
+f_tmp = f14
+f_RSHF = f15
+
+f_Inv_log2by64 = f32
+f_log2by64_lo = f33
+f_log2by64_hi = f34
+f_A1 = f35
+
+f_A2 = f36
+f_A3 = f37
+f_Rcub = f38
+f_M_temp = f39
+f_R_temp = f40
+
+f_Rsq = f41
+f_R = f42
+f_M = f43
+f_B1 = f44
+f_B2 = f45
+
+f_B3 = f46
+f_peven_temp1 = f47
+f_peven_temp2 = f48
+f_peven = f49
+f_podd_temp1 = f50
+
+f_podd_temp2 = f51
+f_podd = f52
+f_poly65 = f53
+f_poly6543 = f53
+f_poly6to1 = f53
+f_poly43 = f54
+f_poly21 = f55
+
+f_X3 = f56
+f_INV_LN2_2TO63 = f57
+f_RSHF_2TO57 = f58
+f_2TOM57 = f59
+f_smlst_oflow_input = f60
+
+f_pre_result = f61
+f_huge = f62
+f_spos = f63
+f_sneg = f64
+f_Tjhi = f65
+
+f_Tjlo = f66
+f_Tmjhi = f67
+f_Tmjlo = f68
+f_S_hi = f69
+f_SC_hi_temp = f70
+
+f_C_lo_temp1 = f71
+f_C_lo_temp2 = f72
+f_C_lo_temp3 = f73
+f_C_lo_temp4 = f73
+f_C_lo = f74
+f_C_hi = f75
+
+f_Y_hi = f77
+f_Y_lo_temp = f78
+f_Y_lo = f79
+f_NORM_X = f80
+
+f_P1 = f81
+f_P2 = f82
+f_P3 = f83
+f_P4 = f84
+f_P5 = f85
+
+f_P6 = f86
+f_Tjhi_spos = f87
+f_Tjlo_spos = f88
+f_huge = f89
+f_signed_hi_lo = f90
-cosh_FR_C_hi = f9
-cosh_FR_C_hi_temp = f10
-cosh_FR_C_lo_temp1 = f11
-cosh_FR_C_lo_temp2 = f12
-cosh_FR_C_lo_temp3 = f13
-
-cosh_FR_C_lo = f38
-cosh_FR_S_hi = f39
-
-cosh_FR_S_hi_temp1 = f10
-cosh_FR_Y_hi = f11
-cosh_FR_Y_lo_temp = f12
-cosh_FR_Y_lo = f13
-cosh_FR_COSH = f9
-
-cosh_FR_X2 = f9
-cosh_FR_X4 = f10
-
-cosh_FR_P1 = f14
-cosh_FR_P2 = f15
-cosh_FR_P3 = f32
-cosh_FR_P4 = f33
-cosh_FR_P5 = f34
-cosh_FR_P6 = f35
-
-cosh_FR_TINY_THRESH = f9
-
-cosh_FR_COSH_temp = f10
-cosh_FR_SCALE = f11
-
-cosh_FR_hi_lo = f10
-
-cosh_FR_poly_podd_temp1 = f11
-cosh_FR_poly_podd_temp2 = f13
-cosh_FR_poly_peven_temp1 = f11
-cosh_FR_poly_peven_temp2 = f13
// Data tables
//==============================================================
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// DO NOT CHANGE ORDER OF THESE TABLES
+RODATA
.align 16
-double_cosh_arg_reduction:
-ASM_TYPE_DIRECTIVE(double_cosh_arg_reduction,@object)
- data8 0xB8AA3B295C17F0BC, 0x00004005
- data8 0xB17217F7D1000000, 0x00003FF8
- data8 0xCF79ABC9E3B39804, 0x00003FD0
-ASM_SIZE_DIRECTIVE(double_cosh_arg_reduction)
-
-double_cosh_p_table:
-ASM_TYPE_DIRECTIVE(double_cosh_p_table,@object)
- data8 0x8000000000000000, 0x00003FFE
- data8 0xAAAAAAAAAAAAAB80, 0x00003FFA
- data8 0xB60B60B60B4FE884, 0x00003FF5
- data8 0xD00D00D1021D7370, 0x00003FEF
- data8 0x93F27740C0C2F1CC, 0x00003FE9
- data8 0x8FA02AC65BCBD5BC, 0x00003FE2
-ASM_SIZE_DIRECTIVE(double_cosh_p_table)
-
-double_cosh_ab_table:
-ASM_TYPE_DIRECTIVE(double_cosh_ab_table,@object)
- data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC
- data8 0x88888888884ECDD5, 0x00003FF8
- data8 0xD00D0C6DCC26A86B, 0x00003FF2
- data8 0x8000000000000002, 0x00003FFE
- data8 0xAAAAAAAAAA402C77, 0x00003FFA
- data8 0xB60B6CC96BDB144D, 0x00003FF5
-ASM_SIZE_DIRECTIVE(double_cosh_ab_table)
-
-double_cosh_j_table:
-ASM_TYPE_DIRECTIVE(double_cosh_j_table,@object)
- data8 0xB504F333F9DE6484, 0x00003FFE, 0x1EB2FB13, 0x00000000
- data8 0xB6FD91E328D17791, 0x00003FFE, 0x1CE2CBE2, 0x00000000
- data8 0xB8FBAF4762FB9EE9, 0x00003FFE, 0x1DDC3CBC, 0x00000000
- data8 0xBAFF5AB2133E45FB, 0x00003FFE, 0x1EE9AA34, 0x00000000
- data8 0xBD08A39F580C36BF, 0x00003FFE, 0x9EAEFDC1, 0x00000000
- data8 0xBF1799B67A731083, 0x00003FFE, 0x9DBF517B, 0x00000000
- data8 0xC12C4CCA66709456, 0x00003FFE, 0x1EF88AFB, 0x00000000
- data8 0xC346CCDA24976407, 0x00003FFE, 0x1E03B216, 0x00000000
- data8 0xC5672A115506DADD, 0x00003FFE, 0x1E78AB43, 0x00000000
- data8 0xC78D74C8ABB9B15D, 0x00003FFE, 0x9E7B1747, 0x00000000
- data8 0xC9B9BD866E2F27A3, 0x00003FFE, 0x9EFE3C0E, 0x00000000
- data8 0xCBEC14FEF2727C5D, 0x00003FFE, 0x9D36F837, 0x00000000
- data8 0xCE248C151F8480E4, 0x00003FFE, 0x9DEE53E4, 0x00000000
- data8 0xD06333DAEF2B2595, 0x00003FFE, 0x9E24AE8E, 0x00000000
- data8 0xD2A81D91F12AE45A, 0x00003FFE, 0x1D912473, 0x00000000
- data8 0xD4F35AABCFEDFA1F, 0x00003FFE, 0x1EB243BE, 0x00000000
- data8 0xD744FCCAD69D6AF4, 0x00003FFE, 0x1E669A2F, 0x00000000
- data8 0xD99D15C278AFD7B6, 0x00003FFE, 0x9BBC610A, 0x00000000
- data8 0xDBFBB797DAF23755, 0x00003FFE, 0x1E761035, 0x00000000
- data8 0xDE60F4825E0E9124, 0x00003FFE, 0x9E0BE175, 0x00000000
- data8 0xE0CCDEEC2A94E111, 0x00003FFE, 0x1CCB12A1, 0x00000000
- data8 0xE33F8972BE8A5A51, 0x00003FFE, 0x1D1BFE90, 0x00000000
- data8 0xE5B906E77C8348A8, 0x00003FFE, 0x1DF2F47A, 0x00000000
- data8 0xE8396A503C4BDC68, 0x00003FFE, 0x1EF22F22, 0x00000000
- data8 0xEAC0C6E7DD24392F, 0x00003FFE, 0x9E3F4A29, 0x00000000
- data8 0xED4F301ED9942B84, 0x00003FFE, 0x1EC01A5B, 0x00000000
- data8 0xEFE4B99BDCDAF5CB, 0x00003FFE, 0x1E8CAC3A, 0x00000000
- data8 0xF281773C59FFB13A, 0x00003FFE, 0x9DBB3FAB, 0x00000000
- data8 0xF5257D152486CC2C, 0x00003FFE, 0x1EF73A19, 0x00000000
- data8 0xF7D0DF730AD13BB9, 0x00003FFE, 0x9BB795B5, 0x00000000
- data8 0xFA83B2DB722A033A, 0x00003FFE, 0x1EF84B76, 0x00000000
- data8 0xFD3E0C0CF486C175, 0x00003FFE, 0x9EF5818B, 0x00000000
- data8 0x8000000000000000, 0x00003FFF, 0x00000000, 0x00000000
- data8 0x8164D1F3BC030773, 0x00003FFF, 0x1F77CACA, 0x00000000
- data8 0x82CD8698AC2BA1D7, 0x00003FFF, 0x1EF8A91D, 0x00000000
- data8 0x843A28C3ACDE4046, 0x00003FFF, 0x1E57C976, 0x00000000
- data8 0x85AAC367CC487B15, 0x00003FFF, 0x9EE8DA92, 0x00000000
- data8 0x871F61969E8D1010, 0x00003FFF, 0x1EE85C9F, 0x00000000
- data8 0x88980E8092DA8527, 0x00003FFF, 0x1F3BF1AF, 0x00000000
- data8 0x8A14D575496EFD9A, 0x00003FFF, 0x1D80CA1E, 0x00000000
- data8 0x8B95C1E3EA8BD6E7, 0x00003FFF, 0x9D0373AF, 0x00000000
- data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF, 0x9F167097, 0x00000000
- data8 0x8EA4398B45CD53C0, 0x00003FFF, 0x1EB70051, 0x00000000
- data8 0x9031DC431466B1DC, 0x00003FFF, 0x1F6EB029, 0x00000000
- data8 0x91C3D373AB11C336, 0x00003FFF, 0x1DFD6D8E, 0x00000000
- data8 0x935A2B2F13E6E92C, 0x00003FFF, 0x9EB319B0, 0x00000000
- data8 0x94F4EFA8FEF70961, 0x00003FFF, 0x1EBA2BEB, 0x00000000
- data8 0x96942D3720185A00, 0x00003FFF, 0x1F11D537, 0x00000000
- data8 0x9837F0518DB8A96F, 0x00003FFF, 0x1F0D5A46, 0x00000000
- data8 0x99E0459320B7FA65, 0x00003FFF, 0x9E5E7BCA, 0x00000000
- data8 0x9B8D39B9D54E5539, 0x00003FFF, 0x9F3AAFD1, 0x00000000
- data8 0x9D3ED9A72CFFB751, 0x00003FFF, 0x9E86DACC, 0x00000000
- data8 0x9EF5326091A111AE, 0x00003FFF, 0x9F3EDDC2, 0x00000000
- data8 0xA0B0510FB9714FC2, 0x00003FFF, 0x1E496E3D, 0x00000000
- data8 0xA27043030C496819, 0x00003FFF, 0x9F490BF6, 0x00000000
- data8 0xA43515AE09E6809E, 0x00003FFF, 0x1DD1DB48, 0x00000000
- data8 0xA5FED6A9B15138EA, 0x00003FFF, 0x1E65EBFB, 0x00000000
- data8 0xA7CD93B4E965356A, 0x00003FFF, 0x9F427496, 0x00000000
- data8 0xA9A15AB4EA7C0EF8, 0x00003FFF, 0x1F283C4A, 0x00000000
- data8 0xAB7A39B5A93ED337, 0x00003FFF, 0x1F4B0047, 0x00000000
- data8 0xAD583EEA42A14AC6, 0x00003FFF, 0x1F130152, 0x00000000
- data8 0xAF3B78AD690A4375, 0x00003FFF, 0x9E8367C0, 0x00000000
- data8 0xB123F581D2AC2590, 0x00003FFF, 0x9F705F90, 0x00000000
- data8 0xB311C412A9112489, 0x00003FFF, 0x1EFB3C53, 0x00000000
- data8 0xB504F333F9DE6484, 0x00003FFF, 0x1F32FB13, 0x00000000
-ASM_SIZE_DIRECTIVE(double_cosh_j_table)
-
-.align 32
-.global coshl#
-
-.section .text
-.proc coshl#
-.align 32
-
-coshl:
-
-#ifdef _LIBC
-.global __ieee754_coshl#
-.proc __ieee754_coshl#
-__ieee754_coshl:
-#endif
-
-// X NAN?
-
-{ .mfi
- alloc r32 = ar.pfs,0,12,4,0
-(p0) fclass.m.unc p6,p7 = f8, 0xc3
- mov cosh_GR_all_ones = -1
-};;
-
-// This is more than we need but it is in preparation
-// for the values we add for error support. We push three
-// addresses on the stack (3*8) = 24 bytes and one tag
-
-{ .mfb
- nop.m 999
-(p6) fma.s0 f8 = f8,f1,f8
-(p6) br.ret.spnt b0 ;;
-}
-
-
-// Make constant that will generate inexact when squared
-// X infinity
-{ .mfi
- setf.sig cosh_FR_all_ones = cosh_GR_all_ones
-(p0) fclass.m.unc p6,p0 = f8, 0x23
- nop.i 999 ;;
-}
-
-{ .mfb
- nop.m 999
-(p6) fmerge.s f8 = f0,f8
-(p6) br.ret.spnt b0 ;;
-}
+LOCAL_OBJECT_START(cosh_arg_reduction)
+// data8 0xB8AA3B295C17F0BC, 0x00004005 // 64/log2 -- signif loaded with setf
+ data8 0xB17217F7D1000000, 0x00003FF8 // log2/64 high part
+ data8 0xCF79ABC9E3B39804, 0x00003FD0 // log2/64 low part
+ data8 0xb174ddc031aec0ea, 0x0000400c // Smallest x to overflow (11357.21655)
+LOCAL_OBJECT_END(cosh_arg_reduction)
+
+LOCAL_OBJECT_START(cosh_p_table)
+ data8 0x8FA02AC65BCBD5BC, 0x00003FE2 // P6
+ data8 0xD00D00D1021D7370, 0x00003FEF // P4
+ data8 0xAAAAAAAAAAAAAB80, 0x00003FFA // P2
+ data8 0x93F27740C0C2F1CC, 0x00003FE9 // P5
+ data8 0xB60B60B60B4FE884, 0x00003FF5 // P3
+ data8 0x8000000000000000, 0x00003FFE // P1
+LOCAL_OBJECT_END(cosh_p_table)
+
+LOCAL_OBJECT_START(cosh_ab_table)
+ data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC // A1
+ data8 0x88888888884ECDD5, 0x00003FF8 // A2
+ data8 0xD00D0C6DCC26A86B, 0x00003FF2 // A3
+ data8 0x8000000000000002, 0x00003FFE // B1
+ data8 0xAAAAAAAAAA402C77, 0x00003FFA // B2
+ data8 0xB60B6CC96BDB144D, 0x00003FF5 // B3
+LOCAL_OBJECT_END(cosh_ab_table)
+
+LOCAL_OBJECT_START(cosh_j_hi_table)
+ data8 0xB504F333F9DE6484, 0x00003FFE
+ data8 0xB6FD91E328D17791, 0x00003FFE
+ data8 0xB8FBAF4762FB9EE9, 0x00003FFE
+ data8 0xBAFF5AB2133E45FB, 0x00003FFE
+ data8 0xBD08A39F580C36BF, 0x00003FFE
+ data8 0xBF1799B67A731083, 0x00003FFE
+ data8 0xC12C4CCA66709456, 0x00003FFE
+ data8 0xC346CCDA24976407, 0x00003FFE
+ data8 0xC5672A115506DADD, 0x00003FFE
+ data8 0xC78D74C8ABB9B15D, 0x00003FFE
+ data8 0xC9B9BD866E2F27A3, 0x00003FFE
+ data8 0xCBEC14FEF2727C5D, 0x00003FFE
+ data8 0xCE248C151F8480E4, 0x00003FFE
+ data8 0xD06333DAEF2B2595, 0x00003FFE
+ data8 0xD2A81D91F12AE45A, 0x00003FFE
+ data8 0xD4F35AABCFEDFA1F, 0x00003FFE
+ data8 0xD744FCCAD69D6AF4, 0x00003FFE
+ data8 0xD99D15C278AFD7B6, 0x00003FFE
+ data8 0xDBFBB797DAF23755, 0x00003FFE
+ data8 0xDE60F4825E0E9124, 0x00003FFE
+ data8 0xE0CCDEEC2A94E111, 0x00003FFE
+ data8 0xE33F8972BE8A5A51, 0x00003FFE
+ data8 0xE5B906E77C8348A8, 0x00003FFE
+ data8 0xE8396A503C4BDC68, 0x00003FFE
+ data8 0xEAC0C6E7DD24392F, 0x00003FFE
+ data8 0xED4F301ED9942B84, 0x00003FFE
+ data8 0xEFE4B99BDCDAF5CB, 0x00003FFE
+ data8 0xF281773C59FFB13A, 0x00003FFE
+ data8 0xF5257D152486CC2C, 0x00003FFE
+ data8 0xF7D0DF730AD13BB9, 0x00003FFE
+ data8 0xFA83B2DB722A033A, 0x00003FFE
+ data8 0xFD3E0C0CF486C175, 0x00003FFE
+ data8 0x8000000000000000, 0x00003FFF // Center of table
+ data8 0x8164D1F3BC030773, 0x00003FFF
+ data8 0x82CD8698AC2BA1D7, 0x00003FFF
+ data8 0x843A28C3ACDE4046, 0x00003FFF
+ data8 0x85AAC367CC487B15, 0x00003FFF
+ data8 0x871F61969E8D1010, 0x00003FFF
+ data8 0x88980E8092DA8527, 0x00003FFF
+ data8 0x8A14D575496EFD9A, 0x00003FFF
+ data8 0x8B95C1E3EA8BD6E7, 0x00003FFF
+ data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF
+ data8 0x8EA4398B45CD53C0, 0x00003FFF
+ data8 0x9031DC431466B1DC, 0x00003FFF
+ data8 0x91C3D373AB11C336, 0x00003FFF
+ data8 0x935A2B2F13E6E92C, 0x00003FFF
+ data8 0x94F4EFA8FEF70961, 0x00003FFF
+ data8 0x96942D3720185A00, 0x00003FFF
+ data8 0x9837F0518DB8A96F, 0x00003FFF
+ data8 0x99E0459320B7FA65, 0x00003FFF
+ data8 0x9B8D39B9D54E5539, 0x00003FFF
+ data8 0x9D3ED9A72CFFB751, 0x00003FFF
+ data8 0x9EF5326091A111AE, 0x00003FFF
+ data8 0xA0B0510FB9714FC2, 0x00003FFF
+ data8 0xA27043030C496819, 0x00003FFF
+ data8 0xA43515AE09E6809E, 0x00003FFF
+ data8 0xA5FED6A9B15138EA, 0x00003FFF
+ data8 0xA7CD93B4E965356A, 0x00003FFF
+ data8 0xA9A15AB4EA7C0EF8, 0x00003FFF
+ data8 0xAB7A39B5A93ED337, 0x00003FFF
+ data8 0xAD583EEA42A14AC6, 0x00003FFF
+ data8 0xAF3B78AD690A4375, 0x00003FFF
+ data8 0xB123F581D2AC2590, 0x00003FFF
+ data8 0xB311C412A9112489, 0x00003FFF
+ data8 0xB504F333F9DE6484, 0x00003FFF
+LOCAL_OBJECT_END(cosh_j_hi_table)
+
+LOCAL_OBJECT_START(cosh_j_lo_table)
+ data4 0x1EB2FB13
+ data4 0x1CE2CBE2
+ data4 0x1DDC3CBC
+ data4 0x1EE9AA34
+ data4 0x9EAEFDC1
+ data4 0x9DBF517B
+ data4 0x1EF88AFB
+ data4 0x1E03B216
+ data4 0x1E78AB43
+ data4 0x9E7B1747
+ data4 0x9EFE3C0E
+ data4 0x9D36F837
+ data4 0x9DEE53E4
+ data4 0x9E24AE8E
+ data4 0x1D912473
+ data4 0x1EB243BE
+ data4 0x1E669A2F
+ data4 0x9BBC610A
+ data4 0x1E761035
+ data4 0x9E0BE175
+ data4 0x1CCB12A1
+ data4 0x1D1BFE90
+ data4 0x1DF2F47A
+ data4 0x1EF22F22
+ data4 0x9E3F4A29
+ data4 0x1EC01A5B
+ data4 0x1E8CAC3A
+ data4 0x9DBB3FAB
+ data4 0x1EF73A19
+ data4 0x9BB795B5
+ data4 0x1EF84B76
+ data4 0x9EF5818B
+ data4 0x00000000 // Center of table
+ data4 0x1F77CACA
+ data4 0x1EF8A91D
+ data4 0x1E57C976
+ data4 0x9EE8DA92
+ data4 0x1EE85C9F
+ data4 0x1F3BF1AF
+ data4 0x1D80CA1E
+ data4 0x9D0373AF
+ data4 0x9F167097
+ data4 0x1EB70051
+ data4 0x1F6EB029
+ data4 0x1DFD6D8E
+ data4 0x9EB319B0
+ data4 0x1EBA2BEB
+ data4 0x1F11D537
+ data4 0x1F0D5A46
+ data4 0x9E5E7BCA
+ data4 0x9F3AAFD1
+ data4 0x9E86DACC
+ data4 0x9F3EDDC2
+ data4 0x1E496E3D
+ data4 0x9F490BF6
+ data4 0x1DD1DB48
+ data4 0x1E65EBFB
+ data4 0x9F427496
+ data4 0x1F283C4A
+ data4 0x1F4B0047
+ data4 0x1F130152
+ data4 0x9E8367C0
+ data4 0x9F705F90
+ data4 0x1EFB3C53
+ data4 0x1F32FB13
+LOCAL_OBJECT_END(cosh_j_lo_table)
+.section .text
+GLOBAL_IEEE754_ENTRY(coshl)
-// Put 0.25 in f9; p6 true if x < 0.25
{ .mlx
- nop.m 999
-(p0) movl r32 = 0x000000000000fffd ;;
-}
-
-{ .mfi
-(p0) setf.exp f9 = r32
- nop.f 999
- nop.i 999 ;;
+ getf.exp r_signexp_x = f8 // Get signexp of x, must redo if unorm
+ movl r_sig_inv_ln2 = 0xb8aa3b295c17f0bc // significand of 1/ln2
}
-
-{ .mfi
- nop.m 999
-(p0) fmerge.s cosh_FR_X = f0,f8
- nop.i 999
+{ .mlx
+ addl r_ad1 = @ltoff(cosh_arg_reduction), gp
+ movl r_rshf_2to57 = 0x4778000000000000 // 1.10000 2^(63+57)
}
+;;
{ .mfi
- nop.m 999
-(p0) fmerge.s cosh_FR_SGNX = f8,f1
- nop.i 999 ;;
+ ld8 r_ad1 = [r_ad1]
+ fmerge.s f_ABS_X = f0,f8
+ mov r_exp_0_25 = 0x0fffd // Form exponent for 0.25
}
-
{ .mfi
- nop.m 999
-(p0) fcmp.lt.unc p0,p7 = cosh_FR_X,f9
- nop.i 999 ;;
-}
-
-{ .mib
- nop.m 999
- nop.i 999
-(p7) br.cond.sptk L(COSH_BY_TBL)
+ nop.m 0
+ fnorm.s1 f_NORM_X = f8
+ mov r_exp_2tom57 = 0xffff-57
}
;;
-
-// COSH_BY_POLY:
-// POLY cannot overflow so there is no need to call __libm_error_support
-// Get the values of P_x from the table
-
-{ .mmi
- nop.m 999
-(p0) addl r34 = @ltoff(double_cosh_p_table), gp
- nop.i 999
+{ .mfi
+ setf.d f_RSHF_2TO57 = r_rshf_2to57 // Form const 1.100 * 2^120
+ fclass.m p10,p0 = f8, 0x0b // Test for denorm
+ mov r_exp_mask = 0x1ffff
}
-;;
-
-{ .mmi
- ld8 r34 = [r34]
- nop.m 999
- nop.i 999
+{ .mlx
+ setf.sig f_INV_LN2_2TO63 = r_sig_inv_ln2 // Form 1/ln2 * 2^63
+ movl r_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift
}
;;
-
-// Calculate cosh_FR_X2 = ax*ax and cosh_FR_X4 = ax*ax*ax*ax
-{ .mmf
- nop.m 999
-(p0) ldfe cosh_FR_P1 = [r34],16
-(p0) fma.s1 cosh_FR_X2 = cosh_FR_X, cosh_FR_X, f0 ;;
-}
-
-{ .mmi
-(p0) ldfe cosh_FR_P2 = [r34],16 ;;
-(p0) ldfe cosh_FR_P3 = [r34],16
- nop.i 999 ;;
-}
-
-{ .mmi
-(p0) ldfe cosh_FR_P4 = [r34],16 ;;
-(p0) ldfe cosh_FR_P5 = [r34],16
- nop.i 999 ;;
-}
-
{ .mfi
-(p0) ldfe cosh_FR_P6 = [r34],16
-(p0) fma.s1 cosh_FR_X4 = cosh_FR_X2, cosh_FR_X2, f0
- nop.i 999 ;;
+ nop.m 0
+ fclass.m p7,p0 = f8, 0x07 // Test if x=0
+ nop.i 0
}
-
-// Calculate cosh_FR_podd = x4 *(x4 * P_5 + P_3) + P_1
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_poly_podd_temp1 = cosh_FR_X4, cosh_FR_P5, cosh_FR_P3
- nop.i 999 ;;
+ setf.exp f_2TOM57 = r_exp_2tom57 // Form 2^-57 for scaling
+ nop.f 0
+ add r_ad3 = 0x90, r_ad1 // Point to ab_table
}
+;;
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_podd = cosh_FR_X4, cosh_FR_poly_podd_temp1, cosh_FR_P1
- nop.i 999
+ setf.d f_RSHF = r_rshf // Form right shift const 1.100 * 2^63
+ fclass.m p6,p0 = f8, 0xe3 // Test if x nan, inf
+ add r_ad4 = 0x2f0, r_ad1 // Point to j_hi_table midpoint
}
-
-// Calculate cosh_FR_peven = p_even = x4 *(x4 * (x4 * P_6 + P_4) + P_2)
-{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_poly_peven_temp1 = cosh_FR_X4, cosh_FR_P6, cosh_FR_P4
- nop.i 999 ;;
+{ .mib
+ add r_ad2e = 0x20, r_ad1 // Point to p_table
+ nop.i 0
+(p10) br.cond.spnt COSH_DENORM // Branch if x denorm
}
+;;
+// Common path -- return here from COSH_DENORM if x is unnorm
+COSH_COMMON:
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_poly_peven_temp2 = cosh_FR_X4, cosh_FR_poly_peven_temp1, cosh_FR_P2
- nop.i 999 ;;
+ ldfe f_smlst_oflow_input = [r_ad2e],16
+(p7) fma.s0 f8 = f1, f1, f0 // Result = 1.0 if x=0
+ add r_ad5 = 0x580, r_ad1 // Point to j_lo_table midpoint
}
-
-{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_peven = cosh_FR_X4, cosh_FR_poly_peven_temp2, f0
- nop.i 999 ;;
+{ .mib
+ ldfe f_log2by64_hi = [r_ad1],16
+ and r_exp_x = r_exp_mask, r_signexp_x
+(p7) br.ret.spnt b0 // Exit if x=0
}
+;;
-// Y_lo = x2*p_odd + p_even
-// Calculate f8 = Y_hi + Y_lo
+// Get the A coefficients for COSH_BY_TBL
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_Y_lo = cosh_FR_X2, cosh_FR_podd, cosh_FR_peven
- nop.i 999 ;;
+ ldfe f_A1 = [r_ad3],16
+ fcmp.lt.s1 p8,p9 = f8,f0 // Test for x<0
+ cmp.lt p7,p0 = r_exp_x, r_exp_0_25 // Test x < 0.25
}
-
{ .mfb
- nop.m 999
-(p0) fma.s0 f8 = f1, f1, cosh_FR_Y_lo
-(p0) br.ret.sptk b0 ;;
-}
-
-
-L(COSH_BY_TBL):
-
-// Now that we are at TBL; so far all we know is that |x| >= 0.25.
-// The first two steps are the same for TBL and EXP, but if we are HUGE
-// Double Extended
-// Go to HUGE if |x| >= 2^14, 1000d (register-biased) is e = 14 (true)
-// Double
-// Go to HUGE if |x| >= 2^10, 10009 (register-biased) is e = 10 (true)
-// Single
-// Go to HUGE if |x| >= 2^7, 10006 (register-biased) is e = 7 (true)
-// we want to leave now. Go to HUGE if |x| >= 2^14
-// 1000d (register-biased) is e = 14 (true)
-
-{ .mlx
- nop.m 999
-(p0) movl r32 = 0x000000000001000d ;;
-}
-
-{ .mfi
-(p0) setf.exp f9 = r32
- nop.f 999
- nop.i 999 ;;
+ add r_ad2o = 0x30, r_ad2e // Point to p_table odd coeffs
+(p6) fma.s0 f8 = f8,f8,f0 // Result for x nan, inf
+(p6) br.ret.spnt b0 // Exit for x nan, inf
}
+;;
+// Calculate X2 = ax*ax for COSH_BY_POLY
{ .mfi
- nop.m 999
-(p0) fcmp.ge.unc p6,p7 = cosh_FR_X,f9
- nop.i 999 ;;
+ ldfe f_log2by64_lo = [r_ad1],16
+ nop.f 0
+ nop.i 0
}
-
-{ .mib
- nop.m 999
- nop.i 999
-(p6) br.cond.spnt L(COSH_HUGE) ;;
+{ .mfb
+ ldfe f_A2 = [r_ad3],16
+ fma.s1 f_X2 = f_NORM_X, f_NORM_X, f0
+(p7) br.cond.spnt COSH_BY_POLY
}
+;;
-// r32 = 1
-// r34 = N-1
-// r35 = N
-// r36 = j
-// r37 = N+1
-
-// TBL can never overflow
-// cosh(x) = cosh(B+R)
-// = cosh(B) cosh(R) + sinh(B) sinh(R)
-// cosh(R) can be approximated by 1 + p_even
-// sinh(R) can be approximated by p_odd
-
+// Here if |x| >= 0.25
+COSH_BY_TBL:
// ******************************************************
-// STEP 1 (TBL and EXP)
+// STEP 1 (TBL and EXP) - Argument reduction
// ******************************************************
-// Get the following constants.
-// f9 = Inv_log2by64
-// f10 = log2by64_hi
-// f11 = log2by64_lo
+// Get the following constants.
+// Inv_log2by64
+// log2by64_hi
+// log2by64_lo
-{ .mmi
-(p0) adds r32 = 0x1,r0
-(p0) addl r34 = @ltoff(double_cosh_arg_reduction), gp
- nop.i 999
-}
-;;
// We want 2^(N-1) and 2^(-N-1). So bias N-1 and -N-1 and
// put them in an exponent.
-// cosh_FR_spos = 2^(N-1) and cosh_FR_sneg = 2^(-N-1)
-// r39 = 0xffff + (N-1) = 0xffff +N -1
-// r40 = 0xffff - (N +1) = 0xffff -N -1
-
-{ .mlx
- ld8 r34 = [r34]
-(p0) movl r38 = 0x000000000000fffe ;;
-}
+// f_spos = 2^(N-1) and f_sneg = 2^(-N-1)
+// 0xffff + (N-1) = 0xffff +N -1
+// 0xffff - (N +1) = 0xffff -N -1
-{ .mmi
-(p0) ldfe cosh_FR_Inv_log2by64 = [r34],16 ;;
-(p0) ldfe cosh_FR_log2by64_hi = [r34],16
- nop.i 999 ;;
-}
-
-{ .mbb
-(p0) ldfe cosh_FR_log2by64_lo = [r34],16
- nop.b 999
- nop.b 999 ;;
-}
-
-// Get the A coefficients
-// f9 = A_1
-// f10 = A_2
-// f11 = A_3
-{ .mmi
- nop.m 999
-(p0) addl r34 = @ltoff(double_cosh_ab_table), gp
- nop.i 999
-}
-;;
+// Calculate M and keep it as integer and floating point.
+// M = round-to-integer(x*Inv_log2by64)
+// f_M = M = truncate(ax/(log2/64))
+// Put the integer representation of M in r_M
+// and the floating point representation of M in f_M
+// Get the remaining A,B coefficients
{ .mmi
- ld8 r34 = [r34]
- nop.m 999
- nop.i 999
+ ldfe f_A3 = [r_ad3],16
+ nop.m 0
+ nop.i 0
}
;;
-
-// Calculate M and keep it as integer and floating point.
-// M = round-to-integer(x*Inv_log2by64)
-// cosh_FR_M = M = truncate(ax/(log2/64))
-// Put the significand of M in r35
-// and the floating point representation of M in cosh_FR_M
-
+// Use constant (1.100*2^(63-6)) to get rounded M into rightmost significand
+// |x| * 64 * 1/ln2 * 2^(63-6) + 1.1000 * 2^(63+(63-6))
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_M = cosh_FR_X, cosh_FR_Inv_log2by64, f0
- nop.i 999
+ nop.m 0
+ fma.s1 f_M_temp = f_ABS_X, f_INV_LN2_2TO63, f_RSHF_2TO57
+ mov r_signexp_0_5 = 0x0fffe // signexp of +0.5
}
+;;
+// Test for |x| >= overflow limit
{ .mfi
-(p0) ldfe cosh_FR_A1 = [r34],16
- nop.f 999
- nop.i 999 ;;
+ ldfe f_B1 = [r_ad3],16
+ fcmp.ge.s1 p6,p0 = f_ABS_X, f_smlst_oflow_input
+ nop.i 0
}
+;;
{ .mfi
- nop.m 999
-(p0) fcvt.fx.s1 cosh_FR_M_temp = cosh_FR_M
- nop.i 999 ;;
+ ldfe f_B2 = [r_ad3],16
+ nop.f 0
+ mov r_exp_32 = 0x10004
}
+;;
-{ .mfi
- nop.m 999
-(p0) fnorm.s1 cosh_FR_M = cosh_FR_M_temp
- nop.i 999 ;;
+// Subtract RSHF constant to get rounded M as a floating point value
+// M_temp * 2^(63-6) - 2^63
+{ .mfb
+ ldfe f_B3 = [r_ad3],16
+ fms.s1 f_M = f_M_temp, f_2TOM57, f_RSHF
+(p6) br.cond.spnt COSH_HUGE // Branch if result will overflow
}
+;;
{ .mfi
-(p0) getf.sig r35 = cosh_FR_M_temp
- nop.f 999
- nop.i 999 ;;
+ getf.sig r_M = f_M_temp
+ nop.f 0
+ cmp.ge p7,p6 = r_exp_x, r_exp_32 // Test if x >= 32
}
+;;
-// M is still in r35. Calculate j. j is the signed extension of the six lsb of M. It
+// Calculate j. j is the signed extension of the six lsb of M. It
// has a range of -32 thru 31.
-// r35 = M
-// r36 = j
-{ .mii
- nop.m 999
- nop.i 999 ;;
-(p0) and r36 = 0x3f, r35 ;;
-}
// Calculate R
-// f13 = f44 - f12*f10 = x - M*log2by64_hi
-// f14 = f13 - f8*f11 = R = (x - M*log2by64_hi) - M*log2by64_lo
-
-{ .mfi
- nop.m 999
-(p0) fnma.s1 cosh_FR_R_temp = cosh_FR_M, cosh_FR_log2by64_hi, cosh_FR_X
- nop.i 999
-}
+// ax - M*log2by64_hi
+// R = (ax - M*log2by64_hi) - M*log2by64_lo
{ .mfi
-(p0) ldfe cosh_FR_A2 = [r34],16
- nop.f 999
- nop.i 999 ;;
+ nop.m 0
+ fnma.s1 f_R_temp = f_M, f_log2by64_hi, f_ABS_X
+ and r_j = 0x3f, r_M
}
+;;
-{ .mfi
- nop.m 999
-(p0) fnma.s1 cosh_FR_R = cosh_FR_M, cosh_FR_log2by64_lo, cosh_FR_R_temp
- nop.i 999
+{ .mii
+ nop.m 0
+ shl r_jshf = r_j, 0x2 // Shift j so can sign extend it
+;;
+ sxt1 r_jshf = r_jshf
}
+;;
-// Get the B coefficients
-// f15 = B_1
-// f32 = B_2
-// f33 = B_3
-
-{ .mmi
-(p0) ldfe cosh_FR_A3 = [r34],16 ;;
-(p0) ldfe cosh_FR_B1 = [r34],16
- nop.i 999 ;;
+{ .mii
+ nop.m 0
+ shr r_j = r_jshf, 0x2 // Now j has range -32 to 31
+ nop.i 0
}
+;;
{ .mmi
-(p0) ldfe cosh_FR_B2 = [r34],16 ;;
-(p0) ldfe cosh_FR_B3 = [r34],16
- nop.i 999 ;;
+ shladd r_ad_J_hi = r_j, 4, r_ad4 // pointer to Tjhi
+ sub r_Mmj = r_M, r_j // M-j
+ sub r_mj = r0, r_j // Form -j
}
+;;
-{ .mii
- nop.m 999
-(p0) shl r34 = r36, 0x2 ;;
-(p0) sxt1 r37 = r34 ;;
+// The TBL and EXP branches are merged and predicated
+// If TBL, p6 true, 0.25 <= |x| < 32
+// If EXP, p7 true, 32 <= |x| < overflow_limit
+//
+// N = (M-j)/64
+{ .mfi
+ ldfe f_Tjhi = [r_ad_J_hi]
+ fnma.s1 f_R = f_M, f_log2by64_lo, f_R_temp
+ shr r_N = r_Mmj, 0x6 // N = (M-j)/64
}
-
-// ******************************************************
-// STEP 2 (TBL and EXP)
-// ******************************************************
-// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
-// f12 = R*R*R
-// f13 = R*R
-// f14 = R <== from above
-
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_Rsq = cosh_FR_R, cosh_FR_R, f0
-(p0) shr r36 = r37, 0x2 ;;
+ shladd r_ad_mJ_hi = r_mj, 4, r_ad4 // pointer to Tmjhi
+ nop.f 0
+ shladd r_ad_mJ_lo = r_mj, 2, r_ad5 // pointer to Tmjlo
}
+;;
-// r34 = M-j = r35 - r36
-// r35 = N = (M-j)/64
-
-{ .mii
-(p0) sub r34 = r35, r36
- nop.i 999 ;;
-(p0) shr r35 = r34, 0x6 ;;
+{ .mfi
+ sub r_2mNm1 = r_signexp_0_5, r_N // signexp 2^(-N-1)
+ nop.f 0
+ shladd r_ad_J_lo = r_j, 2, r_ad5 // pointer to Tjlo
}
-
-{ .mii
-(p0) sub r40 = r38, r35
-(p0) adds r37 = 0x1, r35
-(p0) add r39 = r38, r35 ;;
+{ .mfi
+ ldfe f_Tmjhi = [r_ad_mJ_hi]
+ nop.f 0
+ add r_2Nm1 = r_signexp_0_5, r_N // signexp 2^(N-1)
}
+;;
-// Get the address of the J table, add the offset,
-// addresses are sinh_AD_mJ and sinh_AD_J, get the T value
-// f32 = T(j)_hi
-// f33 = T(j)_lo
-// f34 = T(-j)_hi
-// f35 = T(-j)_lo
-
-{ .mmi
-(p0) sub r34 = r35, r32
-(p0) addl r37 = @ltoff(double_cosh_j_table), gp
- nop.i 999
+{ .mmf
+ ldfs f_Tmjlo = [r_ad_mJ_lo]
+ setf.exp f_sneg = r_2mNm1 // Form 2^(-N-1)
+ nop.f 0
}
;;
-{ .mfi
- ld8 r37 = [r37]
-(p0) fma.s1 cosh_FR_Rcub = cosh_FR_Rsq, cosh_FR_R, f0
- nop.i 999
+{ .mmf
+ ldfs f_Tjlo = [r_ad_J_lo]
+ setf.exp f_spos = r_2Nm1 // Form 2^(N-1)
+ nop.f 0
}
+;;
// ******************************************************
-// STEP 3 Now decide if we need to branch to EXP
+// STEP 2 (TBL and EXP)
// ******************************************************
-// Put 32 in f9; p6 true if x < 32
+// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
-{ .mlx
- nop.m 999
-(p0) movl r32 = 0x0000000000010004 ;;
+{ .mmf
+ nop.m 0
+ nop.m 0
+ fma.s1 f_Rsq = f_R, f_R, f0
}
+;;
-// Calculate p_even
-// f34 = B_2 + Rsq *B_3
-// f35 = B_1 + Rsq*f34 = B_1 + Rsq * (B_2 + Rsq *B_3)
-// f36 = peven = Rsq * f35 = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
-
-{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_peven_temp1 = cosh_FR_Rsq, cosh_FR_B3, cosh_FR_B2
- nop.i 999 ;;
-}
+// Calculate p_even
+// B_2 + Rsq *B_3
+// B_1 + Rsq * (B_2 + Rsq *B_3)
+// p_even = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_peven_temp2 = cosh_FR_Rsq, cosh_FR_peven_temp1, cosh_FR_B1
- nop.i 999
+ nop.m 0
+ fma.s1 f_peven_temp1 = f_Rsq, f_B3, f_B2
+ nop.i 0
}
-
// Calculate p_odd
-// f34 = A_2 + Rsq *A_3
-// f35 = A_1 + Rsq * (A_2 + Rsq *A_3)
-// f37 = podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
-
+// A_2 + Rsq *A_3
+// A_1 + Rsq * (A_2 + Rsq *A_3)
+// podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_podd_temp1 = cosh_FR_Rsq, cosh_FR_A3, cosh_FR_A2
- nop.i 999 ;;
+ nop.m 0
+ fma.s1 f_podd_temp1 = f_Rsq, f_A3, f_A2
+ nop.i 0
}
+;;
{ .mfi
-(p0) setf.exp cosh_FR_N_temp1 = r39
- nop.f 999
- nop.i 999 ;;
+ nop.m 0
+ fma.s1 f_Rcub = f_Rsq, f_R, f0
+ nop.i 0
}
+;;
-{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_peven = cosh_FR_Rsq, cosh_FR_peven_temp2, f0
- nop.i 999
-}
+//
+// If TBL,
+// Calculate S_hi and S_lo, and C_hi
+// SC_hi_temp = sneg * Tmjhi
+// S_hi = spos * Tjhi - SC_hi_temp
+// S_hi = spos * Tjhi - (sneg * Tmjhi)
+// C_hi = spos * Tjhi + SC_hi_temp
+// C_hi = spos * Tjhi + (sneg * Tmjhi)
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_podd_temp2 = cosh_FR_Rsq, cosh_FR_podd_temp1, cosh_FR_A1
- nop.i 999 ;;
+ nop.m 0
+(p6) fma.s1 f_SC_hi_temp = f_sneg, f_Tmjhi, f0
+ nop.i 0
}
+;;
+// If TBL,
+// C_lo_temp3 = sneg * Tmjlo
+// C_lo_temp4 = spos * Tjlo + C_lo_temp3
+// C_lo_temp4 = spos * Tjlo + (sneg * Tmjlo)
{ .mfi
-(p0) setf.exp f9 = r32
- nop.f 999
- nop.i 999 ;;
+ nop.m 0
+(p6) fma.s1 f_C_lo_temp3 = f_sneg, f_Tmjlo, f0
+ nop.i 0
}
+;;
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_podd = cosh_FR_podd_temp2, cosh_FR_Rcub, cosh_FR_R
- nop.i 999
-}
-
-// sinh_GR_mj contains the table offset for -j
-// sinh_GR_j contains the table offset for +j
-// p6 is true when j <= 0
-
-{ .mlx
-(p0) setf.exp cosh_FR_N_temp2 = r40
-(p0) movl r40 = 0x0000000000000020 ;;
+ nop.m 0
+ fma.s1 f_peven_temp2 = f_Rsq, f_peven_temp1, f_B1
+ nop.i 0
}
-
{ .mfi
-(p0) sub GR_mJ = r40, r36
-(p0) fmerge.se cosh_FR_spos = cosh_FR_N_temp1, f1
-(p0) adds GR_J = 0x20, r36 ;;
+ nop.m 0
+ fma.s1 f_podd_temp2 = f_Rsq, f_podd_temp1, f_A1
+ nop.i 0
}
+;;
-{ .mii
- nop.m 999
-(p0) shl GR_mJ = GR_mJ, 5 ;;
-(p0) add AD_mJ = r37, GR_mJ ;;
+// If EXP,
+// Compute 2^(N-1) * Tjhi and 2^(N-1) * Tjlo
+{ .mfi
+ nop.m 0
+(p7) fma.s1 f_Tjhi_spos = f_Tjhi, f_spos, f0
+ nop.i 0
}
-
-{ .mmi
- nop.m 999
-(p0) ldfe cosh_FR_Tmjhi = [AD_mJ],16
-(p0) shl GR_J = GR_J, 5 ;;
+{ .mfi
+ nop.m 0
+(p7) fma.s1 f_Tjlo_spos = f_Tjlo, f_spos, f0
+ nop.i 0
}
+;;
{ .mfi
-(p0) ldfs cosh_FR_Tmjlo = [AD_mJ],16
-(p0) fcmp.lt.unc.s1 p6,p7 = cosh_FR_X,f9
-(p0) add AD_J = r37, GR_J ;;
+ nop.m 0
+(p6) fma.s1 f_C_hi = f_spos, f_Tjhi, f_SC_hi_temp
+ nop.i 0
}
+;;
-{ .mmi
-(p0) ldfe cosh_FR_Tjhi = [AD_J],16 ;;
-(p0) ldfs cosh_FR_Tjlo = [AD_J],16
- nop.i 999 ;;
+{ .mfi
+ nop.m 0
+(p6) fms.s1 f_S_hi = f_spos, f_Tjhi, f_SC_hi_temp
+ nop.i 0
}
-
-{ .mfb
- nop.m 999
-(p0) fmerge.se cosh_FR_sneg = cosh_FR_N_temp2, f1
-(p7) br.cond.spnt L(COSH_BY_EXP) ;;
+{ .mfi
+ nop.m 0
+(p6) fma.s1 f_C_lo_temp4 = f_spos, f_Tjlo, f_C_lo_temp3
+ nop.i 0
}
-
-// ******************************************************
-// If NOT branch to EXP
-// ******************************************************
-// Calculate C_hi
-// ******************************************************
-// cosh_FR_C_hi_temp = cosh_FR_sneg * cosh_FR_Tmjhi
-// cosh_FR_C_hi = cosh_FR_spos * cosh_FR_Tjhi + (cosh_FR_sneg * cosh_FR_Tmjhi)
+;;
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_C_hi_temp = cosh_FR_sneg, cosh_FR_Tmjhi, f0
- nop.i 999 ;;
+ nop.m 0
+ fma.s1 f_peven = f_Rsq, f_peven_temp2, f0
+ nop.i 0
}
-
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_C_hi = cosh_FR_spos, cosh_FR_Tjhi, cosh_FR_C_hi_temp
- nop.i 999
+ nop.m 0
+ fma.s1 f_podd = f_podd_temp2, f_Rcub, f_R
+ nop.i 0
}
+;;
-// ******************************************************
-// Calculate S_hi
-// ******************************************************
-// cosh_FR_S_hi_temp1 = cosh_FR_sneg * cosh_FR_Tmjhi
-// cosh_FR_S_hi = cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi_temp1
+// If TBL,
+// C_lo_temp1 = spos * Tjhi - C_hi
+// C_lo_temp2 = sneg * Tmjlo + C_lo_temp1
+// C_lo_temp2 = sneg * Tmjlo + (spos * Tjhi - C_hi)
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_S_hi_temp1 = cosh_FR_sneg, cosh_FR_Tmjhi, f0
- nop.i 999 ;;
+ nop.m 0
+(p6) fms.s1 f_C_lo_temp1 = f_spos, f_Tjhi, f_C_hi
+ nop.i 0
}
-
-// ******************************************************
-// Calculate C_lo
-// ******************************************************
-// cosh_FR_C_lo_temp1 = cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi
-// cosh_FR_C_lo_temp2 = cosh_FR_sneg * cosh_FR_Tmjlo + (cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi)
-// cosh_FR_C_lo_temp1 = cosh_FR_sneg * cosh_FR_Tmjlo
-// cosh_FR_C_lo_temp3 = cosh_FR_spos * cosh_FR_Tjlo + (cosh_FR_sneg * cosh_FR_Tmjlo)
-// cosh_FR_C_lo = cosh_FR_C_lo_temp3 + cosh_FR_C_lo_temp2
+;;
{ .mfi
- nop.m 999
-(p0) fms.s1 cosh_FR_C_lo_temp1 = cosh_FR_spos, cosh_FR_Tjhi, cosh_FR_C_hi
- nop.i 999
+ nop.m 0
+(p6) fma.s1 f_C_lo_temp2 = f_sneg, f_Tmjhi, f_C_lo_temp1
+ nop.i 0
}
+;;
+// If EXP,
+// Y_hi = 2^(N-1) * Tjhi
+// Y_lo = 2^(N-1) * Tjhi * (p_odd + p_even) + 2^(N-1) * Tjlo
{ .mfi
- nop.m 999
-(p0) fms.s1 cosh_FR_S_hi = cosh_FR_spos, cosh_FR_Tjhi, cosh_FR_S_hi_temp1
- nop.i 999 ;;
+ nop.m 0
+(p7) fma.s1 f_Y_lo_temp = f_peven, f1, f_podd
+ nop.i 0
}
+;;
+// If TBL,
+// C_lo = C_lo_temp4 + C_lo_temp2
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_C_lo_temp2 = cosh_FR_sneg, cosh_FR_Tmjhi, cosh_FR_C_lo_temp1
- nop.i 999
+ nop.m 0
+(p6) fma.s1 f_C_lo = f_C_lo_temp4, f1, f_C_lo_temp2
+ nop.i 0
}
+;;
+// If TBL,
+// Y_hi = C_hi
+// Y_lo = S_hi*p_odd + (C_hi*p_even + C_lo)
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_C_lo_temp1 = cosh_FR_sneg, cosh_FR_Tmjlo, f0
- nop.i 999 ;;
+ nop.m 0
+(p6) fma.s1 f_Y_lo_temp = f_C_hi, f_peven, f_C_lo
+ nop.i 0
}
+;;
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_C_lo_temp3 = cosh_FR_spos, cosh_FR_Tjlo, cosh_FR_C_lo_temp1
- nop.i 999 ;;
+ nop.m 0
+(p7) fma.s1 f_Y_lo = f_Tjhi_spos, f_Y_lo_temp, f_Tjlo_spos
+ nop.i 0
}
+;;
+// Dummy multiply to generate inexact
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_C_lo = cosh_FR_C_lo_temp3, f1, cosh_FR_C_lo_temp2
- nop.i 999 ;;
+ nop.m 0
+ fmpy.s0 f_tmp = f_B2, f_B2
+ nop.i 0
}
-
-// ******************************************************
-// cosh_FR_Y_lo_temp = cosh_FR_C_hi * cosh_FR_peven + cosh_FR_C_lo
-// cosh_FR_Y_lo = cosh_FR_S_hi * cosh_FR_podd + cosh_FR_Y_lo_temp
-// cosh_FR_COSH = Y_hi + Y_lo
-
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_Y_lo_temp = cosh_FR_C_hi, cosh_FR_peven, cosh_FR_C_lo
- nop.i 999 ;;
+ nop.m 0
+(p6) fma.s1 f_Y_lo = f_S_hi, f_podd, f_Y_lo_temp
+ nop.i 0
}
+;;
+// f8 = answer = Y_hi + Y_lo
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_Y_lo = cosh_FR_S_hi, cosh_FR_podd, cosh_FR_Y_lo_temp
- nop.i 999 ;;
+ nop.m 0
+(p7) fma.s0 f8 = f_Y_lo, f1, f_Tjhi_spos
+ nop.i 0
}
+;;
+// f8 = answer = Y_hi + Y_lo
{ .mfb
- nop.m 999
-(p0) fma.s0 f8 = cosh_FR_C_hi, f1, cosh_FR_Y_lo
-(p0) br.ret.sptk b0 ;;
+ nop.m 0
+(p6) fma.s0 f8 = f_Y_lo, f1, f_C_hi
+ br.ret.sptk b0 // Exit for COSH_BY_TBL and COSH_BY_EXP
}
+;;
-L(COSH_BY_EXP):
-
-// When p7 is true, we know that an overflow is not going to happen
-// When p7 is false, we must check for possible overflow
-// p7 is the over_SAFE flag
-// f44 = Scale * (Y_hi + Y_lo)
-// = cosh_FR_spos * (cosh_FR_Tjhi + cosh_FR_Y_lo)
-{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_Y_lo_temp = cosh_FR_peven, f1, cosh_FR_podd
- nop.i 999
+// Here if 0 < |x| < 0.25
+COSH_BY_POLY:
+{ .mmf
+ ldfe f_P6 = [r_ad2e],16
+ ldfe f_P5 = [r_ad2o],16
+ nop.f 0
}
+;;
-// Now we are in EXP. This is the only path where an overflow is possible
-// but not for certain. So this is the only path where over_SAFE has any use.
-// r34 still has N-1
-// There is a danger of double-extended overflow if N-1 > 0x3ffe = 16382
-// There is a danger of double overflow if N-1 > 0x3fe = 1022
-// There is a danger of single overflow if N-1 > 0x7e = 126
+{ .mmi
+ ldfe f_P4 = [r_ad2e],16
+ ldfe f_P3 = [r_ad2o],16
+ nop.i 0
+}
+;;
-{ .mlx
- nop.m 999
-(p0) movl r32 = 0x0000000000003ffe ;;
+{ .mmi
+ ldfe f_P2 = [r_ad2e],16
+ ldfe f_P1 = [r_ad2o],16
+ nop.i 0
}
+;;
{ .mfi
-(p0) cmp.gt.unc p0,p7 = r34, r32
- nop.f 999
- nop.i 999 ;;
+ nop.m 0
+ fma.s1 f_X3 = f_NORM_X, f_X2, f0
+ nop.i 0
}
-
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_Y_lo = cosh_FR_Tjhi, cosh_FR_Y_lo_temp, cosh_FR_Tjlo
- nop.i 999 ;;
+ nop.m 0
+ fma.s1 f_X4 = f_X2, f_X2, f0
+ nop.i 0
}
+;;
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_COSH_temp = cosh_FR_Y_lo, f1, cosh_FR_Tjhi
- nop.i 999 ;;
+ nop.m 0
+ fma.s1 f_poly65 = f_X2, f_P6, f_P5
+ nop.i 0
}
-
{ .mfi
- nop.m 999
-(p0) fma.s0 f44 = cosh_FR_spos, cosh_FR_COSH_temp, f0
- nop.i 999 ;;
+ nop.m 0
+ fma.s1 f_poly43 = f_X2, f_P4, f_P3
+ nop.i 0
}
+;;
-// Dummy multiply to generate inexact
{ .mfi
- nop.m 999
-(p7) fmpy.s0 cosh_FR_tmp = cosh_FR_all_ones, cosh_FR_all_ones
- nop.i 999 ;;
+ nop.m 0
+ fma.s1 f_poly21 = f_X2, f_P2, f_P1
+ nop.i 0
}
+;;
-// If over_SAFE is set, return
-{ .mfb
- nop.m 999
-(p7) fmerge.s f8 = f44,f44
-(p7) br.ret.sptk b0 ;;
+{ .mfi
+ nop.m 0
+ fma.s1 f_poly6543 = f_X4, f_poly65, f_poly43
+ nop.i 0
}
-
-// Else see if we overflowed
-// S0 user supplied status
-// S2 user supplied status + WRE + TD (Overflows)
-// If WRE is set then an overflow will not occur in EXP.
-// The input value that would cause a register (WRE) value to overflow is about 2^15
-// and this input would go into the HUGE path.
-// Answer with WRE is in f43.
+;;
{ .mfi
- nop.m 999
-(p0) fsetc.s2 0x7F,0x42
- nop.i 999;;
+ nop.m 0
+ fma.s1 f_poly6to1 = f_X4, f_poly6543, f_poly21
+ nop.i 0
}
+;;
+// Dummy multiply to generate inexact
{ .mfi
- nop.m 999
-(p0) fma.s2 f43 = cosh_FR_spos, cosh_FR_COSH_temp, f0
- nop.i 999 ;;
+ nop.m 0
+ fmpy.s0 f_tmp = f_P6, f_P6
+ nop.i 0
}
-
-// 103FF => 103FF -FFFF = 400(true)
-// 400 + 3FF = 7FF, which is 1 more than the exponent of the largest
-// double (7FE). So 0 103FF 8000000000000000 is one ulp more than
-// largest double in register bias
-
-// 13FFF => 13FFF -FFFF = 4000(true)
-
-// Now set p8 if the answer with WRE is greater than or equal this value
-// Also set p9 if the answer with WRE is less than or equal to negative this value
-
-{ .mlx
- nop.m 999
-(p0) movl r32 = 0x0000000000013fff ;;
+{ .mfb
+ nop.m 0
+ fma.s0 f8 = f_poly6to1, f_X2, f1
+ br.ret.sptk b0 // Exit COSH_BY_POLY
}
+;;
-{ .mmf
- nop.m 999
-(p0) setf.exp f41 = r32
-(p0) fsetc.s2 0x7F,0x40 ;;
-}
-{ .mfi
- nop.m 999
-(p0) fcmp.ge.unc.s1 p8, p0 = f43, f41
- nop.i 999
+// Here if x denorm or unorm
+COSH_DENORM:
+// Determine if x really a denorm and not a unorm
+{ .mmf
+ getf.exp r_signexp_x = f_NORM_X
+ mov r_exp_denorm = 0x0c001 // Real denorms have exp < this
+ fmerge.s f_ABS_X = f0, f_NORM_X
}
+;;
{ .mfi
- nop.m 999
-(p0) fmerge.ns f42 = f41, f41
- nop.i 999 ;;
+ nop.m 0
+ fcmp.eq.s0 p10,p0 = f8, f0 // Set denorm flag
+ nop.i 0
}
+;;
-// The error tag for overflow is 63
-{ .mii
- nop.m 999
- nop.i 999 ;;
-(p8) mov GR_Parameter_TAG = 63 ;;
+// Set p8 if really a denorm
+{ .mmi
+ and r_exp_x = r_exp_mask, r_signexp_x
+;;
+ cmp.lt p8,p9 = r_exp_x, r_exp_denorm
+ nop.i 0
}
+;;
+// Identify denormal operands.
{ .mfb
- nop.m 999
-(p0) fcmp.le.unc.s1 p9, p0 = f43, f42
-(p8) br.cond.spnt __libm_error_region ;;
-}
-
-{ .mii
- nop.m 999
- nop.i 999 ;;
-(p9) mov GR_Parameter_TAG = 63
-}
-
-{ .mib
- nop.m 999
- nop.i 999
-(p9) br.cond.spnt __libm_error_region ;;
-}
-
-// Dummy multiply to generate inexact
-{ .mfi
- nop.m 999
-(p0) fmpy.s0 cosh_FR_tmp = cosh_FR_all_ones, cosh_FR_all_ones
- nop.i 999 ;;
+ nop.m 0
+(p8) fma.s0 f8 = f8,f8,f1 // If x denorm, result=1+x^2
+(p9) br.cond.sptk COSH_COMMON // Return to main path if x unorm
}
+;;
{ .mfb
- nop.m 999
-(p0) fmerge.s f8 = f44,f44
-(p0) br.ret.sptk b0 ;;
+ nop.m 0
+ nop.f 0
+ br.ret.sptk b0 // Exit if x denorm
}
+;;
-// for COSH_HUGE, put 24000 in exponent; take sign from input; add 1
-// SAFE: SAFE is always 0 for HUGE
-
-L(COSH_HUGE):
-
-{ .mlx
- nop.m 999
-(p0) movl r32 = 0x0000000000015dbf ;;
+// Here if |x| >= overflow limit
+COSH_HUGE:
+// for COSH_HUGE, put 24000 in exponent; take sign from input
+{ .mmi
+ mov r_exp_huge = 0x15dbf
+;;
+ setf.exp f_huge = r_exp_huge
+ nop.i 0
}
+;;
{ .mfi
-(p0) setf.exp f9 = r32
- nop.f 999
- nop.i 999 ;;
+ alloc r32 = ar.pfs,0,5,4,0
+ fma.s1 f_signed_hi_lo = f_huge, f1, f1
+ nop.i 0
}
+;;
{ .mfi
- nop.m 999
-(p0) fma.s1 cosh_FR_hi_lo = f1, f9, f1
- nop.i 999 ;;
+ nop.m 0
+ fma.s0 f_pre_result = f_signed_hi_lo, f_huge, f0
+ mov GR_Parameter_TAG = 63
}
+;;
-{ .mfi
- nop.m 999
-(p0) fma.s0 f44 = f9, cosh_FR_hi_lo, f0
-(p0) mov GR_Parameter_TAG = 63
-}
-.endp coshl
-ASM_SIZE_DIRECTIVE(coshl)
+GLOBAL_IEEE754_END(coshl)
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
.prologue
+
{ .mfi
- add GR_Parameter_Y=-32,sp // Parameter 2 value
+ add GR_Parameter_Y=-32,sp // Parameter 2 value
nop.f 0
.save ar.pfs,GR_SAVE_PFS
- mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
+ mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
}
{ .mfi
.fframe 64
- add sp=-64,sp // Create new stack
+ add sp=-64,sp // Create new stack
nop.f 0
- mov GR_SAVE_GP=gp // Save gp
+ mov GR_SAVE_GP=gp // Save gp
};;
+
{ .mmi
- stfe [GR_Parameter_Y] = FR_Y,16 // Save Parameter 2 on stack
- add GR_Parameter_X = 16,sp // Parameter 1 address
+ stfe [GR_Parameter_Y] = f0,16 // STORE Parameter 2 on stack
+ add GR_Parameter_X = 16,sp // Parameter 1 address
.save b0, GR_SAVE_B0
- mov GR_SAVE_B0=b0 // Save b0
+ mov GR_SAVE_B0=b0 // Save b0
};;
+
.body
{ .mib
- stfe [GR_Parameter_X] = FR_X // Store Parameter 1 on stack
- add GR_Parameter_RESULT = 0,GR_Parameter_Y
- nop.b 0 // Parameter 3 address
+ stfe [GR_Parameter_X] = f8 // STORE Parameter 1 on stack
+ add GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+ nop.b 0
}
{ .mib
- stfe [GR_Parameter_Y] = FR_RESULT // Store Parameter 3 on stack
+ stfe [GR_Parameter_Y] = f_pre_result // STORE Parameter 3 on stack
add GR_Parameter_Y = -16,GR_Parameter_Y
- br.call.sptk b0=__libm_error_support# // Call error handling function
+ br.call.sptk b0=__libm_error_support# // Call error handling function
};;
+
{ .mmi
- nop.m 0
- nop.m 0
add GR_Parameter_RESULT = 48,sp
+ nop.m 0
+ nop.i 0
};;
+
{ .mmi
- ldfe f8 = [GR_Parameter_RESULT] // Get return result off stack
+ ldfe f8 = [GR_Parameter_RESULT] // Get return result off stack
.restore sp
- add sp = 64,sp // Restore stack pointer
- mov b0 = GR_SAVE_B0 // Restore return address
+ add sp = 64,sp // Restore stack pointer
+ mov b0 = GR_SAVE_B0 // Restore return address
};;
+
{ .mib
- mov gp = GR_SAVE_GP // Restore gp
- mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
- br.ret.sptk b0 // Return
+ mov gp = GR_SAVE_GP // Restore gp
+ mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
+ br.ret.sptk b0 // Return
};;
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
.type __libm_error_support#,@function
.global __libm_error_support#