From patchwork Wed Mar 25 10:06:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 38612 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id C37CF3942012 for ; Wed, 25 Mar 2020 10:06:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C37CF3942012 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02PA4HxP091552 for ; Wed, 25 Mar 2020 06:06:49 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywdr75e5s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Mar 2020 06:06:49 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Mar 2020 10:06:44 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 25 Mar 2020 10:06:43 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02PA6g2044630220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Mar 2020 10:06:42 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 493F1A4057; Wed, 25 Mar 2020 10:06:42 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 271F9A404D; Wed, 25 Mar 2020 10:06:42 +0000 (GMT) Received: from m35lp38.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 25 Mar 2020 10:06:42 +0000 (GMT) From: Stefan Liebler To: libc-alpha@sourceware.org Cc: Stefan Liebler Subject: [PATCH 1/4] Use libc_fe* macros in ldbl-128/s_nearbyintl.c. Date: Wed, 25 Mar 2020 11:06:25 +0100 X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20032510-0028-0000-0000-000003EB1EE2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032510-0029-0000-0000-000024B08BB4 Message-Id: <20200325100628.883397-1-stli@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-25_01:2020-03-23, 2020-03-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=1 mlxlogscore=324 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003250082 X-Spam-Status: No, score=-29.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP 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: Wed, 25 Mar 2020 10:06:51 -0000 The calls to feholdexcept and fesetenv are replaced by the libc_fe* macros as it is also done in nearbyintf and nearbyint. --- sysdeps/ieee754/float128/float128_private.h | 10 ++++++++++ sysdeps/ieee754/ldbl-128/s_nearbyintl.c | 9 +++++---- sysdeps/x86/fpu/fenv_private.h | 4 ++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h index f97463d9dc..af1ed8f3c0 100644 --- a/sysdeps/ieee754/float128/float128_private.h +++ b/sysdeps/ieee754/float128/float128_private.h @@ -66,6 +66,16 @@ # define libc_feupdateenv_testl(ENV, EX) libc_feupdateenv_testf128 (ENV, EX) #endif +#ifdef libc_feholdexceptf128 +# undef libc_feholdexceptl +# define libc_feholdexceptl(ENV) libc_feholdexceptf128 (ENV) +#endif + +#ifdef libc_fesetenvf128 +# undef libc_fesetenvl +# define libc_fesetenvl(ENV) libc_fesetenvf128 (ENV) +#endif + /* misc macros from the header below. */ #include #undef FIX_LDBL_LONG_CONVERT_OVERFLOW diff --git a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c index 8d26786f78..c0bc6fbd6d 100644 --- a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c +++ b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -53,11 +54,11 @@ __nearbyintl (_Float128 x) { if (j0 < 0) { - feholdexcept (&env); + libc_feholdexceptl (&env); w = TWO112[sx] + math_opt_barrier (x); t = w - TWO112[sx]; math_force_eval (t); - fesetenv (&env); + libc_fesetenvl (&env); GET_LDOUBLE_MSW64 (i0, t); SET_LDOUBLE_MSW64 (t, (i0 & 0x7fffffffffffffffLL) | (sx << 63)); return t; @@ -70,11 +71,11 @@ __nearbyintl (_Float128 x) else return x; /* x is integral */ } - feholdexcept (&env); + libc_feholdexceptl (&env); w = TWO112[sx] + math_opt_barrier (x); t = w - TWO112[sx]; math_force_eval (t); - fesetenv (&env); + libc_fesetenvl (&env); return t; #endif /* ! USE_NEARBYINTL_BUILTIN */ } diff --git a/sysdeps/x86/fpu/fenv_private.h b/sysdeps/x86/fpu/fenv_private.h index 4b081e015b..23a430362a 100644 --- a/sysdeps/x86/fpu/fenv_private.h +++ b/sysdeps/x86/fpu/fenv_private.h @@ -300,12 +300,16 @@ libc_feresetround_387 (fenv_t *e) SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_sse, libc_feresetround_sse) # define libc_feholdexcept_setroundf128 libc_feholdexcept_setround_sse # define libc_feupdateenv_testf128 libc_feupdateenv_test_sse +# define libc_feholdexceptf128 libc_feholdexcept_sse +# define libc_fesetenvf128 libc_fesetenv_sse #else /* The 387 rounding mode is used by soft-fp for 32-bit, but whether 387 or SSE exceptions are used depends on whether libgcc was built for SSE math, which is not known when glibc is being built. */ # define libc_feholdexcept_setroundf128 default_libc_feholdexcept_setround # define libc_feupdateenv_testf128 default_libc_feupdateenv_test +# define libc_feholdexceptf128 default_libc_feholdexcept +# define libc_fesetenvf128 default_libc_fesetenv #endif /* We have support for rounding mode context. */