From patchwork Thu Sep 30 20:41:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 45639 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 06F16385780F for ; Thu, 30 Sep 2021 20:41:43 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id DE6593858C2C for ; Thu, 30 Sep 2021 20:41:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DE6593858C2C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: 4LiHRzSFkKW6jKnWfynR2yNp5g3akaWYiVtUM13ikvoKrXfBjvT58xgz0hJ8tNGQU78Yfc4n4p aEpJFj75Y9t8V26+R+q053WJiCSzmyUhzDj5B+985JmOsD7b3SIOBmm4KJ4aH0PJiNjV+J8pw3 NxsPOsHGzGZrnLU+GwX+flNlU3AyP3njoqa3Kj15admO7EByDI1+T/I/bTzjNWnXhawkTZCDIy 1mJW3ahl3C5sXP4jKxXgvMPBtjG6aJzrG/xOxFAg1cX2Ioy48x+MwKqOHAW6wAwc1EqpY3xxEL b+loMNtOdi4nSXq/YDlASuO+ X-IronPort-AV: E=Sophos;i="5.85,336,1624348800"; d="scan'208";a="66686280" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 30 Sep 2021 12:41:29 -0800 IronPort-SDR: lE7HthVBlRs20NWpV7B5tVufSxvfL+b73qrA/tTSQpPw/QIsCzN5BRNzq2aMHhCa5FN2EYcBFd C7y029dOvd21IGnU+Iy4WrbGMKvhrRYswyoTEEQ5eFF7lE/hYFZdlOuuUyaQJ4Xay5V0xLIVzm 6LHDzeLYJJkPkL0e+jJeB0BH+suXaTcL5ERsUidx9SWSYFAFb58L1aHvLURHAdjzSU85BGTVEB m7x/0NpveBDGCDKg2wczrYdXwPdNFXVF0Zx/TxBfQ6ypOqclVLgRS13ky7zAwf2FWllONQdS+5 /E0= Date: Thu, 30 Sep 2021 20:41:23 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: Add exp10 macro to (bug 26108) [committed] Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3124.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" glibc has had exp10 functions since long before they were standardized; now they are standardized in TS 18661-4 and C2X, they are also specified there to have a corresponding type-generic macro. Add one to , so fixing bug 26108. glibc doesn't have other functions from TS 18661-4 yet, but when added, it will be natural to add the type-generic macro for each function family at the same time as the functions. Tested for x86_64. --- Committed. diff --git a/NEWS b/NEWS index 6bc98873ab..a923bd644d 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,9 @@ Major new features: * The __STDC_IEC_60559_BFP__ and __STDC_IEC_60559_COMPLEX__ macros are predefined as specified in TS 18661-1:2014. +* The exp10 functions in now have a corresponding type-generic + macro in . + Deprecated and removed features, and other changes affecting compatibility: * The r_version update in the debugger interface makes the glibc binary diff --git a/math/Makefile b/math/Makefile index af734d41c4..e19f4ec343 100644 --- a/math/Makefile +++ b/math/Makefile @@ -374,9 +374,9 @@ $(foreach t,$(libm-tests-base),\ tgmath3-narrow-types = f d f16 f32 f64 f128 f32x f64x tgmath3-narrow-macros = $(foreach t,$(tgmath3-narrow-types), \ $(foreach f,$(libm-narrow-fns),$(t)$(f))) -tgmath3-macros = atan2 cbrt ceil copysign erf erfc exp2 expm1 fdim floor \ - fma fmax fmin fmod frexp hypot ilogb ldexp lgamma llrint \ - llround log10 log1p log2 logb lrint lround nearbyint \ +tgmath3-macros = atan2 cbrt ceil copysign erf erfc exp10 exp2 expm1 fdim \ + floor fma fmax fmin fmod frexp hypot ilogb ldexp lgamma \ + llrint llround log10 log1p log2 logb lrint lround nearbyint \ nextafter nexttoward remainder remquo rint round scalbn \ scalbln tgamma trunc acos asin atan acosh asinh atanh cos \ sin tan cosh sinh tanh exp log pow sqrt fabs carg cimag conj \ diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py index d433b484b8..53d5a54767 100755 --- a/math/gen-tgmath-tests.py +++ b/math/gen-tgmath-tests.py @@ -707,6 +707,8 @@ class Tests(object): ('_Float32x', 'f32x'), ('_Float64x', 'f64x')): self.add_tests(prefix + fn, ret, ['r'] * args) + # TS 18661-4 functions. + self.add_tests('exp10', 'r', ['r']) # C2X functions. self.add_tests('fmaximum', 'r', ['r', 'r']) self.add_tests('fmaximum_mag', 'r', ['r', 'r']) diff --git a/math/test-tgmath.c b/math/test-tgmath.c index f9b5fc640f..678a174bca 100644 --- a/math/test-tgmath.c +++ b/math/test-tgmath.c @@ -48,7 +48,7 @@ volatile int count_cdouble; volatile int count_cfloat; volatile int count_cldouble; -#define NCALLS 156 +#define NCALLS 158 #define NCALLS_INT 4 #define NCCALLS 47 @@ -253,6 +253,7 @@ F(compile_test) (void) a = log1p (log1p (x)); b = logb (logb (a)); a = exp2 (exp2 (x)); + a = exp10 (exp10 (x)); b = log2 (log2 (a)); a = pow (pow (x, a), pow (c, b)); b = sqrt (sqrt (a)); @@ -365,6 +366,7 @@ F(compile_test) (void) a = log1p (y); a = logb (y); a = exp2 (y); + a = exp10 (y); a = log2 (y); a = pow (y, y); a = sqrt (y); @@ -615,6 +617,14 @@ TYPE return x; } +TYPE +(F(exp10)) (TYPE x) +{ + ++count; + P (); + return x; +} + TYPE (F(exp2)) (TYPE x) { diff --git a/math/tgmath.h b/math/tgmath.h index e8042833dd..13c7022275 100644 --- a/math/tgmath.h +++ b/math/tgmath.h @@ -785,6 +785,11 @@ /* Compute base-2 logarithm of X. */ #define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2) +#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C2X) +/* Compute exponent to base ten. */ +#define exp10(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp10) +#endif + /* Power functions. */