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: 1111408 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-102504-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="eKz9TiBF"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45KbCJ4sTzz9s4Y for ; Fri, 7 Jun 2019 05:22:36 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=EflOEKZgt9n4fATdTVSjqbOvl5ZuTdLXK06Yul4GqaBdltiYJKtRd 0L93ugOltzAf3EFSn2LyyNcySks219+kF5afXztQtbqs63M1eazIt9QxzZbgK8pX ZUNlrbx2hTOpyPekaTsaErb7QhI2te+fHou3mxP92px4QpuTqCMm7M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=K3ogWzpWIQCcoKbIFzNQWvqij3I=; b=eKz9TiBFnJ127IprmoyeWqRUurC6 3xfDieWsOilQxVNJulsaxFW4j2/RZDVkj+TVe9RdhpngYnYG9WjbcgLhRnT6+fb+ oYMSoWOKQO995h00IyPGUFnVB1IHTEiGL8+1DshN+Vr94uaSa+hQ23WAtM65PD6+ uYqkfbf4f4qKVtQ= 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