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: 708003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3tkVhR3ZvQz9snm for ; Thu, 22 Dec 2016 10:08:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="fFOjpAV5"; dkim-atps=neutral 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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=ODirYZ+lNCOaPGpbaNp72tQr8cvgmsg hgJysC4DJtjErHxyqxQpOZHQSlRuSLGoTSCx4WBQwpF68dJ67wwY2LGwssW6mr72 DTuVN+qeZSpXfx7QgMLS75sNVEMeX+bXWnTPeLC4iXPY2hZ8SUk+SUB9w8aw6c6u M7KNR6/tCfBQ= 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:subject:date:message-id:in-reply-to :references; s=default; bh=PEidnLfdqhGkcqH9+JWgSGDWAdI=; b=fFOjp AV57UKPscIB0Y401gTOIgfee/TjHNwkKySvzYrWwyWxr0QG4IuVdRkeHgUQPqFG5 5PHPLTeE28wiJVMYt01N0OqgV1MEOMcq9gi+zlAU8fmz0603XP1kryA77XTFRDXh RytgQdX2qMN0/p3qKzaaUaxkUykfweAcqGNL+c= 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; +}