From patchwork Fri Jun 7 01:23:19 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: 1111540 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-102516-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="HiY5gwJA"; 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 45KlCp1wDrz9s7h for ; Fri, 7 Jun 2019 11:23:33 +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=tVB1snXC4M7XNCt0IPKkDIlaXAeriieAuT3h1uANrbOtv6pUPum6i qSlFfjggk+S8SVNstPGXug2UiGg87Mq/CdVI1JaFhobUYpQn6cRWm9yW+lA2k/j2 OGpZdSw/C12+Y4cJNbMBUOB+nwiNWalITtosi4mRkceeW+AEb2SGuQ= 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=sD6ojg06ZHcBuDURarw6b+hdqA8=; b=HiY5gwJA3b4S1zFo3QVSWSvU25an MhTXphHvqgwZ9uSElEnYn8+/RCzT4Chmm/LHtoPqYfxXetPwVd7FjFL5RN+OlW1y +Gk/zTeHm7YzGCYskeVHU3OtyX7FJYj7ckH+wQnMslfcruaATVdKU+Y2UmVJkPTE r/s9e8JwOMMUbdY= Received: (qmail 128826 invoked by alias); 7 Jun 2019 01:23:28 -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 128818 invoked by uid 89); 7 Jun 2019 01:23:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=H*MI:2079 X-HELO: mx0a-001b2d01.pphosted.com From: "Paul A. Clarke" To: libc-alpha@sourceware.org Cc: tuliom@ascii.art.br Subject: [PATCH] [powerpc] fegetmode: utilize faster method to get rounding mode Date: Thu, 6 Jun 2019 20:23:19 -0500 x-cbid: 19060701-8235-0000-0000-00000EA4C212 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011225; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01214305; UDB=6.00638298; IPR=6.00995385; MB=3.00027213; MTD=3.00000008; XFM=3.00000015; UTC=2019-06-07 01:23:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19060701-8236-0000-0000-000045E736A9 Message-Id: <1559870599-2079-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/fpu/fenv_libc.h (fegetenv_status): New. * sysdeps/powerpc/fpu/fegetmode.c (fegetmode): Use fegetenv_status() instead of fegetenv_register(). --- sysdeps/powerpc/fpu/fegetmode.c | 2 +- sysdeps/powerpc/fpu/fenv_libc.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sysdeps/powerpc/fpu/fegetmode.c b/sysdeps/powerpc/fpu/fegetmode.c index f43ab60..466f5b7 100644 --- a/sysdeps/powerpc/fpu/fegetmode.c +++ b/sysdeps/powerpc/fpu/fegetmode.c @@ -21,6 +21,6 @@ int fegetmode (femode_t *modep) { - *modep = fegetenv_register (); + *modep = fegetenv_status (); return 0; } diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h index f8dd1b7..64f7398 100644 --- a/sysdeps/powerpc/fpu/fenv_libc.h +++ b/sysdeps/powerpc/fpu/fenv_libc.h @@ -34,6 +34,18 @@ extern const fenv_t *__fe_mask_env (void) attribute_hidden; pointer. */ #define fegetenv_register() __builtin_mffs() +/* Equivalent to fegetenv_register, but only returns bits for + status, exception enables, and mode. */ +#ifdef _ARCH_PWR9 +#define fegetenv_status() \ + ({register double __fr; \ + __asm__ ("mffsl %0" : "=f" (__fr)); \ + __fr; \ + }) +#else +#define fegetenv_status() fegetenv_register() +#endif + /* Equivalent to fesetenv, but takes a fenv_t instead of a pointer. */ #define fesetenv_register(env) \ do { \