From owner-freebsd-current@freebsd.org Sun Jul 15 16:15:10 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 974871045055 for ; Sun, 15 Jul 2018 16:15:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 323B58D47E for ; Sun, 15 Jul 2018 16:15:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x241.google.com with SMTP id s7-v6so17552166itb.4 for ; Sun, 15 Jul 2018 09:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6gWWC0KK1R1pzTAoR95oft0jQbu+wb97Fz+t03XhiUM=; b=n3aQh6kL7DPtHkGY891USUYVpjmxrY5Le0zqL2TmajZq/xrTrsy8fvAL4nmZ47KpRN hWKt4rZ+AL6CJgAhOGu7vP64Ei/PFX2dpUR4lxdezxQGeYoPWUFou3iY/VPDYuc8Y00J NRdWH+UvKuJjlejNgOklWEIm4Oq5VgjuE0rwO1WgNCES1deMyxLxuwVcxlb9IHu++bnC SdjAxaSSHWz61daOub/PiILMYIr1MqdL6TyrHM52dmwWu9QJp3lJIlgALlHfd9WDZcLY QTx8mUnortlsDgufQ9JPVlklZFggrRr7u/SBCrhJoeK30Af/3q4de1rr+uTv4XV6ykbe jPaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6gWWC0KK1R1pzTAoR95oft0jQbu+wb97Fz+t03XhiUM=; b=A85BJUAiP6jgLtv8t7sQcUGD99aYwqrjiF0+nOekkgI9YNvDIsuF2nV+5ha+E/sE9o DSuZxyMtvC0uHdoYCJ5VdBgikDO0Oap+AiWFI1Ki78fl5xtlOfkoYe51gjBjQkdJmQZc AmwKMsB5iLo/rxs3E5fSRBlVoxnQo2bUDbIfEVEvCvPuv9wKRLI2Be/3I/+rBVmdtPlp TqDTM7B6V3BMHzazQGfhO/68PdUKjRnEKKegoZlw/8ptwmx6K5kCgG97lH3QBY6LzdmP AgSl0Hg/RD238tvEtlM9G3ShOeDjOCjSl3wdXOMJ9ppAAnfosfbCxum9ku1yf5AcoB+B K8IA== X-Gm-Message-State: AOUpUlECheUdksTd8yTI0fdFHBhXLcP0TR2Hgz+1yhAkzDW1otjmXr74 5K/GQ3QzeJtqEMWvb80QELlOhJ9TbobdOfXeqNuKxg== X-Google-Smtp-Source: AAOMgpdRXteneQ48qQ8qeh+H6WKfSDRCveH5tch8DqyWNxna8xz+RQQppJzRTk+Y9T1BeATLIlktbpGBT99HpZXS+uM= X-Received: by 2002:a24:ad28:: with SMTP id c40-v6mr10277027itf.36.1531671309409; Sun, 15 Jul 2018 09:15:09 -0700 (PDT) MIME-Version: 1.0 References: <20180715150638.GA30154@troutmask.apl.washington.edu> In-Reply-To: <20180715150638.GA30154@troutmask.apl.washington.edu> From: Warner Losh Date: Sun, 15 Jul 2018 10:14:57 -0600 Message-ID: Subject: Re: [PATCH] Recent libm additions To: Steve Kargl Cc: FreeBSD Current Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2018 16:15:10 -0000 These changes look perfect to me. Warner On Sun, Jul 15, 2018, 9:08 AM Steve Kargl wrote: > Apparently, the recents additions to libm were not > subject to any code review. The following patch > does two things. First, it works around > > https://bugs.llvm.org/show_bug.cgi?id=8532 > > Second, it removes the pollution of libm with the > polevll.c functions. Those functions are used > only in ld80/e_powl.c, and those functions should > be inlined. > > Index: Makefile > =================================================================== > --- Makefile (revision 336304) > +++ Makefile (working copy) > @@ -56,7 +56,6 @@ > imprecise.c \ > k_cos.c k_cosf.c k_exp.c k_expf.c k_rem_pio2.c k_sin.c k_sinf.c \ > k_tan.c k_tanf.c \ > - polevll.c \ > s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_carg.c s_cargf.c > s_cargl.c \ > s_cbrt.c s_cbrtf.c s_ceil.c s_ceilf.c s_clog.c s_clogf.c \ > s_copysign.c s_copysignf.c s_cos.c s_cosf.c \ > Index: ld80/e_powl.c > =================================================================== > --- ld80/e_powl.c (revision 336304) > +++ ld80/e_powl.c (working copy) > @@ -77,6 +77,7 @@ > #include > > #include "math_private.h" > +#include "polevll.c" > > /* Table size */ > #define NXT 32 > Index: src/math_private.h > =================================================================== > --- src/math_private.h (revision 336304) > +++ src/math_private.h (working copy) > @@ -828,7 +828,4 @@ > long double __kernel_cosl(long double, long double); > long double __kernel_tanl(long double, long double, int); > > -long double __p1evll(long double, void *, int); > -long double __polevll(long double, void *, int); > - > #endif /* !_MATH_PRIVATE_H_ */ > Index: src/polevll.c > =================================================================== > --- src/polevll.c (revision 336304) > +++ src/polevll.c (working copy) > @@ -69,7 +69,7 @@ > * Polynomial evaluator: > * P[0] x^n + P[1] x^(n-1) + ... + P[n] > */ > -long double > +static inline long double > __polevll(long double x, void *PP, int n) > { > long double y; > @@ -88,7 +88,7 @@ > * Polynomial evaluator: > * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n] > */ > -long double > +static inline long double > __p1evll(long double x, void *PP, int n) > { > long double y; > Index: src/s_cpow.c > =================================================================== > --- src/s_cpow.c (revision 336304) > +++ src/s_cpow.c (working copy) > @@ -60,7 +60,7 @@ > y = cimag (z); > absa = cabs (a); > if (absa == 0.0) { > - return (0.0 + 0.0 * I); > + return (CMPLX(0.0, 0.0)); > } > arga = carg (a); > r = pow (absa, x); > @@ -69,6 +69,6 @@ > r = r * exp (-y * arga); > theta = theta + y * log (absa); > } > - w = r * cos (theta) + (r * sin (theta)) * I; > + w = CMPLX(r * cos (theta), r * sin (theta)); > return (w); > } > Index: src/s_cpowf.c > =================================================================== > --- src/s_cpowf.c (revision 336304) > +++ src/s_cpowf.c (working copy) > @@ -59,7 +59,7 @@ > y = cimagf(z); > absa = cabsf (a); > if (absa == 0.0f) { > - return (0.0f + 0.0f * I); > + return (CMPLXF(0.0f, 0.0f)); > } > arga = cargf (a); > r = powf (absa, x); > @@ -68,6 +68,6 @@ > r = r * expf (-y * arga); > theta = theta + y * logf (absa); > } > - w = r * cosf (theta) + (r * sinf (theta)) * I; > + w = CMPLXF(r * cosf (theta), r * sinf (theta)); > return (w); > } > Index: src/s_cpowl.c > =================================================================== > --- src/s_cpowl.c (revision 336304) > +++ src/s_cpowl.c (working copy) > @@ -59,7 +59,7 @@ > y = cimagl(z); > absa = cabsl(a); > if (absa == 0.0L) { > - return (0.0L + 0.0L * I); > + return (CMPLXL(0.0L, 0.0L)); > } > arga = cargl(a); > r = powl(absa, x); > @@ -68,6 +68,6 @@ > r = r * expl(-y * arga); > theta = theta + y * logl(absa); > } > - w = r * cosl(theta) + (r * sinl(theta)) * I; > + w = CMPLXL(r * cosl(theta), r * sinl(theta)); > return (w); > } > > -- > Steve > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >