From patchwork Mon Feb 3 21:24:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 861575 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:11cb:b0:385:e875:8a9e with SMTP id i11csp14979wrx; Mon, 3 Feb 2025 13:26:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWsePk4YLW+BiQgg44P8fWtnngFJfxAPo5sl3FFEB4H4HI6/LPFV53eSxNOa8FviPl20P3U8Q==@linaro.org X-Google-Smtp-Source: AGHT+IF9avpFHHKdrLS9oMUalcGGsYg76vowRdJljpc6ICXdqJB6aNJQ8MQK6GTgerb0mfPoyM/R X-Received: by 2002:ac8:6903:0:b0:46e:2d0b:e1bf with SMTP id d75a77b69052e-470186c46bfmr15645421cf.11.1738618002303; Mon, 03 Feb 2025 13:26:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1738618002; cv=pass; d=google.com; s=arc-20240605; b=bjf/A24u/niJIBSmtKQkD+agk76AA2peNz1LAKFYzwW2GFGS6xXaqPTF9qlJoHxsQA kJN+HGvEE9gzNd8SPHbyrVGy4E7jB+9wjyJapEadtegY0itwlyb8cHgFJsSUIvIkmI1x /AfyHBi8D/D/m2oFUJ63amTFctE9ONNcxwqK/V+dYXpV5YxlpNbKaKjezm3Vs46v1G7Q iOd/Ik5oUtb2sh5q+/uGjKgiZUVu+W9QCEWPF7txneMDIUvAtXKqZO2jh2v3uwWAjgge xTiyouVs0NCpd2pXWxILoCj66RTGCbPQ6vVgKhgTKZhhKQF5AW3+9Oquew53Ev1kHfgm mr3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter:arc-filter:dmarc-filter :delivered-to:dkim-filter; bh=8lpJROTUOmAA+c1Z5Vi/bADJANnIXv0pi04hkgV3mBw=; fh=Pi2apwTyRle/crbOq6UOyUkSwIydBObhkp/dAjam2Pw=; b=dFhYh7ssG0mkZGz4Jz78adsxFt9kEWiTHpYdRSO1j+sbWUu/WgJNrYkwXfPJkGDSE4 GDNTn+1Fw6DjfI+78DDcWW1klgdHMyza5p7PVoMXvOIb8vCLNJtwkg1iGkc6hyOvvn7e RgBYSb1zUiWaPeSNkNVh44wymzWFReyo9mr8zZN3F1X9BnThv9RoM/QQMf1cUOe8cj+d GBb6/Kcu8BRtrdQ/rs9mguJSxRlf8lDfzk/luMkuGwK+V+VGnWC502iYtQGXfDOWDS+4 OzM3nYAKJlo5xLRPol2mnpiW/vH9EuIcNr6/5+8E+gYdHfU13DhIwUYJ4D0c2UV+Z605 tWhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=li7+ZLqx; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d75a77b69052e-47016bae1e0si10450651cf.441.2025.02.03.13.26.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 13:26:42 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=li7+ZLqx; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C605D3858416 for ; Mon, 3 Feb 2025 21:26:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C605D3858416 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=li7+ZLqx X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 410933858C33 for ; Mon, 3 Feb 2025 21:26:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 410933858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 410933858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::634 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738617960; cv=none; b=qxR+wos6fYEXRwHjZ7bl4Z0FJ4Ge16EKgKBqj98+s4MITX//fu6LaPi/GX/sSackMnJMIVlVZ3isNsyJ3R/WHKpLAz5h+IHpt68FnX5Rc+9NP92xhLOlhZSm97RAUwVc5JB03Ps76aQ9kIT1RssY27OOdUqFM27/WWf43FfX/pI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738617960; c=relaxed/simple; bh=NMOsYg6TEmr9Aia49R5pG7BHgmCSag6+LqSwy29EPtI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=eDXXeXL6/lIAT5o8gmJJMTTYWQnRoKYgFunSe2cu78GjwnkyOZDUfY2nD3JkipkvLSfjMr8V9iAU0nxxsYQjNbwyHCedFz2TRcQCQskMU4nO/dH/2T2dtapi02q6TE4FmEmLY4xcbuXZO3W0cb9EE+Xx9L7CIJmuZ9iWKJ62sSw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 410933858C33 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2162c0f6a39so103549145ad.0 for ; Mon, 03 Feb 2025 13:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738617959; x=1739222759; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8lpJROTUOmAA+c1Z5Vi/bADJANnIXv0pi04hkgV3mBw=; b=li7+ZLqxxOPQU90SPFHKmBShhZYAVBuIabB48OPs3Iyky9gbbGsmDwsE2We8NQob7k 6o+IwgF/JrPBiIfiaZzVakDF2TQqxQFCeVQLsIKTt7rZCNlMZhLOKRyKAjlrH6qgUSQ2 JNJBM8NdTvbcCROyHNuHccY8ymbpArM/svBpR0vcnt+izweyb4ydGWJs0jaM5fbCwRBE pQhzoNfmJ1uVJbOLcSD5XbBvGGZFl/0VbOqotUxT4HoWdE2HPZmYppSQ0BfPB0SKBL3v A1vSjX45yPfYP0mR58wno1jK7l7dp7GBZuyO43amHvx6LgJQfOm8Gem8QG2VrIaqemfx TnPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738617959; x=1739222759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8lpJROTUOmAA+c1Z5Vi/bADJANnIXv0pi04hkgV3mBw=; b=FD625hrI8GkYhBBRGNa4jTdUsgDiBEfE15eF60lLx4yY8K80uT3Yhj+EVmSVWQl6Zm rLPBR/myaYlDNabkVhI3/1bYIe3D8c5IfwRX0xD6P1eB63O2CA4VOKYWwmj91803mOcn tU1FLAu3eUzriJshvbyQ9vjdVRwOMCP4UZO4lUw3GDhAhBS36BxBXWIZKD4hdvvR+7HX bTGRrqtT7WSaZ/dyDiZgaju0XHTsYca948lZQ3ntrU9Oh9M7W++gBegR9PCaGiFqypnS G17i36qCHVzSLLfp+caBA71IDrgoJ5CA4vI1yqrhNFRNB4nuIDoaUINGSipkWQVtdwpY TfBw== X-Gm-Message-State: AOJu0YxhYfWa8rfzCElZK2GTYUMADRnvhHzPDIHZCHCNNgZh4Ms/iZtM Im/hh1hbfVtMy0/+5qF4Gb5lipvxO2Qyu5WtPLPNX1v40vdHYvZC1dzFQj6xGHRuDQ8tocDcNP9 9 X-Gm-Gg: ASbGncsntW7id2gCeH/8G2YNxmFQGqy0SeJ3vpa0gw4Y2OmN+1nUOv0h78lNUvvrbY5 ESUyVdeqGDfzR3W90On4c1xF5GumnNPvb1+ifsxUbFGEDFq2x2pltRcBajVFc1dcB+NhRRvhgi3 Drq7xQeAx/ONZ9I+Ptw9lI4eMggT8BSMpYFUYNmhsOMrSAUjM9DCYVI7l9o2vWk+5mVwDec47pg W8XOQZ6UklaZ3LmpNEeOAYjSR5HuQ1MQKYaM8sX7eczWI053gzYRQIKAotR3/JWr7B6hq2nz1AN 33GaH6HlPnDtgSxCVYD8agNOAMbb X-Received: by 2002:a05:6a20:2d21:b0:1e1:ad90:dda6 with SMTP id adf61e73a8af0-1edd7732977mr1486992637.20.1738617958856; Mon, 03 Feb 2025 13:25:58 -0800 (PST) Received: from ubuntu-vm.. ([177.103.113.88]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72fe69ba418sm9184218b3a.105.2025.02.03.13.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 13:25:58 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Joseph Myers , Paul Zimmermann , Alexei Sibidanov , DJ Delorie Subject: [PATCH 3/3] math: Consolidate coshf and sinhf internal tables Date: Mon, 3 Feb 2025 18:24:19 -0300 Message-ID: <20250203212546.911043-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250203212546.911043-1-adhemerval.zanella@linaro.org> References: <20250203212546.911043-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org The libm size improvement built with "--enable-stack-protector=strong --enable-bind-now=yes --enable-fortify-source=2": Before: text data bss dec hex filename 585192 860 12 586064 8f150 aarch64-linux-gnu/math/libm.so 960775 1068 12 961855 ead3f x86_64-linux-gnu/math/libm.so 1189174 5544 368 1195086 123c4e powerpc64le-linux-gnu/math/libm.so After: text data bss dec hex filename 584952 860 12 585824 8f060 aarch64-linux-gnu/math/libm.so 960615 1068 12 961695 eac9f x86_64-linux-gnu/math/libm.so 1189078 5544 368 1194990 123bee powerpc64le-linux-gnu/math/libm.so The are small code changes for x86_64 and powerpc64le, which do not affect performance; but on aarch64 with gcc-14 I see a slight better code generation due the usage of ldq for floating point constant loading. Reviewed-by: Andreas K. Huettel --- math/Makefile | 1 + sysdeps/ieee754/flt-32/e_coshf.c | 38 ++++-------------- sysdeps/ieee754/flt-32/e_sincoshf_data.c | 49 ++++++++++++++++++++++++ sysdeps/ieee754/flt-32/e_sincoshf_data.h | 36 +++++++++++++++++ sysdeps/ieee754/flt-32/e_sinhf.c | 37 ++++-------------- 5 files changed, 101 insertions(+), 60 deletions(-) create mode 100644 sysdeps/ieee754/flt-32/e_sincoshf_data.c create mode 100644 sysdeps/ieee754/flt-32/e_sincoshf_data.h diff --git a/math/Makefile b/math/Makefile index febeb253f6..a591cd59cb 100644 --- a/math/Makefile +++ b/math/Makefile @@ -363,6 +363,7 @@ type-double-routines := \ type-float-suffix := f type-float-routines := \ e_asincosf_data \ + e_sincoshf_data \ e_exp2f_data \ e_log2f_data \ e_logf_data \ diff --git a/sysdeps/ieee754/flt-32/e_coshf.c b/sysdeps/ieee754/flt-32/e_coshf.c index 602d2b413f..5f6ff8c29f 100644 --- a/sysdeps/ieee754/flt-32/e_coshf.c +++ b/sysdeps/ieee754/flt-32/e_coshf.c @@ -28,34 +28,11 @@ SOFTWARE. #include #include #include "math_config.h" +#include "e_sincoshf_data.h" float __ieee754_coshf (float x) { - static const double c[] = - { - 1, 0x1.62e42fef4c4e7p-6, 0x1.ebfd1b232f475p-13, 0x1.c6b19384ecd93p-20 - }; - static const double ch[] = - { - 1, 0x1.62e42fefa39efp-6, 0x1.ebfbdff82c58fp-13, - 0x1.c6b08d702e0edp-20, 0x1.3b2ab6fb92e5ep-27, 0x1.5d886e6d54203p-35, - 0x1.430976b8ce6efp-43 - }; - static const uint64_t tb[] = - { - 0x3fe0000000000000, 0x3fe059b0d3158574, 0x3fe0b5586cf9890f, - 0x3fe11301d0125b51, 0x3fe172b83c7d517b, 0x3fe1d4873168b9aa, - 0x3fe2387a6e756238, 0x3fe29e9df51fdee1, 0x3fe306fe0a31b715, - 0x3fe371a7373aa9cb, 0x3fe3dea64c123422, 0x3fe44e086061892d, - 0x3fe4bfdad5362a27, 0x3fe5342b569d4f82, 0x3fe5ab07dd485429, - 0x3fe6247eb03a5585, 0x3fe6a09e667f3bcd, 0x3fe71f75e8ec5f74, - 0x3fe7a11473eb0187, 0x3fe82589994cce13, 0x3fe8ace5422aa0db, - 0x3fe93737b0cdc5e5, 0x3fe9c49182a3f090, 0x3fea5503b23e255d, - 0x3feae89f995ad3ad, 0x3feb7f76f2fb5e47, 0x3fec199bdd85529c, - 0x3fecb720dcef9069, 0x3fed5818dcfba487, 0x3fedfc97337b9b5f, - 0x3feea4afa2a490da, 0x3fef50765b6e4540 - }; const double iln2 = 0x1.71547652b82fep+5; double z = x; uint32_t ax = asuint (x) << 1; @@ -92,10 +69,10 @@ __ieee754_coshf (float x) double h2 = h * h; int64_t jp = asuint64 (ia + 0x1.8p52); int64_t jm = -jp; - double sp = asdouble (tb[jp & 31] + ((jp >> 5) << 52)); - double sm = asdouble (tb[jm & 31] + ((jm >> 5) << 52)); - double te = c[0] + h2 * c[2]; - double to = (c[1] + h2 * c[3]); + double sp = asdouble (TB[jp & 31] + ((jp >> 5) << 52)); + double sm = asdouble (TB[jm & 31] + ((jm >> 5) << 52)); + double te = C[0] + h2 * C[2]; + double to = (C[1] + h2 * C[3]); double rp = sp * (te + h * to); double rm = sm * (te - h * to); double r = rp + rm; @@ -107,8 +84,9 @@ __ieee754_coshf (float x) const double iln2l = 0x1.5c17f0bbbe88p-26; h = (iln2h * z - ia) + iln2l * z; h2 = h * h; - te = ch[0] + h2 * ch[2] + (h2 * h2) * (ch[4] + h2 * ch[6]); - to = ch[1] + h2 * (ch[3] + h2 * ch[5]); + te = CH[0] + h2 * CH[2] + (h2 * h2) * (CH[4] + h2 * CH[6]); + to = CH[1] + h2 * (CH[3] + h2 + * CH[5]); r = sp * (te + h * to) + sm * (te - h * to); ub = r; } diff --git a/sysdeps/ieee754/flt-32/e_sincoshf_data.c b/sysdeps/ieee754/flt-32/e_sincoshf_data.c new file mode 100644 index 0000000000..c1a34d1ab3 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_sincoshf_data.c @@ -0,0 +1,49 @@ +/* Common data for sinhf/coshf implementations. + +Copyright (c) 2022-2025 Alexei Sibidanov. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#include "e_sincoshf_data.h" + +const double __sincoshf_c[] = + { + 1, 0x1.62e42fef4c4e7p-6, 0x1.ebfd1b232f475p-13, 0x1.c6b19384ecd93p-20 + }; +const double __sincoshf_ch[] = + { + 1, 0x1.62e42fefa39efp-6, 0x1.ebfbdff82c58fp-13, + 0x1.c6b08d702e0edp-20, 0x1.3b2ab6fb92e5ep-27, 0x1.5d886e6d54203p-35, + 0x1.430976b8ce6efp-43 + }; +const uint64_t __sincoshf_tb[] = + { + 0x3fe0000000000000, 0x3fe059b0d3158574, 0x3fe0b5586cf9890f, + 0x3fe11301d0125b51, 0x3fe172b83c7d517b, 0x3fe1d4873168b9aa, + 0x3fe2387a6e756238, 0x3fe29e9df51fdee1, 0x3fe306fe0a31b715, + 0x3fe371a7373aa9cb, 0x3fe3dea64c123422, 0x3fe44e086061892d, + 0x3fe4bfdad5362a27, 0x3fe5342b569d4f82, 0x3fe5ab07dd485429, + 0x3fe6247eb03a5585, 0x3fe6a09e667f3bcd, 0x3fe71f75e8ec5f74, + 0x3fe7a11473eb0187, 0x3fe82589994cce13, 0x3fe8ace5422aa0db, + 0x3fe93737b0cdc5e5, 0x3fe9c49182a3f090, 0x3fea5503b23e255d, + 0x3feae89f995ad3ad, 0x3feb7f76f2fb5e47, 0x3fec199bdd85529c, + 0x3fecb720dcef9069, 0x3fed5818dcfba487, 0x3fedfc97337b9b5f, + 0x3feea4afa2a490da, 0x3fef50765b6e4540 + }; diff --git a/sysdeps/ieee754/flt-32/e_sincoshf_data.h b/sysdeps/ieee754/flt-32/e_sincoshf_data.h new file mode 100644 index 0000000000..ea4b38089f --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_sincoshf_data.h @@ -0,0 +1,36 @@ +/* Common data for sinhf/coshf implementations. + +Copyright (c) 2022-2025 Alexei Sibidanov. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#ifndef _SINCOSHF_H +#define _SINCOSHF_H + +#include + +extern const double __sincoshf_c[] attribute_hidden; +#define C __sincoshf_c +extern const double __sincoshf_ch[] attribute_hidden; +#define CH __sincoshf_ch +extern const uint64_t __sincoshf_tb[] attribute_hidden; +#define TB __sincoshf_tb + +#endif diff --git a/sysdeps/ieee754/flt-32/e_sinhf.c b/sysdeps/ieee754/flt-32/e_sinhf.c index dee96fc7cb..754b84abe0 100644 --- a/sysdeps/ieee754/flt-32/e_sinhf.c +++ b/sysdeps/ieee754/flt-32/e_sinhf.c @@ -29,34 +29,11 @@ SOFTWARE. #include #include #include "math_config.h" +#include "e_sincoshf_data.h" float __ieee754_sinhf (float x) { - static const double c[] = - { - 1, 0x1.62e42fef4c4e7p-6, 0x1.ebfd1b232f475p-13, 0x1.c6b19384ecd93p-20 - }; - static const double ch[] = - { - 1, 0x1.62e42fefa39efp-6, 0x1.ebfbdff82c58fp-13, - 0x1.c6b08d702e0edp-20, 0x1.3b2ab6fb92e5ep-27, 0x1.5d886e6d54203p-35, - 0x1.430976b8ce6efp-43 - }; - static const uint64_t tb[] = - { - 0x3fe0000000000000, 0x3fe059b0d3158574, 0x3fe0b5586cf9890f, - 0x3fe11301d0125b51, 0x3fe172b83c7d517b, 0x3fe1d4873168b9aa, - 0x3fe2387a6e756238, 0x3fe29e9df51fdee1, 0x3fe306fe0a31b715, - 0x3fe371a7373aa9cb, 0x3fe3dea64c123422, 0x3fe44e086061892d, - 0x3fe4bfdad5362a27, 0x3fe5342b569d4f82, 0x3fe5ab07dd485429, - 0x3fe6247eb03a5585, 0x3fe6a09e667f3bcd, 0x3fe71f75e8ec5f74, - 0x3fe7a11473eb0187, 0x3fe82589994cce13, 0x3fe8ace5422aa0db, - 0x3fe93737b0cdc5e5, 0x3fe9c49182a3f090, 0x3fea5503b23e255d, - 0x3feae89f995ad3ad, 0x3feb7f76f2fb5e47, 0x3fec199bdd85529c, - 0x3fecb720dcef9069, 0x3fed5818dcfba487, 0x3fedfc97337b9b5f, - 0x3feea4afa2a490da, 0x3fef50765b6e4540 - }; static const struct { uint32_t uarg; @@ -106,10 +83,10 @@ __ieee754_sinhf (float x) double h2 = h * h; int64_t jp = asuint64 (ia + 0x1.8p52); int64_t jm = -jp; - double sp = asdouble (tb[jp & 31] + ((jp >> 5) << 52)); - double sm = asdouble (tb[jm & 31] + ((jm >> 5) << 52)); - double te = c[0] + h2 * c[2]; - double to = (c[1] + h2 * c[3]); + double sp = asdouble (TB[jp & 31] + ((jp >> 5) << 52)); + double sm = asdouble (TB[jm & 31] + ((jm >> 5) << 52)); + double te = C[0] + h2 * C[2]; + double to = (C[1] + h2 * C[3]); double rp = sp * (te + h * to); double rm = sm * (te - h * to); double r = rp - rm; @@ -121,8 +98,8 @@ __ieee754_sinhf (float x) const double iln2l = 0x1.5c17f0bbbe88p-26; h = (iln2h * z - ia) + iln2l * z; h2 = h * h; - te = ch[0] + h2 * ch[2] + (h2 * h2) * (ch[4] + h2 * ch[6]); - to = ch[1] + h2 * (ch[3] + h2 * ch[5]); + te = CH[0] + h2 * CH[2] + (h2 * h2) * (CH[4] + h2 * CH[6]); + to = CH[1] + h2 * (CH[3] + h2 * CH[5]); r = sp * (te + h * to) - sm * (te - h * to); ub = r; }