From patchwork Wed Jan 10 12:47:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 124089 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5236321qgn; Wed, 10 Jan 2018 04:50:46 -0800 (PST) X-Google-Smtp-Source: ACJfBovdZpV4OU+zIoQU0f9rzjPsi440+3RB8vc93m6wFCF/FhQeSq+BDiIHraylFezljbLoTN8s X-Received: by 10.101.81.7 with SMTP id f7mr14998331pgq.443.1515588646188; Wed, 10 Jan 2018 04:50:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515588646; cv=none; d=google.com; s=arc-20160816; b=lZR4XqhF4iOKdOcUkJfD1sz4SKsXOK8lSbR8B3YKK5vOT0kShmCRIbgX0DPkHSLbMh rQyvVr1w1CKfy9vFlaQOHA51zaqAr7rVhS+AjNvVnI2dxGN1CRMV0Z7JezuxtXYhQ0S1 FEQo4SiNmUwl+dYmzAhFKTiYwpwU9V1oiyBebEKT0C8mtoRz39eS7BHmakzellNDxTXF utlfaz7NalGKzBStdpl5Miz+66DRfr45TGAXy+/3biP0kFxUhmWt1TxAm9AxYUCpE596 iNN0b0D7jSvS43CSG8fclAAOH3e3R7585hUABL0R3GKeDb0P5a0oK7OoxjYKKBshUs5X 3ZDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :delivered-to:sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=Qh/zwzbekk5kEdipaQYNSHOoe6wV0qMGmahUD5xjepE=; b=pFZ21gLZgRtCp0eRE5P414dK48qsHndMXV0M2ePHsD7okL87YiIpdiM3wSUKWTPUqc khMelZHNO9sTvAEN/3P10qmnOrkSfOoRHyDpONMQo4DS9dF+YuyXexfpmlvJYkrQCIay rC7z8KUrJ9M4YN6VphuHLj5yoGZypAZ6ynvBtY8gwkN2Sxe2E9v1tgpLaIT5bKI6K9/6 zRBTO6vd5OcKw/vpywPPddo+B5BEJDMdItu+0xWWy5Dp53O4E58NhYlM81ayA4FFNzrF Q5CU9B9T1FKOczOrtf3qK5NxnJ+pTH+x60/OZ53tOcn69QOsOGA2gs9F6tc9moWookfZ yWxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=B3o5a/3S; spf=pass (google.com: domain of libc-alpha-return-89011-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-89011-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id l13si10622717pgc.833.2018.01.10.04.50.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 04:50:46 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-89011-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=B3o5a/3S; spf=pass (google.com: domain of libc-alpha-return-89011-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-89011-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:in-reply-to :references; q=dns; s=default; b=tDl3bcoMdhCMvxWlKDON5QBu6421KQH EmBMKOga6mhadViQoEzknTLkxTwUxPkLmM1V9D2mgNrHOZpgpOl+v7JibG+Oy1SJ IfZQGIGHxoGxZrS/YM22AgRJ42ONagd7bm3yjsWUGae/+712BYxZF4jfY3SKnLxh A6mFMpoCFj2w= 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:in-reply-to :references; s=default; bh=nkQThLnYRedLbtw3x7QSRlj0q3c=; b=B3o5a /3SaJcgySmOKR6r/As+pF8gIsMkkL+CnbRLBkKOXx/1TDuE2/jXA1dJ8P1XUsoNJ YAbsnT4+5Pg1/XCFnbsdpaQoSR+a8NLG63BNlFKnhpAHLwx39FHOKFlFVprFK93l 3GibnIM//tT7uZMlDSPwtBuWuyN54tOyUTty7U= Received: (qmail 130633 invoked by alias); 10 Jan 2018 12:48:44 -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 125343 invoked by uid 89); 10 Jan 2018 12:48:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f196.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Qh/zwzbekk5kEdipaQYNSHOoe6wV0qMGmahUD5xjepE=; b=Bgfw3H1cjQdlzcwT8eujrQtOPbUln5B8YIq9FIJ7TIoXSRYWP6J3RyHk3iLbNMTjYc Q4nxdoxFfEPt966NU6QoaOEPj5LW14SvPqnX3bd5WvXZowx0ZLJaWJrRDvYIUClXF9S/ cygvyliM0b/m+NbWeWwoCBMTcuPotQFnSstpcsMBhaqB96mtE1Y4F4YGGb5Pt/wtzzv1 aGMXCsmeRVe5XtAVydBcGDNA0RvOLiQqi+VEzVQa72hiK+VbgC+NgaBqB0Awnuz4TOF4 d/NLhWpyaMQ5Gk7EpInBRhQAZBeJdLVeILIoCztQnD9KeA4rOh27izuKRuvn7bz3YwUj lD5w== X-Gm-Message-State: AKwxytcS2yYzff7f8mUXQ+1ZESlxl1V4/Fgg4+NQ3GotImsttjp6DHP8 pSpsiW4rc3rKLpnl++0bZgwoFvsPb6E= X-Received: by 10.200.39.244 with SMTP id x49mr25880823qtx.169.1515588509206; Wed, 10 Jan 2018 04:48:29 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Richard Henderson Subject: [PATCH v3 13/18] hppa: Add memcopy.h Date: Wed, 10 Jan 2018 10:47:57 -0200 Message-Id: <1515588482-15744-14-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1515588482-15744-1-git-send-email-adhemerval.zanella@linaro.org> References: <1515588482-15744-1-git-send-email-adhemerval.zanella@linaro.org> From: Richard Henderson GCC's combine pass cannot merge (x >> c | y << (32 - c)) into a double-word shift unless (1) the subtract is in the same basic block and (2) the result of the subtract is used exactly once. Neither condition is true for any use of MERGE. By forcing the use of a double-word shift, we not only reduce contention on SAR, but also allow the setting of SAR to be hoisted outside of a loop. Checked on hppa-linux-gnu. Richard Henderson * sysdeps/hppa/memcopy.h: New file. --- sysdeps/hppa/memcopy.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 sysdeps/hppa/memcopy.h -- 2.7.4 diff --git a/sysdeps/hppa/memcopy.h b/sysdeps/hppa/memcopy.h new file mode 100644 index 0000000..4dcade7 --- /dev/null +++ b/sysdeps/hppa/memcopy.h @@ -0,0 +1,44 @@ +/* Definitions for memory copy functions, PA-RISC version. + Copyright (C) 2018 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 + . */ + +#include + +/* Use a single double-word shift instead of two shifts and an ior. + If the uses of MERGE were close to the computation of shl/shr, + the compiler might have been able to create this itself. + But instead that computation is well separated. + + Using an inline function instead of a macro is the easiest way + to ensure that the types are correct. */ + +#undef MERGE + +extern void link_error(void); + +static inline op_t +MERGE(op_t w0, int shl, op_t w1, int shr) +{ + op_t res; + if (OPSIZ == 4) + asm("shrpw %1,%2,%%sar,%0" : "=r"(res) : "r"(w0), "r"(w1), "q"(shr)); + else if (OPSIZ == 8) + asm("shrpd %1,%2,%%sar,%0" : "=r"(res) : "r"(w0), "r"(w1), "q"(shr)); + else + link_error(), res = 0; + return res; +}