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: 25320 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-Google-Smtp-Source: ACJfBouh+ewKR0NhMvFxhRybbjWpLRIaTeR1IwyIcQJNKSZ0XHuuDz6MTrATOz6DxzLTmjzNUR2Gxw== 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 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; +}