From patchwork Thu Jan 5 00:03:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 62713 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 195D5385840D for ; Thu, 5 Jan 2023 00:04:03 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id A7D513858D35 for ; Thu, 5 Jan 2023 00:03:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7D513858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.96,301,1665475200"; d="scan'208";a="92928689" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 04 Jan 2023 16:03:47 -0800 IronPort-SDR: 2VlmDH+3lmq+h5c+OPUoR4kKV05B0t/fujEhPRBJmrWWHt7teCdd9eT3pj+f3vF1JOkQk3Ygro Feq66juPCypRsMFe7aEz4fPI9/5HegqbYJHB9pHlY/5U2jKl5ZsdxUI67pP3qh+MAA8wiw6M78 lwqqwRkWUPIwlVRO0T9h6E3T4eSuOtECNpwXOko1OglOz63EnQVtlr404zX0agqYwJ9LM6UAJr 05D36sTvwB4aPtslg2fEGu0p9efRvHn2JAMt1Xr2h5ftVMhwRVRbZPUkCHo42FZG+BrPQcyedm 3uE= Date: Thu, 5 Jan 2023 00:03:42 +0000 From: Joseph Myers To: Subject: [committed] Fix ldbl-128 built-in function use Message-ID: MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3115.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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" Fix the following issues with built-in function use in sysdeps/ieee754/ldbl-128 and sysdeps/ieee754/float128: * fabsl used __builtin_fabsf128 unconditionally, breaking the build with GCC 6 for several architectures; it should use __builtin_fabsl with an appropriate redirection in float128_private.h. (I'm not particularly concerned with building glibc with GCC 6; rather, I want to be able to run the tgmath.h tests with GCC 6, which is a significantly different case for tgmath.h compared to GCC 7 and later because of the lack of _FloatN / _FloatNx support in the compiler, and at present running the tests with a compiler means building glibc with that compiler.) * Some (conditional) uses of built-in functions had been added to ldbl-128 without appropriate float128_private.h remapping (there was remapping for the macros controlling whether the built-in functions are used, just not for the functions themselves). * s_llrintl.c called __builtin_round not __builtin_llrintl, which is obviously wrong. Tested with build-many-glibcs.py for aarch64-linux-gnu, GCC 6 (where it fixes the glibc build) and GCC 12, and with the glibc testsuite for x86_64. diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h index 78107b1525..b786488389 100644 --- a/sysdeps/ieee754/float128/float128_private.h +++ b/sysdeps/ieee754/float128/float128_private.h @@ -406,7 +406,11 @@ #define __builtin_ceill __builtin_ceilf128 #define __builtin_truncl __builtin_truncf128 #define __builtin_roundl __builtin_roundf128 +#define __builtin_roundevenl __builtin_roundevenf128 +#define __builtin_lrintl __builtin_lrintf128 +#define __builtin_llrintl __builtin_llrintf128 #define __builtin_copysignl __builtin_copysignf128 +#define __builtin_fabsl __builtin_fabsf128 /* Get the constant suffix from bits/floatn-compat.h. */ #define L(x) __f128 (x) diff --git a/sysdeps/ieee754/ldbl-128/s_fabsl.c b/sysdeps/ieee754/ldbl-128/s_fabsl.c index f22515fec6..2e5ea3f413 100644 --- a/sysdeps/ieee754/ldbl-128/s_fabsl.c +++ b/sysdeps/ieee754/ldbl-128/s_fabsl.c @@ -27,6 +27,6 @@ static char rcsid[] = "$NetBSD: $"; _Float128 __fabsl (_Float128 x) { - return __builtin_fabsf128 (x); + return __builtin_fabsl (x); } libm_alias_ldouble (__fabs, fabs) diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c index 3a5635d509..22e6e5f812 100644 --- a/sysdeps/ieee754/ldbl-128/s_llrintl.c +++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c @@ -31,7 +31,7 @@ long long int __llrintl (_Float128 x) { #if USE_LLRINTL_BUILTIN - return __builtin_round (x); + return __builtin_llrintl (x); #else /* Use generic implementation. */ static const _Float128 two112[2] =