From owner-svn-src-head@freebsd.org Sun Sep 20 05:28:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1E3B3FCAC3; Sun, 20 Sep 2020 05:28:31 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BvGM36B32z44tr; Sun, 20 Sep 2020 05:28:31 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3D1117F70; Sun, 20 Sep 2020 05:28:31 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08K5SV1N002325; Sun, 20 Sep 2020 05:28:31 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08K5SVTd002323; Sun, 20 Sep 2020 05:28:31 GMT (envelope-from se@FreeBSD.org) Message-Id: <202009200528.08K5SVTd002323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Sun, 20 Sep 2020 05:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365921 - in head/lib/msun: ld128 ld80 X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: in head/lib/msun: ld128 ld80 X-SVN-Commit-Revision: 365921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Sep 2020 05:28:32 -0000 Author: se Date: Sun Sep 20 05:28:31 2020 New Revision: 365921 URL: https://svnweb.freebsd.org/changeset/base/365921 Log: Apply fix for ld80 and ld128 submitted by Steve Kargl: - Micro-optimization: use sincosl(x) instead of a call to cosl(x) and a call to sinl(x). Argument reduction is done once not twice. - Use a long double constant instead of an invalid double constant. - Spell scale2 correctly He could not test ld128, so that patch is untested. Submitted by: sgk at troutmask.apl.washington.edu (Steve Kargl) Modified: head/lib/msun/ld128/k_expl.h head/lib/msun/ld80/k_expl.h Modified: head/lib/msun/ld128/k_expl.h ============================================================================== --- head/lib/msun/ld128/k_expl.h Sun Sep 20 05:23:16 2020 (r365920) +++ head/lib/msun/ld128/k_expl.h Sun Sep 20 05:28:31 2020 (r365921) @@ -300,7 +300,7 @@ hexpl(long double x) static inline long double complex __ldexp_cexpl(long double complex z, int expt) { - long double exp_x, hi, lo; + long double c, exp_x, hi, lo, s; long double x, y, scale1, scale2; int half_expt, k; @@ -308,16 +308,17 @@ __ldexp_cexpl(long double complex z, int expt) y = cimagl(z); __k_expl(x, &hi, &lo, &k); - exp_x = (lo + hi) * 0x1p16382; + exp_x = (lo + hi) * 0x1p16382L; expt += k - 16382; scale1 = 1; half_expt = expt / 2; SET_LDBL_EXPSIGN(scale1, BIAS + half_expt); scale2 = 1; - SET_LDBL_EXPSIGN(scale1, BIAS + expt - half_expt); + SET_LDBL_EXPSIGN(scale2, BIAS + expt - half_expt); - return (CMPLXL(cos(y) * exp_x * scale1 * scale2, - sinl(y) * exp_x * scale1 * scale2)); + sincosl(y, &s, &c); + return (CMPLXL(c * exp_x * scale1 * scale2, + s * exp_x * scale1 * scale2)); } #endif /* _COMPLEX_H */ Modified: head/lib/msun/ld80/k_expl.h ============================================================================== --- head/lib/msun/ld80/k_expl.h Sun Sep 20 05:23:16 2020 (r365920) +++ head/lib/msun/ld80/k_expl.h Sun Sep 20 05:28:31 2020 (r365921) @@ -277,7 +277,7 @@ hexpl(long double x) static inline long double complex __ldexp_cexpl(long double complex z, int expt) { - long double exp_x, hi, lo; + long double c, exp_x, hi, lo, s; long double x, y, scale1, scale2; int half_expt, k; @@ -285,16 +285,17 @@ __ldexp_cexpl(long double complex z, int expt) y = cimagl(z); __k_expl(x, &hi, &lo, &k); - exp_x = (lo + hi) * 0x1p16382; + exp_x = (lo + hi) * 0x1p16382L; expt += k - 16382; scale1 = 1; half_expt = expt / 2; SET_LDBL_EXPSIGN(scale1, BIAS + half_expt); scale2 = 1; - SET_LDBL_EXPSIGN(scale1, BIAS + expt - half_expt); + SET_LDBL_EXPSIGN(scale2, BIAS + expt - half_expt); - return (CMPLXL(cos(y) * exp_x * scale1 * scale2, - sinl(y) * exp_x * scale1 * scale2)); + sincosl(y, &s, &c); + return (CMPLXL(c * exp_x * scale1 * scale2, + s * exp_x * scale1 * scale2)); } #endif /* _COMPLEX_H */