From patchwork Fri Feb 9 18:04:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 25890 Received: (qmail 126055 invoked by alias); 9 Feb 2018 18:04:22 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 126035 invoked by uid 89); 9 Feb 2018 18:04:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; Cc: nd@arm.com To: GNU C Library From: Szabolcs Nagy Subject: Remove slow paths from exp Message-ID: Date: Fri, 9 Feb 2018 18:04:08 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 X-ClientProxiedBy: HE1PR05CA0176.eurprd05.prod.outlook.com (2603:10a6:3:f8::24) To VI1PR0802MB2493.eurprd08.prod.outlook.com (2603:10a6:800:b4::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3b0d446d-3d40-4605-2302-08d56fe78699 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(49563074)(7193020); SRVR:VI1PR0802MB2493; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2493; 3:AlbHKVw/Y997UkEUZGJ6wcat/H1mOmRqGelZ2awkjxrXx6ClBxoyS4RupX3bPDWWrLV6WEyG0Id/u+JZPDiBr+YwNaGohhO0SGJ+DbatV3KOvyN5OuzOUhHfAQ/r4NOsODbQhz6XPU5YNUsNA8CbcAWF4PO/xU+h7BnSGkPFV0iC5XgkC6EOoZ7ZN/24K6bi4jWlf2oM8IFPa0xqv7Iu/UQE8fgi7VLE9YBH7tQGup1MYhxEARV4wuz59llrLhZc; 25:FztY22a0LumaoqsuLiZUmUD6TNBn5WuxTwCZvrgDZ9UlEGbRr9uc/iE9sB3/kUy37dKSQHOxSFyLjGcWAECY+hY6kzxX2pY1v6x88rgkxIlXn96mc13k4+ZpbdEYmKLiR5nUexj3jTxGbVi9mKBlSQVJtkiRQCsAw2V0KOl+gJpgtrNiwp/wofcPB/r0PG7VjvvsXBBfBbqfMC8ItFkJ5e3x1HPhw3drVDe/+ngW0jx3U8FWw9oxp/fAZSgxiJiurYnvKDtt95Ukrcz4022FVbd4K9oEcX7LmDcDYYa3tijPMfEUbk2V52bBQJqqdb3J9feW2MbauxoX5WCouLluqg==; 31:CthasbjRugEd2vFkixx0dYBiGTCMGriIsHHeEn+5fpWLlmaP5t26K05HPh1r0cXBCC2WZpfgN++kjjb5yL9lYPJKa50wwzK2xPPf43/sH+Vnrw73c3zSzkD6DzH6SsDcMnceZo/DgMD5nWer94GctUt8WT+jDz/mE+R1ylvlKmx1BY9AJE43e6GBh5Fi5D2sP7ge1O32XC+DvpB14D1Mzm+M01UUVUmIy4HFw76TXKY= X-MS-TrafficTypeDiagnostic: VI1PR0802MB2493: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2493; 20:yULEIeIxIqi7HfLK9FJHOZExnowHy+b616VwiCpm1WYA+9/eQXMnXC0c0AXQR/XLl808/L4Yy72AGeCwIeWAhvk9CKTKYRL8CqH0tWYnBxcEIdBi38m5kwLuCyJX0CucUKCkTVK5j6cEfdICGhSrAfuj/XO7/wn0RyAMXkN0xhk=; 4:PGJOKGPkpakVPDs1GjU9l+jVN7vFPail+2Gb9IwfECHWrrUvWxlyKT6MCtfbzp552qKSPTiincjiR3IJPVijl97HZrOMbnKQ+nJ6DIjqU7RZzpql+0qL4JgLcnDDJaQvDgx+7UOsSrSsNfAE//Zs0Azo1BuVA5umAAqP/wD6TwyUT0eezYIjbuVnUp0WKhCuQlPuhGopeIjNynPkT9Mhfe5NLbeVPGyLnNdIrr7Xr3bLRDcunaD3nTZKeear/ANc+78TXr7PUA5TTOcPDVrLQT7qt7txCNnj8fFkS7kfju32qtKNkRtlhmj/Aeo6QV+j X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415395)(6040501)(2401047)(8121501046)(5005006)(3231101)(2400082)(944501161)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0802MB2493; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0802MB2493; X-Forefront-PRVS: 057859F9C5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(39860400002)(396003)(366004)(39380400002)(376002)(346002)(189003)(377424004)(199004)(568964002)(31696002)(106356001)(65956001)(16576012)(65806001)(7736002)(66066001)(3846002)(2476003)(58126008)(6116002)(68736007)(31686004)(83506002)(21490400003)(52116002)(478600001)(6916009)(6666003)(2906002)(305945005)(270700001)(65826007)(37036004)(64126003)(72206003)(5890100001)(4610100001)(36756003)(25786009)(84326002)(53936002)(33964004)(16586007)(16526019)(59450400001)(86362001)(77096007)(105586002)(26005)(386003)(81156014)(6486002)(316002)(8936002)(81166006)(5660300001)(97736004)(4326008)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0802MB2493; H:[10.2.206.230]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0802MB2493; 23:q2buHVl4sF3dCti2upvQM381J6mdyAoLDttnixA?= =?us-ascii?Q?cU3ucBpdX7KfpMJo2OZ8MwwolFBPEpk1+BLYOjtjCuSc7jSnNduIVqJhT2yg?= =?us-ascii?Q?iFmACjMPNEyg2XyYjZDKirw5a/uw7cEMxgkekWeijWXSxQ9u3qQQzAciLPFy?= =?us-ascii?Q?9qH41VDd+mgOzBrJAAgTm4co+FvWs/dkG5r7LlSHVH80mmqAwj7KAfiHFECi?= =?us-ascii?Q?6d1vbRvzGlD3Z8+GduBbbs15G2jEVyCL5VSI3czo+3Oh2zWCCDXBB4Tvu9VN?= =?us-ascii?Q?TBjx61vrPkDeyCA9xsrE0uir2IPfImfL/egI4BXGS9MOT0q9B/tCgeMQ4l74?= =?us-ascii?Q?G/YpjdymGFisGszwK8nDUJVyf5CKKdR/315qRKhkV5HR1hhpT2rtsCW4MpDH?= =?us-ascii?Q?nP/91ZxIEttPeWcC+ExS0k8D4s6O8q0j0+xea5MD3tOdkW6yw9HAUkGv+LKm?= =?us-ascii?Q?aWT7kaC5df0BYJ+h+ghKmbHUD4zsbTxVX4EvzT0Hle8u/8/mHZoBKUgBwDfD?= =?us-ascii?Q?5ZpVBFBHvvl7v/rqW6jPoa4E4j0vKjv+xchIiPsWxVy/GZ7EmgWNOdfk+z3W?= =?us-ascii?Q?g7lEPFJHJKJsyAUSE2cHyX+5FlZwG9D3UMXPrfZ+ety4PJYBFivkW8sHAMwi?= =?us-ascii?Q?wIqrqS1NZ53EWE3o2Xi4LwIjwjpbcV1IyKYszJSeJcZvA8QPMxOnBn/hxz8k?= =?us-ascii?Q?5Zqs19unmUQ45AMqjP4J2RHjCy91oP0Tvpkws3bRwNxZSRx2boh50F4yUub3?= =?us-ascii?Q?zZgsrXxB9H4JzvlPnbDYnqehiN8PcreeGe/wyx9AnVeQUl16FK++4L2Zqzyw?= =?us-ascii?Q?Kk7SruEHLjatA4w6hu00i6Cug+o5TS4j44OlO6FLDBNRCn7qyQp3Qt+EMALd?= =?us-ascii?Q?dTLm9Xgf1WW15AOUUu6Arlg0FSOvvzUq7dx6u+fPfDLc4rkHUyOq/su9IV9a?= =?us-ascii?Q?7nCtgIAHwDobLHWs0IgWyE8mVxGbls/xnwnqhi+OEAyxQE7U7yScq9cFdMlr?= =?us-ascii?Q?tsAck8GnmyJmya4CXvwSgMLdLGT3Pa90ScKwMHixTql5Jwf3V28YiBNWQ/al?= =?us-ascii?Q?ILtlEfhO9Xhft+dtlDX+ppTl12J268/U2dK6coyfn6Xez54f4aBSYi86OzFa?= =?us-ascii?Q?jgamzj3447BDarg8tPZCq4E3wkMUnhyWrgax/XeN906vwei43ZrflRthKjKo?= =?us-ascii?Q?OcoutKNMqCnYN1f3hWTpdEUt0K3bs7FmkljF5EEv88p50XqC699OgEd1oTjk?= =?us-ascii?Q?u63nOyFAhwQyv1nhpL7VwOw8mPpsc/ie8wgW6smY9zhhvPeXQOXNjzz56hH+?= =?us-ascii?Q?khuvDR1eyPcDOE7LscR4OaFvUg+jdEuV+G/d+NLSJ2x1i/QufX10TVkWXg00?= =?us-ascii?Q?FYrojvMAzK7qeyHbpq+pWuUOD0mzb80gXq84Sd+j2IcEg8d/SsysZeaEVJiu?= =?us-ascii?Q?Ooc8wU6+fVQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0802MB2493; 6:k2AOTWL3/JnSFPOdBtV5oGliyrnVywDCCerMVnX1xzrIAFF8rblChMHdKymnlTbxoyRu3ohTZS49BMrQZ+LqIrL1Oy+Gw6FuWTMe0TWw1BL4E0Kw1aReRIBCxOhgbZtHs8cc5MHCbhB26BN5cZLwwM8IfjqJRqzR2rcLqmbjAw2xwUHSj/K/4sJZiaw5kQMjTE2OdHT6fQzero0lKXRB/oUjig+EHZ1biwR8WXjv9vo5IT3/+JOLDcf1xTcQbFPbe3p3yCVLWYWPm5Pm6CjDUtj1SmDcrILL/3y/k/kDk9OmDnSpWp9JMowQtW/TcmHgf8WEou+XxMr1BnTirL/1TkYDRTRa9kUY+xntfNUpy/E=; 5:VUXOqfQ41qjBoskRTjaIt5+mEmhGxYR4Znts74nkS+FqCKH35kbHcN56osjfYIedl6IPWhMpfxcG5sro50ItpnxGmHpKFvmxqQkwKE3KMUlC/x2P5SZ8sPvH6Zl7WrMsKG0qH8FXaMpMbfbYmlVgI1/3G2HlxDfxwWPK2c/6Au4=; 24:8alIKBWmp8eDEQyPM9AJOo4bTqD2rR3RrKgkmhQXyKPMIYeRmhrzfwpNH0VzSzJt61oNUncyCtaV0If64zQIP9xOQ6xgyhOewjzSDrm5AcA=; 7:UEPLh5alVrmNEwBu1SpG/jmoKZbqzdA4mmXDgtZRdcOocszNZEXg5dbozqe5Z4b29Cxmdbfuqa0Hqk5lRKPd9uFV52fLy/EBK2fiTP5o7+dmeYn3VP4PrCh/217FODtAAEVI01IVmDA4XrLfHu2njW79uiK1WMdJg5KD9Ispc0jsjLIy7TzJoNFkpPGDY4cBhPAbSLrWT1foNmWFQNGb1S2QZQP7opGAwRnc0Pm3FiKIdhEjiTacZbqKhyKp7sSp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2018 18:04:12.4885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b0d446d-3d40-4605-2302-08d56fe78699 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2493 Remove the __slowexp code, so exp is no longer correctly rounded. The result is computed to about 70 bits precision so the worst case ulp error is about 0.500007 in nearest rounding mode. 2018-02-09 Szabolcs Nagy * manual/probes.texi: Remove slowexp probes. * math/Makefile: Remove slowexp. * sysdeps/generic/math_private.h (__slowexp): Remove. * sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Remove __slowexp and document error bounds. * sysdeps/i386/fpu/slowexp.c: Remove. * sysdeps/ia64/fpu/slowexp.c: Remove. * sysdeps/ieee754/dbl-64/e_pow.c: Update comment. * sysdeps/ieee754/dbl-64/slowexp.c: Remove. * sysdeps/ieee754/dbl-64/uexp.h (err_0): Remove. * sysdeps/m68k/m680x0/fpu/slowexp.c: Remove. * sysdeps/powerpc/power4/fpu/Makefile (CPPFLAGS-slowexp.c): Remove. * sysdeps/x86_64/fpu/multiarch/Makefile: Remove slowexp-fma. * sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__slowexp): Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-avx.c: Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Remove. * sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c: Remove. diff --git a/manual/probes.texi b/manual/probes.texi index e99b7f3cb4..ad673eb22b 100644 --- a/manual/probes.texi +++ b/manual/probes.texi @@ -258,20 +258,6 @@ Unless explicitly mentioned otherwise, a precision of 1 implies 24 bits of precision in the mantissa of the multiple precision number. Hence, a precision level of 32 implies 768 bits of precision in the mantissa. -@deftp Probe slowexp_p6 (double @var{$arg1}, double @var{$arg2}) -This probe is triggered when the @code{exp} function is called with an -input that results in multiple precision computation with precision -6. Argument @var{$arg1} is the input value and @var{$arg2} is the -computed output. -@end deftp - -@deftp Probe slowexp_p32 (double @var{$arg1}, double @var{$arg2}) -This probe is triggered when the @code{exp} function is called with an -input that results in multiple precision computation with precision -32. Argument @var{$arg1} is the input value and @var{$arg2} is the -computed output. -@end deftp - @deftp Probe slowpow_p10 (double @var{$arg1}, double @var{$arg2}, double @var{$arg3}, double @var{$arg4}) This probe is triggered when the @code{pow} function is called with inputs that result in multiple precision computation with precision diff --git a/math/Makefile b/math/Makefile index 4c8703c71e..46e33a6434 100644 --- a/math/Makefile +++ b/math/Makefile @@ -114,7 +114,7 @@ type-ldouble-yes := ldouble # double support type-double-suffix := type-double-routines := branred doasin dosincos halfulp mpa mpatan2 \ - mpatan mpexp mplog mpsqrt mptan sincos32 slowexp \ + mpatan mpexp mplog mpsqrt mptan sincos32 \ slowpow sincostab k_rem_pio2 # float support diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h index 0a35cb39fb..f411188461 100644 --- a/sysdeps/generic/math_private.h +++ b/sysdeps/generic/math_private.h @@ -262,7 +262,6 @@ extern double __sin32 (double __x, double __res, double __res1); extern double __cos32 (double __x, double __res, double __res1); extern double __mpsin (double __x, double __dx, bool __range_reduce); extern double __mpcos (double __x, double __dx, bool __range_reduce); -extern double __slowexp (double __x); extern double __slowpow (double __x, double __y, double __z); extern void __docos (double __x, double __dx, double __v[]); diff --git a/sysdeps/i386/fpu/slowexp.c b/sysdeps/i386/fpu/slowexp.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/slowexp.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/ia64/fpu/slowexp.c b/sysdeps/ia64/fpu/slowexp.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/ia64/fpu/slowexp.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c index 3d2560c9c0..80e750c520 100644 --- a/sysdeps/ieee754/dbl-64/e_exp.c +++ b/sysdeps/ieee754/dbl-64/e_exp.c @@ -23,10 +23,10 @@ /* exp1 */ /* */ /* FILES NEEDED:dla.h endian.h mpa.h mydefs.h uexp.h */ -/* mpa.c mpexp.x slowexp.c */ +/* mpa.c mpexp.x */ /* */ /* An ultimate exp routine. Given an IEEE double machine number x */ -/* it computes the correctly rounded (to nearest) value of e^x */ +/* it computes an almost correctly rounded (to nearest) value of e^x */ /* Assumption: Machine arithmetic operations are performed in */ /* round to nearest mode of IEEE 754 standard. */ /* */ @@ -46,10 +46,6 @@ # define SECTION #endif -double __slowexp (double); - -/* An ultimate exp routine. Given an IEEE double machine number x it computes - the correctly rounded (to nearest) value of e^x. */ double SECTION __ieee754_exp (double x) @@ -93,17 +89,10 @@ __ieee754_exp (double x) rem = (bet + bet * eps) + al * eps; res = al + rem; - cor = (al - res) + rem; - if (res == (res + cor * err_0)) - { - retval = res * binexp.x; - goto ret; - } - else - { - retval = __slowexp (x); - goto ret; - } /*if error is over bound */ + /* Maximum relative error is 7.8e-22 (70.1 bits). + Maximum ULP error is 0.500007. */ + retval = res * binexp.x; + goto ret; } if (n <= smallint) @@ -166,38 +155,22 @@ __ieee754_exp (double x) if (ex >= -1022) { binexp.i[HIGH_HALF] = (1023 + ex) << 20; - if (res == (res + cor * err_0)) - { - retval = res * binexp.x; - goto ret; - } - else - { - retval = __slowexp (x); - goto check_uflow_ret; - } /*if error is over bound */ + /* Does not underflow: res >= 1.0, binexp >= 0x1p-1022 + Maximum relative error is 7.8e-22 (70.1 bits). + Maximum ULP error is 0.500007. */ + retval = res * binexp.x; + goto ret; } ex = -(1022 + ex); binexp.i[HIGH_HALF] = (1023 - ex) << 20; res *= binexp.x; cor *= binexp.x; - eps = 1.0000000001 + err_0 * binexp.x; t = 1.0 + res; y = ((1.0 - t) + res) + cor; res = t + y; - cor = (t - res) + y; - if (res == (res + eps * cor)) - { - binexp.i[HIGH_HALF] = 0x00100000; - retval = (res - 1.0) * binexp.x; - goto check_uflow_ret; - } - else - { - retval = __slowexp (x); - goto check_uflow_ret; - } /* if error is over bound */ - check_uflow_ret: + /* Maximum ULP error is 0.5000035. */ + binexp.i[HIGH_HALF] = 0x00100000; + retval = (res - 1.0) * binexp.x; if (retval < DBL_MIN) { double force_underflow = tiny * tiny; @@ -210,10 +183,9 @@ __ieee754_exp (double x) else { binexp.i[HIGH_HALF] = (junk1.i[LOW_HALF] + 767) << 20; - if (res == (res + cor * err_0)) - retval = res * binexp.x * t256.x; - else - retval = __slowexp (x); + /* Maximum relative error is 7.8e-22 (70.1 bits). + Maximum ULP error is 0.500007. */ + retval = res * binexp.x * t256.x; if (isinf (retval)) goto ret_huge; else diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c index f6e5fcdbce..c410b04e3e 100644 --- a/sysdeps/ieee754/dbl-64/e_pow.c +++ b/sysdeps/ieee754/dbl-64/e_pow.c @@ -25,7 +25,7 @@ /* log1 */ /* checkint */ /* FILES NEEDED: dla.h endian.h mpa.h mydefs.h */ -/* halfulp.c mpexp.c mplog.c slowexp.c slowpow.c mpa.c */ +/* halfulp.c mpexp.c mplog.c slowpow.c mpa.c */ /* uexp.c upow.c */ /* root.tbl uexp.tbl upow.tbl */ /* An ultimate power routine. Given two IEEE double machine numbers y,x */ diff --git a/sysdeps/ieee754/dbl-64/slowexp.c b/sysdeps/ieee754/dbl-64/slowexp.c deleted file mode 100644 index ba5617466c..0000000000 --- a/sysdeps/ieee754/dbl-64/slowexp.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2018 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/**************************************************************************/ -/* MODULE_NAME:slowexp.c */ -/* */ -/* FUNCTION:slowexp */ -/* */ -/* FILES NEEDED:mpa.h */ -/* mpa.c mpexp.c */ -/* */ -/*Converting from double precision to Multi-precision and calculating */ -/* e^x */ -/**************************************************************************/ -#include - -#include - -#ifndef USE_LONG_DOUBLE_FOR_MP -# include "mpa.h" -void __mpexp (mp_no *x, mp_no *y, int p); -#endif - -#ifndef SECTION -# define SECTION -#endif - -/*Converting from double precision to Multi-precision and calculating e^x */ -double -SECTION -__slowexp (double x) -{ -#ifndef USE_LONG_DOUBLE_FOR_MP - double w, z, res, eps = 3.0e-26; - int p; - mp_no mpx, mpy, mpz, mpw, mpeps, mpcor; - - /* Use the multiple precision __MPEXP function to compute the exponential - First at 144 bits and if it is not accurate enough, at 768 bits. */ - p = 6; - __dbl_mp (x, &mpx, p); - __mpexp (&mpx, &mpy, p); - __dbl_mp (eps, &mpeps, p); - __mul (&mpeps, &mpy, &mpcor, p); - __add (&mpy, &mpcor, &mpw, p); - __sub (&mpy, &mpcor, &mpz, p); - __mp_dbl (&mpw, &w, p); - __mp_dbl (&mpz, &z, p); - if (w == z) - { - /* Track how often we get to the slow exp code plus - its input/output values. */ - LIBC_PROBE (slowexp_p6, 2, &x, &w); - return w; - } - else - { - p = 32; - __dbl_mp (x, &mpx, p); - __mpexp (&mpx, &mpy, p); - __mp_dbl (&mpy, &res, p); - - /* Track how often we get to the uber-slow exp code plus - its input/output values. */ - LIBC_PROBE (slowexp_p32, 2, &x, &res); - return res; - } -#else - return (double) __ieee754_expl((long double)x); -#endif -} diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h index a8a023ee80..592b9725b9 100644 --- a/sysdeps/ieee754/dbl-64/uexp.h +++ b/sysdeps/ieee754/dbl-64/uexp.h @@ -30,7 +30,7 @@ #include "mydefs.h" const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300, -err_0 = 1.000014, err_1 = 0.000016; +err_1 = 0.000016; const static int4 bigint = 0x40862002, badint = 0x40876000,smallint = 0x3C8fffff; const static int4 hugeint = 0x7FFFFFFF, infint = 0x7ff00000; diff --git a/sysdeps/m68k/m680x0/fpu/slowexp.c b/sysdeps/m68k/m680x0/fpu/slowexp.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/m68k/m680x0/fpu/slowexp.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/powerpc/power4/fpu/Makefile b/sysdeps/powerpc/power4/fpu/Makefile index e17d32f30e..ded9976b9d 100644 --- a/sysdeps/powerpc/power4/fpu/Makefile +++ b/sysdeps/powerpc/power4/fpu/Makefile @@ -3,5 +3,4 @@ ifeq ($(subdir),math) CFLAGS-mpa.c += --param max-unroll-times=4 -funroll-loops -fpeel-loops CPPFLAGS-slowpow.c += -DUSE_LONG_DOUBLE_FOR_MP=1 -CPPFLAGS-slowexp.c += -DUSE_LONG_DOUBLE_FOR_MP=1 endif diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile index 9a89bfc286..6935ac3dd0 100644 --- a/sysdeps/x86_64/fpu/multiarch/Makefile +++ b/sysdeps/x86_64/fpu/multiarch/Makefile @@ -10,7 +10,7 @@ libm-sysdep_routines += s_ceil-sse4_1 s_ceilf-sse4_1 s_floor-sse4_1 \ libm-sysdep_routines += e_exp-fma e_log-fma e_pow-fma s_atan-fma \ e_asin-fma e_atan2-fma s_sin-fma s_tan-fma \ - mplog-fma mpa-fma slowexp-fma slowpow-fma \ + mplog-fma mpa-fma slowpow-fma \ sincos32-fma doasin-fma dosincos-fma \ halfulp-fma mpexp-fma \ mpatan2-fma mpatan-fma mpsqrt-fma mptan-fma @@ -32,7 +32,6 @@ CFLAGS-mpsqrt-fma.c = -mfma -mavx2 CFLAGS-mptan-fma.c = -mfma -mavx2 CFLAGS-s_atan-fma.c = -mfma -mavx2 CFLAGS-sincos32-fma.c = -mfma -mavx2 -CFLAGS-slowexp-fma.c = -mfma -mavx2 CFLAGS-slowpow-fma.c = -mfma -mavx2 CFLAGS-s_sin-fma.c = -mfma -mavx2 CFLAGS-s_tan-fma.c = -mfma -mavx2 @@ -53,7 +52,7 @@ CFLAGS-s_sincosf-fma.c = -mfma -mavx2 libm-sysdep_routines += e_exp-fma4 e_log-fma4 e_pow-fma4 s_atan-fma4 \ e_asin-fma4 e_atan2-fma4 s_sin-fma4 s_tan-fma4 \ - mplog-fma4 mpa-fma4 slowexp-fma4 slowpow-fma4 \ + mplog-fma4 mpa-fma4 slowpow-fma4 \ sincos32-fma4 doasin-fma4 dosincos-fma4 \ halfulp-fma4 mpexp-fma4 \ mpatan2-fma4 mpatan-fma4 mpsqrt-fma4 mptan-fma4 @@ -75,14 +74,13 @@ CFLAGS-mpsqrt-fma4.c = -mfma4 CFLAGS-mptan-fma4.c = -mfma4 CFLAGS-s_atan-fma4.c = -mfma4 CFLAGS-sincos32-fma4.c = -mfma4 -CFLAGS-slowexp-fma4.c = -mfma4 CFLAGS-slowpow-fma4.c = -mfma4 CFLAGS-s_sin-fma4.c = -mfma4 CFLAGS-s_tan-fma4.c = -mfma4 libm-sysdep_routines += e_exp-avx e_log-avx s_atan-avx \ e_atan2-avx s_sin-avx s_tan-avx \ - mplog-avx mpa-avx slowexp-avx \ + mplog-avx mpa-avx \ mpexp-avx CFLAGS-e_atan2-avx.c = -msse2avx -DSSE2AVX @@ -93,7 +91,6 @@ CFLAGS-mpexp-avx.c = -msse2avx -DSSE2AVX CFLAGS-mplog-avx.c = -msse2avx -DSSE2AVX CFLAGS-s_atan-avx.c = -msse2avx -DSSE2AVX CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX -CFLAGS-slowexp-avx.c = -msse2avx -DSSE2AVX CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX endif diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp-avx.c b/sysdeps/x86_64/fpu/multiarch/e_exp-avx.c index ee5dd6d2dc..afd917442a 100644 --- a/sysdeps/x86_64/fpu/multiarch/e_exp-avx.c +++ b/sysdeps/x86_64/fpu/multiarch/e_exp-avx.c @@ -1,6 +1,5 @@ #define __ieee754_exp __ieee754_exp_avx #define __exp1 __exp1_avx -#define __slowexp __slowexp_avx #define SECTION __attribute__ ((section (".text.avx"))) #include diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp-fma.c b/sysdeps/x86_64/fpu/multiarch/e_exp-fma.c index 6e0fdb7941..765b1b9dd3 100644 --- a/sysdeps/x86_64/fpu/multiarch/e_exp-fma.c +++ b/sysdeps/x86_64/fpu/multiarch/e_exp-fma.c @@ -1,6 +1,5 @@ #define __ieee754_exp __ieee754_exp_fma #define __exp1 __exp1_fma -#define __slowexp __slowexp_fma #define SECTION __attribute__ ((section (".text.fma"))) #include diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c b/sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c index ae6eb67603..9ac7acad28 100644 --- a/sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c +++ b/sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c @@ -1,6 +1,5 @@ #define __ieee754_exp __ieee754_exp_fma4 #define __exp1 __exp1_fma4 -#define __slowexp __slowexp_fma4 #define SECTION __attribute__ ((section (".text.fma4"))) #include diff --git a/sysdeps/x86_64/fpu/multiarch/slowexp-avx.c b/sysdeps/x86_64/fpu/multiarch/slowexp-avx.c deleted file mode 100644 index d01c6d71a4..0000000000 --- a/sysdeps/x86_64/fpu/multiarch/slowexp-avx.c +++ /dev/null @@ -1,9 +0,0 @@ -#define __slowexp __slowexp_avx -#define __add __add_avx -#define __dbl_mp __dbl_mp_avx -#define __mpexp __mpexp_avx -#define __mul __mul_avx -#define __sub __sub_avx -#define SECTION __attribute__ ((section (".text.avx"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/slowexp-fma.c b/sysdeps/x86_64/fpu/multiarch/slowexp-fma.c deleted file mode 100644 index 6fffca1a93..0000000000 --- a/sysdeps/x86_64/fpu/multiarch/slowexp-fma.c +++ /dev/null @@ -1,9 +0,0 @@ -#define __slowexp __slowexp_fma -#define __add __add_fma -#define __dbl_mp __dbl_mp_fma -#define __mpexp __mpexp_fma -#define __mul __mul_fma -#define __sub __sub_fma -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c b/sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c deleted file mode 100644 index 3bcde84233..0000000000 --- a/sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c +++ /dev/null @@ -1,9 +0,0 @@ -#define __slowexp __slowexp_fma4 -#define __add __add_fma4 -#define __dbl_mp __dbl_mp_fma4 -#define __mpexp __mpexp_fma4 -#define __mul __mul_fma4 -#define __sub __sub_fma4 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include