From patchwork Mon Mar 9 18:32:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 38522 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by sourceware.org (Postfix) with ESMTPS id DD64E3877031 for ; Mon, 9 Mar 2020 18:32:41 +0000 (GMT) Received: by mail-qv1-xf43.google.com with SMTP id c28so1389357qvb.10 for ; Mon, 09 Mar 2020 11:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=l0D0i05zXtZZ6CpI4m1UU9fNh8iVVQv67P2B8kuBZiQ=; b=tFYETSDMV92Rte771EaSduiozPzoHa6CfG0oxHrtGq4M3SvHTAdTKouHICOFFwJ2g5 boEFjjBXcTpH/1I0+HVty85PMb/wT9WgCDfnpSxDs5k0hSMdlm8mZQUJzaZ3q6XLSDcp Arab/FBgtfhvs95TMPLVY7caD2IsnCTQRlAm6C3+ZXdRNDFQsoslDnhDdq6iE6My/IZ8 taL3K4bIJxp5LObTyBi7cSTQX+pqovwylgGZ1MHuOCzU6+151zf/HHGbCmD62DOcyD9I OBMdxC5D1yEvGeVKJe8e5tmEZTS+JiyUJQjqd5Wb+4XepEW+SdEpWpMspe6dn/ZqaaGF rw2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=l0D0i05zXtZZ6CpI4m1UU9fNh8iVVQv67P2B8kuBZiQ=; b=l/ei4Nhi2FI/qqosmUcECw0bAz4uByH86fIzTlOmGKyJPLtdkiCtof70+B2Wk56Iuv bLm5kz6EFMkyFmrZDiwdAiX5fcKiVjuhS+Kw6sbd7MlX9qiboV6bGYqV0BekCdC/qfgD 9Y7eqvErDsffJdi2PDB1F5Znj2xwvTNbN7cmosePFj8ZkPE8c4JsXk6ncI9GSaDwXz4c DgJ7EVz8/UYGui1BvhnVkTIRZeW2OSA0oV/Spqx+h/0jV3GyYnizfegQjM73y1xCNy1K kA4vGcjkp2nZ4Ke2lmuHsPC8nDM52LmUPeVTGYc9emgkkK5c/sL0afEnzuymumMtwegh nVdg== X-Gm-Message-State: ANhLgQ2BNV2ytDvRhdKLmyddzhWxbMN0bUtn2Aw+wRgHhCWLd4hnCUiX B/f5ftTpzMzTREMT1W+Ub4guWSDuOEY= X-Google-Smtp-Source: ADFU+vvMaHuVhuitkQvLDQxqJcaty7xyAd4G66XmVUE8H4dGoOADOJ2nshk9RsXDKqAJgg2HgXsqmQ== X-Received: by 2002:a0c:fde7:: with SMTP id m7mr15691449qvu.53.1583778761138; Mon, 09 Mar 2020 11:32:41 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e7sm13922960qtp.0.2020.03.09.11.32.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 11:32:40 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/3] x86: Remove feraiseexcept optimization Date: Mon, 9 Mar 2020 15:32:33 -0300 Message-Id: <20200309183234.11891-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309183234.11891-1-adhemerval.zanella@linaro.org> References: <20200309183234.11891-1-adhemerval.zanella@linaro.org> X-Spam-Status: No, score=-27.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-List-Received-Date: Mon, 09 Mar 2020 18:32:42 -0000 Similar to fenvinline.h removal, this kind of optimization is better implemented by the compiler. Also newer code avoid setting exceptions directly (for instance the code to make new logf, log2f and powf implementatation to now support SVID compat). Checked on x86_64-linux-gnu and i686-linux-gnu. --- sysdeps/x86/fpu/bits/fenv.h | 54 --------------------------- sysdeps/x86/fpu/include/bits/fenv.h | 57 ----------------------------- 2 files changed, 111 deletions(-) delete mode 100644 sysdeps/x86/fpu/include/bits/fenv.h diff --git a/sysdeps/x86/fpu/bits/fenv.h b/sysdeps/x86/fpu/bits/fenv.h index eb78eb4b2d..6cfa5678eb 100644 --- a/sysdeps/x86/fpu/bits/fenv.h +++ b/sysdeps/x86/fpu/bits/fenv.h @@ -114,57 +114,3 @@ femode_t; /* Default floating-point control modes. */ # define FE_DFL_MODE ((const femode_t *) -1L) #endif - - -#ifdef __USE_EXTERN_INLINES -__BEGIN_DECLS - -/* Optimized versions. */ -#ifndef _LIBC -extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept); -#endif -__extern_always_inline void -__NTH (__feraiseexcept_invalid_divbyzero (int __excepts)) -{ - if ((FE_INVALID & __excepts) != 0) - { - /* One example of an invalid operation is 0.0 / 0.0. */ - float __f = 0.0; - -# ifdef __SSE_MATH__ - __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f)); -# else - __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait" - : "=t" (__f) : "0" (__f)); -# endif - (void) &__f; - } - if ((FE_DIVBYZERO & __excepts) != 0) - { - float __f = 1.0; - float __g = 0.0; - -# ifdef __SSE_MATH__ - __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g)); -# else - __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait" - : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)"); -# endif - (void) &__f; - } -} -__extern_inline int -__NTH (feraiseexcept (int __excepts)) -{ - if (__builtin_constant_p (__excepts) - && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0) - { - __feraiseexcept_invalid_divbyzero (__excepts); - return 0; - } - - return __feraiseexcept_renamed (__excepts); -} - -__END_DECLS -#endif diff --git a/sysdeps/x86/fpu/include/bits/fenv.h b/sysdeps/x86/fpu/include/bits/fenv.h deleted file mode 100644 index dd3f61e9f3..0000000000 --- a/sysdeps/x86/fpu/include/bits/fenv.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Wrapper for x86 bits/fenv.h for use when building glibc. - Copyright (C) 1997-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_FENV_H - -#if defined _LIBC && defined __USE_EXTERN_INLINES -# if defined SHARED && !defined NO_HIDDEN && IS_IN (libm) -extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), __GI_feraiseexcept); -# else -extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept); -# endif -#endif - -#include_next - -# ifndef _ISOMAC - -/* Ensure __feraiseexcept calls in glibc are optimized the same as - feraiseexcept calls. */ - -#ifdef __USE_EXTERN_INLINES -__BEGIN_DECLS - -extern int __REDIRECT_NTH (____feraiseexcept_renamed, (int), __feraiseexcept); -__extern_inline int -__NTH (__feraiseexcept (int __excepts)) -{ - if (__builtin_constant_p (__excepts) - && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0) - { - __feraiseexcept_invalid_divbyzero (__excepts); - return 0; - } - - return ____feraiseexcept_renamed (__excepts); -} - -__END_DECLS -#endif - -# endif /* _ISOMAC */ -#endif /* bits/fenv.h */