From owner-svn-src-all@freebsd.org Sun Sep 20 05:32:54 2020 Return-Path: Delivered-To: svn-src-all@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 16AD23FCCFF; Sun, 20 Sep 2020 05:32:54 +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 4BvGS56yQqz44wZ; Sun, 20 Sep 2020 05:32:53 +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 D1E8F185D4; Sun, 20 Sep 2020 05:32:53 +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 08K5WrTK007930; Sun, 20 Sep 2020 05:32:53 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08K5WrUZ007928; Sun, 20 Sep 2020 05:32:53 GMT (envelope-from se@FreeBSD.org) Message-Id: <202009200532.08K5WrUZ007928@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:32:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365922 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 365922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Sep 2020 05:32:54 -0000 Author: se Date: Sun Sep 20 05:32:53 2020 New Revision: 365922 URL: https://svnweb.freebsd.org/changeset/base/365922 Log: Apply an opimization for the kernels used by cexp(x) and cexpf(x) submitted by Steve Kargl: - Use sincos[f] instead of a call to cos[f] and a call to sin[f]. - While here, alphabetize declaration. Submitted by: sgk at troutmask.apl.washington.edu (Steve Kargl) Modified: head/lib/msun/src/k_exp.c head/lib/msun/src/k_expf.c Modified: head/lib/msun/src/k_exp.c ============================================================================== --- head/lib/msun/src/k_exp.c Sun Sep 20 05:28:31 2020 (r365921) +++ head/lib/msun/src/k_exp.c Sun Sep 20 05:32:53 2020 (r365922) @@ -88,7 +88,7 @@ __ldexp_exp(double x, int expt) double complex __ldexp_cexp(double complex z, int expt) { - double x, y, exp_x, scale1, scale2; + double c, exp_x, s, scale1, scale2, x, y; int ex_expt, half_expt; x = creal(z); @@ -105,6 +105,7 @@ __ldexp_cexp(double complex z, int expt) half_expt = expt - half_expt; INSERT_WORDS(scale2, (0x3ff + half_expt) << 20, 0); - return (CMPLX(cos(y) * exp_x * scale1 * scale2, - sin(y) * exp_x * scale1 * scale2)); + sincos(y, &s, &c); + return (CMPLX(c * exp_x * scale1 * scale2, + s * exp_x * scale1 * scale2)); } Modified: head/lib/msun/src/k_expf.c ============================================================================== --- head/lib/msun/src/k_expf.c Sun Sep 20 05:28:31 2020 (r365921) +++ head/lib/msun/src/k_expf.c Sun Sep 20 05:32:53 2020 (r365922) @@ -71,7 +71,7 @@ __ldexp_expf(float x, int expt) float complex __ldexp_cexpf(float complex z, int expt) { - float x, y, exp_x, scale1, scale2; + float c, exp_x, s, scale1, scale2, x, y; int ex_expt, half_expt; x = crealf(z); @@ -84,6 +84,7 @@ __ldexp_cexpf(float complex z, int expt) half_expt = expt - half_expt; SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23); - return (CMPLXF(cosf(y) * exp_x * scale1 * scale2, - sinf(y) * exp_x * scale1 * scale2)); + sincosf(y, &s, &c); + return (CMPLXF(c * exp_x * scale1 * scale2, + s * exp_x * scale1 * scale2)); }