From patchwork Mon Feb 3 21:24:17 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: 861574 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:11cb:b0:385:e875:8a9e with SMTP id i11csp14935wrx; Mon, 3 Feb 2025 13:26:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU6EJZXBRqMoVpc7wwdpRxA6UnWN/d7qY1yZKjJwJlU6cIcZuGQxOF4yd1O12CE5zGApf4z/w==@linaro.org X-Google-Smtp-Source: AGHT+IEGEZ3KnP4J9z1vYgkHUNTIGUnMB26Tb/zFy1Rl8jrXVRpBr0CVEoa+8XAEhpIoHOI2puo0 X-Received: by 2002:ad4:576c:0:b0:6d4:1530:a0a3 with SMTP id 6a1803df08f44-6e243befa81mr261283116d6.6.1738617991366; Mon, 03 Feb 2025 13:26:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1738617991; cv=pass; d=google.com; s=arc-20240605; b=QOTlO2q8U7PIGAuJpQH/aHL/gDblWdyaUSRBQorFuoBO0B6uY9ed9MjoYkEcXjX3/0 rMHxru9tFBFYatdCJy0ujHAswn4ffcbn5u93F5wU7/VRK5kHCIfl03oV/lJQzZxaWu4v z/e0Pkx9deMLMtWcFfznwA9dQZZXczYUlY0D/Gjkgs4ULRSxOJ1RQ2tt5xAyIAEUG2Fh fmww4rgDappIxwXbbeJbJQH6X3jG95w2gUTFapRDrVrS+A+IJs0ihjOtbSqezTFVHQQZ PJfoB01lnXdo3Qk/uxwMUCMCt0Xf9FXBiOuW/PkAPT7ewJz1jZJpdaZhMfxktqSm9YIW KuuQ== 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=fFVtRqDbWriaU+1zf9ObrAAzDKxedsrgl9XxY3ynFIk=; fh=Pi2apwTyRle/crbOq6UOyUkSwIydBObhkp/dAjam2Pw=; b=bC9AU9iI65Oq7I7c1v+8cHaeFN2BSic0U1AfO1mF1iT8d9Pl7C/w7+RssBAKDlGAVa O+edX5q3GaOv73ZAytunFayeuBFlzwrtNB27H2qnnnq9enlRcCbmOpOppXZ9ghkJfy1J ccEPGKS+BPsqGiqh29GdH5vuDpaLIn2ENE8eS0+YDgc7XjhhMHG23OHunf8BKvRjioth sXedojMdA0fSSk1Z+rpj5/2k/nS8b5SYN3zAA2cas/zpIvP5M7w0hrp/44WTUyK/JNkV a4K+r7qd/+ALFPmdtk885Ubv0AUPWnCvGDCnwqRZnF/r1I2a/yXwvBCkYQ5Bc74mJk8a XSqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M3wVIROY; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 6a1803df08f44-6e41feeb855si10934456d6.477.2025.02.03.13.26.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 13:26:31 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M3wVIROY; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 E0FF33858415 for ; Mon, 3 Feb 2025 21:26:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0FF33858415 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=M3wVIROY X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id E4C313858CDA for ; Mon, 3 Feb 2025 21:25:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E4C313858CDA 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 E4C313858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1035 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738617956; cv=none; b=Nv3yCws6tAGRo/s8kEAg5PqKOZ/2zu64DnNIzVrBW5U0Q9tbbZwlYAyDAA59PJzPusZUueZf8vvyzIjkk4tCQML8WMf7AuoHD5fxN+vBzNTosODyo11BU+kpRnqpruC+PbKNklcicLOU11FR3NClAc4Qv5KD9gNkfeiqjtKznbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738617956; c=relaxed/simple; bh=jmcX3oVLx8WyM92Yq/N3+UkyeBJ8odVw4LP7cwnYaXU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=fAiGrxooR7+Z7Ra5GM2ihlYlOUpmpxNreoswRR8uRnhFPigwHnMBuHuKrkDXUacTbLhyySPWdjILJdaM2vxOwWBGJAoofZn+9yvpIJQVTdG6Q4lsI0OzcV5+0mWmQxpIx5Zp5p5EG0PM/HXygG6OZfVAvOPYeqQjevUbhrz0uUE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4C313858CDA Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2f9bac7699aso310564a91.1 for ; Mon, 03 Feb 2025 13:25:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738617954; x=1739222754; 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=fFVtRqDbWriaU+1zf9ObrAAzDKxedsrgl9XxY3ynFIk=; b=M3wVIROYNdo1U4fJ9uqJ7j+HHEshfPlakI5HLxnBbsOR5g1N7hiV6lv1uB7VLDqP9l CE0/E73UDhelT70HCaj2If98SBuJV44Ax0xsKstKXvhUn+qRCS5MgAaYxgfZGTYYm9ai tXFpTIw9iNeAWGeShDoYNvNkq2v0FJjR2KJGksjlo70TkUxPJP95It/ifthzU98/qyLU OPs1ieTSX8UCOiGKsT+w73HJHKJto4X9i434SYub1y3/fL9hGXZS1yi+ifJQypVuttN0 ktdcQUWRXxOwICyGcpFv0+O2Y+R5caHcijuUjSa43/Le0Amh8am/+0BWf/fW9bnWjUr1 mUjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738617954; x=1739222754; 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=fFVtRqDbWriaU+1zf9ObrAAzDKxedsrgl9XxY3ynFIk=; b=b6cK/l4m6sK61Z3aIsn3ZOqQvRcR7NsUGETfey7ltOMsf6cBcq/MTq1gux1GdCjk3c 8nEgW0+2JgPgA3JFz5AcfUTZj3tII+KU2SmxV6RisMo/hpxglkmd1UwlUeLzpJ7pZO42 2riJCXKkl5k8AJbkGPb/nM2u0x9IaKzXYjl+oEgtiIWJo3WxrPPon22nyO4wpgBPY+2O Bo7w3bcrd9vw2qOZP3mW3a5+iEFrnXiM1SjizUgSf1dyFQcegRUWxB9B1xvFCCtl2VkZ hpd9NtoYo5W/WI6ChyOOKQ05CPMAVbIVn89iuMJAuSZVDnTf6W5zu+edK1/xRIzEbzzi RXSQ== X-Gm-Message-State: AOJu0Yw+5wLr4KicYolV0CYkQ67rwPg+Kt2no+LMfCUdzKpxG8AKoCKs eVNBdFa1CTWYeg3RQ5b83gyZHBzP7UfhBruH7CGlBFIvod5m02GWm4rGWeXj0cJkJicMWCkt0VU U X-Gm-Gg: ASbGnculm2+ULn03s7e2w3+wwYfZBbH2+YQwdG3ZdevRI313XQujLXPPkYUvHmhS3SA bJ3VuJRhTrNpU7OgdnYjLJs3k/pDfTuKsg1xaq8wlKhh7cSgY8CQb28SUN6J1Z4i60/cpTOaIdd cKJdm5kPj69Qb54p7vxCM/4ngy0X4htzG0NRlgi7unf+01JzAA6I1Lp9qHzbwivc3h5gjpZ49Kw s1vT38Qm0e2+m8fvB0K4qOW9P3fEyxecyOdPyMePGk9rT4Lm8xdO/QVztX8hNZxlDzvOnbc0TzL nvvk7NFE5xPMc8YKSVgVy2a023k+ X-Received: by 2002:a05:6a00:4608:b0:724:5815:62c1 with SMTP id d2e1a72fcca58-72fd0c5f1b2mr35179015b3a.19.1738617954240; Mon, 03 Feb 2025 13:25:54 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 13:25:53 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Joseph Myers , Paul Zimmermann , Alexei Sibidanov , DJ Delorie Subject: [PATCH 1/3] math: Consolidate acosf and asinf internal tables Date: Mon, 3 Feb 2025 18:24:17 -0300 Message-ID: <20250203212546.911043-2-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": From: text data bss dec hex filename 587896 860 12 588768 8fbe0 aarch64-linux-gnu-master/math/libm.so 963175 1068 12 964255 eb69f x86_64-linux-gnu-master/math/libm.so 1191542 5544 368 1197454 12458e powerpc64le-linux-gnu-master/math/libm.so To: text data bss dec hex filename 587304 860 12 588176 8f990 aarch64-linux-gnu/math/libm.so 962855 1068 12 963935 eb55f x86_64-linux-gnu/math/libm.so 1191222 5544 368 1197134 12444e powerpc64le-linux-gnu/math/libm.so The are not code changes for x86_64 and powerpc64le, but on aarch64 with gcc-14 I see a slight better code generation due the usage of ldq for floating point constant loading. --- math/Makefile | 1 + sysdeps/ieee754/flt-32/e_acosf.c | 36 ++++------------ sysdeps/ieee754/flt-32/e_asincosf_data.c | 53 ++++++++++++++++++++++++ sysdeps/ieee754/flt-32/e_asincosf_data.h | 37 +++++++++++++++++ sysdeps/ieee754/flt-32/e_asinf.c | 38 ++++------------- 5 files changed, 106 insertions(+), 59 deletions(-) create mode 100644 sysdeps/ieee754/flt-32/e_asincosf_data.c create mode 100644 sysdeps/ieee754/flt-32/e_asincosf_data.h diff --git a/math/Makefile b/math/Makefile index f24cee5c39..a6da38a135 100644 --- a/math/Makefile +++ b/math/Makefile @@ -362,6 +362,7 @@ type-double-routines := \ # float support type-float-suffix := f type-float-routines := \ + e_asincosf_data \ e_exp2f_data \ e_log2f_data \ e_logf_data \ diff --git a/sysdeps/ieee754/flt-32/e_acosf.c b/sysdeps/ieee754/flt-32/e_acosf.c index a5a4de4fc2..90196ac61e 100644 --- a/sysdeps/ieee754/flt-32/e_acosf.c +++ b/sysdeps/ieee754/flt-32/e_acosf.c @@ -30,6 +30,7 @@ SOFTWARE. #include #include #include "math_config.h" +#include "e_asincosf_data.h" static __attribute__ ((noinline)) float as_special (float x) @@ -77,15 +78,6 @@ __ieee754_acosf (float x) return as_special (x); if (__glibc_likely (ax < 0x7ec2a1dcu)) /* |x| < 0x1.c2a1dcp-1 */ { - static const double b[] = - { - 0x1.fffffffd9ccb8p-1, 0x1.5555c94838007p-3, 0x1.32ded4b7c20fap-4, - 0x1.8566df703309ep-5, -0x1.980c959bec9a3p-6, 0x1.56fbb04998344p-1, - -0x1.403d8e4c49f52p+2, 0x1.b06c3e9f311eap+4, -0x1.9ea97c4e2c21fp+6, - 0x1.200b8261cc61bp+8, -0x1.2274c2799a5c7p+9, 0x1.a558a59cc19d3p+9, - -0x1.aca4b6a529ffp+9, 0x1.228744703f813p+9, -0x1.d7dbb0b322228p+7, - 0x1.5c2018c0c0105p+5 - }; /* Avoid spurious underflow exception. */ if (__glibc_unlikely (ax <= 0x40000000u)) /* |x| < 2^-63 */ /* GCC <= 11 wrongly assumes the rounding is to nearest and @@ -97,11 +89,11 @@ __ieee754_acosf (float x) double z4 = z2 * z2; double z8 = z4 * z4; double z16 = z8 * z8; - r = z * ((((b[0] + z2 * b[1]) + z4 * (b[2] + z2 * b[3])) - + z8 * ((b[4] + z2 * b[5]) + z4 * (b[6] + z2 * b[7]))) - + z16 * (((b[8] + z2 * b[9]) + z4 * (b[10] + z2 * b[11])) + r = z * ((((B[0] + z2 * B[1]) + z4 * (B[2] + z2 * B[3])) + + z8 * ((B[4] + z2 * B[5]) + z4 * (B[6] + z2 * B[7]))) + + z16 * (((B[8] + z2 * B[9]) + z4 * (B[10] + z2 * B[11])) + z8 - * ((b[12] + z2 * b[13])+ z4 * (b[14] + z2 * b[15])))); + * ((B[12] + z2 * B[13])+ z4 * (B[14] + z2 * B[15])))); float ub = 0x1.921fb54574191p+0 - r; float lb = 0x1.921fb543118ap+0 - r; if (ub == lb) @@ -110,33 +102,19 @@ __ieee754_acosf (float x) /* accurate path */ if (ax < (0x7eu << 24)) { - static const double c[] = - { - 0x1.555555555529cp-3, 0x1.333333337e0ddp-4, 0x1.6db6db3b4465ep-5, - 0x1.f1c72e13ac306p-6, 0x1.6e89cebe06bc4p-6, 0x1.1c6dcf5289094p-6, - 0x1.c6dbbcc7c6315p-7, 0x1.8f8dc2615e996p-7, 0x1.a5833b7bf15e8p-8, - 0x1.43f44ace1665cp-6, -0x1.0fb17df881c73p-6, 0x1.07520c026b2d6p-5 - }; if (t == 0x328885a3u) return 0x1.921fb6p+0f + 0x1p-25; if (t == 0x39826222u) return 0x1.920f6ap+0f + 0x1p-25; double x2 = xs * xs; - r = (pi2 - xs) - (xs * x2) * poly12 (x2, c); + r = (pi2 - xs) - (xs * x2) * poly12 (x2, C0); } else { - static const double c[] = - { - 0x1.6a09e667f3bcbp+0, 0x1.e2b7dddff2db9p-4, 0x1.b27247ab42dbcp-6, - 0x1.02995cc4e0744p-7, 0x1.5ffb0276ec8eap-9, 0x1.033885a928decp-10, - 0x1.911f2be23f8c7p-12, 0x1.4c3c55d2437fdp-13, 0x1.af477e1d7b461p-15, - 0x1.abd6bdff67dcbp-15, -0x1.1717e86d0fa28p-16, 0x1.6ff526de46023p-16 - }; double bx = fabs (xs); double z = 1.0 - bx; double s = copysign (sqrt (z), xs); - r = o[t >> 31] + s * poly12 (z, c); + r = o[t >> 31] + s * poly12 (z, C1); } return r; } diff --git a/sysdeps/ieee754/flt-32/e_asincosf_data.c b/sysdeps/ieee754/flt-32/e_asincosf_data.c new file mode 100644 index 0000000000..2ffc2c28f3 --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_asincosf_data.c @@ -0,0 +1,53 @@ +/* Common data for asinpif/acospif implementations. + +Copyright (c) 2022-2025 Alexei Sibidanov. + +The original version of this file was copied from the CORE-MATH +project (src/binary32/sinpi/sinpif.c, revision f786e13). + +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_asincosf_data.h" + +const double __asincosf_b[] = + { + 0x1.fffffffd9ccb8p-1, 0x1.5555c94838007p-3, 0x1.32ded4b7c20fap-4, + 0x1.8566df703309ep-5, -0x1.980c959bec9a3p-6, 0x1.56fbb04998344p-1, + -0x1.403d8e4c49f52p+2, 0x1.b06c3e9f311eap+4, -0x1.9ea97c4e2c21fp+6, + 0x1.200b8261cc61bp+8, -0x1.2274c2799a5c7p+9, 0x1.a558a59cc19d3p+9, + -0x1.aca4b6a529ffp+9, 0x1.228744703f813p+9, -0x1.d7dbb0b322228p+7, + 0x1.5c2018c0c0105p+5 + }; + +const double __asincosf_c0[] = + { + 0x1.555555555529cp-3, 0x1.333333337e0ddp-4, 0x1.6db6db3b4465ep-5, + 0x1.f1c72e13ac306p-6, 0x1.6e89cebe06bc4p-6, 0x1.1c6dcf5289094p-6, + 0x1.c6dbbcc7c6315p-7, 0x1.8f8dc2615e996p-7, 0x1.a5833b7bf15e8p-8, + 0x1.43f44ace1665cp-6, -0x1.0fb17df881c73p-6, 0x1.07520c026b2d6p-5 + }; + +const double __asincosf_c1[] = + { + 0x1.6a09e667f3bcbp+0, 0x1.e2b7dddff2db9p-4, 0x1.b27247ab42dbcp-6, + 0x1.02995cc4e0744p-7, 0x1.5ffb0276ec8eap-9, 0x1.033885a928decp-10, + 0x1.911f2be23f8c7p-12, 0x1.4c3c55d2437fdp-13, 0x1.af477e1d7b461p-15, + 0x1.abd6bdff67dcbp-15, -0x1.1717e86d0fa28p-16, 0x1.6ff526de46023p-16 + }; diff --git a/sysdeps/ieee754/flt-32/e_asincosf_data.h b/sysdeps/ieee754/flt-32/e_asincosf_data.h new file mode 100644 index 0000000000..7dffb00dbe --- /dev/null +++ b/sysdeps/ieee754/flt-32/e_asincosf_data.h @@ -0,0 +1,37 @@ +/* Common data for asinpif/acospif implementations. + +Copyright (c) 2022-2025 Alexei Sibidanov. + +The original version of this file was copied from the CORE-MATH +project (src/binary32/sinpi/sinpif.c, revision f786e13). + +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 _ASINCOSF_DATAH +#define _ASINCOSF_DATAH + +extern const double __asincosf_b[] attribute_hidden; +extern const double __asincosf_c0[] attribute_hidden; +extern const double __asincosf_c1[] attribute_hidden; +#define B __asincosf_b +#define C0 __asincosf_c0 +#define C1 __asincosf_c1 + +#endif diff --git a/sysdeps/ieee754/flt-32/e_asinf.c b/sysdeps/ieee754/flt-32/e_asinf.c index 944bf6f5ce..854466361e 100644 --- a/sysdeps/ieee754/flt-32/e_asinf.c +++ b/sysdeps/ieee754/flt-32/e_asinf.c @@ -28,6 +28,7 @@ SOFTWARE. #include #include #include "math_config.h" +#include "e_asincosf_data.h" static __attribute__ ((noinline)) float as_special (float x) @@ -69,25 +70,16 @@ __ieee754_asinf (float x) { if (__glibc_unlikely (ax < 115 << 24)) return fmaf (x, 0x1p-25, x); - static const double b[] = - { - 0x1.0000000000005p+0, 0x1.55557aeca105dp-3, 0x1.3314ec3db7d12p-4, - 0x1.775738a5a6f92p-5, 0x1.5d5f7ce1c8538p-8, 0x1.605c6d58740fp-2, - -0x1.5728b732d73c6p+1, 0x1.f152170f151ebp+3, -0x1.f962ea3ca992ep+5, - 0x1.71971e17375ap+7, -0x1.860512b4ba23p+8, 0x1.26a3b8d4bdb14p+9, - -0x1.36f2ea5698b51p+9, 0x1.b3d722aebfa2ep+8, -0x1.6cf89703b1289p+7, - 0x1.1518af6a65e2dp+5 - }; double z = xs; double z2 = z * z; double z4 = z2 * z2; double z8 = z4 * z4; double z16 = z8 * z8; - r = z * ((((b[0] + z2 * b[1]) + z4 * (b[2] + z2 * b[3])) - + z8 * ((b[4] + z2 * b[5]) + z4 * (b[6] + z2 * b[7]))) - + z16 * (((b[8] + z2 * b[9]) + z4 * (b[10] + z2 * b[11])) - + z8 * ((b[12] + z2 * b[13]) - + z4 * (b[14] + z2 * b[15])))); + r = z * ((((B[0] + z2 * B[1]) + z4 * (B[2] + z2 * B[3])) + + z8 * ((B[4] + z2 * B[5]) + z4 * (B[6] + z2 * B[7]))) + + z16 * (((B[8] + z2 * B[9]) + z4 * (B[10] + z2 * B[11])) + + z8 * ((B[12] + z2 * B[13]) + + z4 * (B[14] + z2 * B[15])))); float ub = r; float lb = r - z * 0x1.efa8ebp-31; if (ub == lb) @@ -95,16 +87,9 @@ __ieee754_asinf (float x) } if (ax < (0x7eu << 24)) { - static const double c[] = - { - 0x1.555555555529cp-3, 0x1.333333337e0ddp-4, 0x1.6db6db3b4465ep-5, - 0x1.f1c72e13ac306p-6, 0x1.6e89cebe06bc4p-6, 0x1.1c6dcf5289094p-6, - 0x1.c6dbbcc7c6315p-7, 0x1.8f8dc2615e996p-7, 0x1.a5833b7bf15e8p-8, - 0x1.43f44ace1665cp-6, -0x1.0fb17df881c73p-6, 0x1.07520c026b2d6p-5 - }; double z = xs; double z2 = z * z; - double c0 = poly12 (z2, c); + double c0 = poly12 (z2, C0); r = z + (z * z2) * c0; } else @@ -116,14 +101,7 @@ __ieee754_asinf (float x) double bx = fabs (xs); double z = 1.0 - bx; double s = sqrt (z); - static const double c[] = - { - 0x1.6a09e667f3bcbp+0, 0x1.e2b7dddff2db9p-4, 0x1.b27247ab42dbcp-6, - 0x1.02995cc4e0744p-7, 0x1.5ffb0276ec8eap-9, 0x1.033885a928decp-10, - 0x1.911f2be23f8c7p-12, 0x1.4c3c55d2437fdp-13, 0x1.af477e1d7b461p-15, - 0x1.abd6bdff67dcbp-15, -0x1.1717e86d0fa28p-16, 0x1.6ff526de46023p-16 - }; - r = pi2 - s * poly12 (z, c); + r = pi2 - s * poly12 (z, C1); r = copysign (r, xs); } return r;