From patchwork Sat Dec 17 06:57:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 706651 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 3tgdLT5WnKz9t2D for ; Sat, 17 Dec 2016 17:58:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="dwNCLSmn"; 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=soJIavcUgzuXts7VQ4kTjnPIZ1sV76m /pU6qMV3Yw+rMqAytWT1REsmmQQ5C1vjllB5wvoDaebDdyX85WlP7J+qRg2OPOjA dC7N7/0hXWFJ+RkDow8QLKIlkikAHdyUUzofW7fk/Jd/DFMrYnKZs0K4asV6Wnjs nmFrIawpHUkk= 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=dwNCL Smn0wJpaJOhH3hrV+8eyjXzfWcrSPQlLOjvUWWp5VjN7QC+uKAmWb8f4gEYL00P1 xeWza/EGLyqFci86uUXcb4sxmFN5FdwT0GHT7+sjf/37JQ9dfd8RWfdmo9D0eHk4 N9ONxAPIL5eD0/dHksngqNGb5s+pYA7Zfwxz5U= Received: (qmail 93174 invoked by alias); 17 Dec 2016 06:57:53 -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 92924 invoked by uid 89); 17 Dec 2016 06:57:51 -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=MERGE, shr X-HELO: mail-pg0-f68.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=Lw1tuLlvnz9IXCsbKoIMM9rslUFBH2hYEi40LTKhj3SiHBik5gOr84fVsq3C1l5vUn uPuEjEc2q5P6xfCgeO1shcoakpMI96bJrQhcGBGkoCtIeEE9AJ2i4arRk0QJpLpOr0xc IYMq6ntc6Dl6Q6jLN7C7DJf9gShgijMhv6ET9MSwKj4G9TH50BYE1A/jinjGGRMZhQG4 5S4qJtjjl+mOkvPT0r8rRwlCRkkD5mEWTK36TY96tVTNojsSTxDVkhCsZQhrbKwtjBeZ jUuQmONvI/3JcrR7XBIFv2LE05PZq7/HxACdzvZnJlGtj4VGkdRaVKGE8d/+G2N9n3KI 0b+A== X-Gm-Message-State: AKaTC0260a+pOEeSLOkINjkaBgsSZhv8u42Bra9cwZVqdoV1r3ap/2t/NK7i6nznRflrQA== X-Received: by 10.84.173.195 with SMTP id p61mr14974674plb.68.1481957865999; Fri, 16 Dec 2016 22:57:45 -0800 (PST) From: Richard Henderson To: libc-alpha@sourceware.org Subject: [PATCH 09/11] hppa: Add memcopy.h Date: Fri, 16 Dec 2016 22:57:27 -0800 Message-Id: <20161217065729.28561-10-rth@twiddle.net> In-Reply-To: <20161217065729.28561-1-rth@twiddle.net> References: <20161217065729.28561-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; +}