From patchwork Wed Dec 21 23:06:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 18632 Received: (qmail 53072 invoked by alias); 21 Dec 2016 23:06:36 -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 52463 invoked by uid 89); 21 Dec 2016 23:06:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=sar, SAR X-HELO: mail-pg0-f66.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=wDayb/Nmqq3At7JCXP05ND9yGLfsb042REZKmNff51k=; b=Z+OO3Z090j1WgY/FiuQB2ZHXAyxRKPF3Y/qSaufdpMaPEaybwENSlUC4ZAlCRG+tsL lUwXw8QSaRYL14kdbTIYbcY3QeigNl33NwLp/hO+Zfh6HW2DDtsFI27SQ80v7n1WsyMB JFTeS4TNqCtWpdTaolFDv84SnB5T+o4ANG6PBjt1ySPzd8xam3ReMqZb3Z8CHzMNfTwD adLUbFZrVPEiQOB0vLF3slDZ4eQUX/wwAN49w2bMRVBhqQ/FzTRypBEBPzbxpQ4G48P6 a1/5aYyWudFKvjayv39a4BtPRym5pdhtuwVIxYaQVmQTt0XCDZ1/bb0VHcrFLFmRtj2q 09yw== X-Gm-Message-State: AIkVDXLKvo8UT5vy9hMq3wZSme5XS9y8kxIuZumPxz7m9IrKXPr316zshDJnsvV/DExS9g== X-Received: by 10.98.50.67 with SMTP id y64mr6112250pfy.98.1482361576873; Wed, 21 Dec 2016 15:06:16 -0800 (PST) From: Richard Henderson To: libc-alpha@sourceware.org Subject: [PATCH v2 11/16] hppa: Add memcopy.h Date: Wed, 21 Dec 2016 15:06:00 -0800 Message-Id: <20161221230605.28638-12-rth@twiddle.net> In-Reply-To: <20161221230605.28638-1-rth@twiddle.net> References: <20161221230605.28638-1-rth@twiddle.net> 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. * 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..4076b8b --- /dev/null +++ b/sysdeps/hppa/memcopy.h @@ -0,0 +1,44 @@ +/* memcopy.h -- definitions for memory copy functions, PA-RISC version. + Copyright (C) 2016 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; +}