From patchwork Thu Jun 6 19:22:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul A. Clarke" X-Patchwork-Id: 33042 Received: (qmail 5238 invoked by alias); 6 Jun 2019 19:22:31 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 5137 invoked by uid 89); 6 Jun 2019 19:22:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: "Paul A. Clarke" To: libc-alpha@sourceware.org Cc: tuliom@ascii.art.br Subject: [PATCH] [powerpc] fegetround: utilize faster method to get rounding mode Date: Thu, 6 Jun 2019 14:22:23 -0500 Message-Id: <1559848943-9717-1-git-send-email-pc@us.ibm.com> From: "Paul A. Clarke" Add support to use 'mffsl' instruction if compiled for POWER9 (or later). 2019-06-06 Paul A. Clarke * sysdeps/powerpc/bits/fenvinline.h (__fegetround): Add new implementation for _ARCH_PWR9. --- sysdeps/powerpc/bits/fenvinline.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sysdeps/powerpc/bits/fenvinline.h b/sysdeps/powerpc/bits/fenvinline.h index 7079d1a..ba23da1 100644 --- a/sysdeps/powerpc/bits/fenvinline.h +++ b/sysdeps/powerpc/bits/fenvinline.h @@ -19,12 +19,21 @@ #if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__ /* Inline definition for fegetround. */ +#ifdef _ARCH_PWR9 +# define __fegetround() \ + __extension__ ({ \ + union { double __d; unsigned long long __ll; } __u; \ + __asm__ ("mffsl %0" : "=f" (__u.__d)); \ + __u.__ll & 0x0000000000000003LL; \ + }) +#else # define __fegetround() \ (__extension__ ({ int __fegetround_result; \ __asm__ __volatile__ \ ("mcrfs 7,7 ; mfcr %0" \ : "=r"(__fegetround_result) : : "cr7"); \ __fegetround_result & 3; })) +#endif # define fegetround() __fegetround () # ifndef __NO_MATH_INLINES