From patchwork Fri Sep 2 20:39:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 602183 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1790028mae; Fri, 2 Sep 2022 13:41:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR4pB/jRTngBrR1dnVZN5HgrmmrgYlfEG02JqF0fe/RNmhkVPWePnrI0DUjWJ7h3y1Ch+jFy X-Received: by 2002:a17:906:3fc3:b0:750:5e2b:ff1b with SMTP id k3-20020a1709063fc300b007505e2bff1bmr3530993ejj.233.1662151293547; Fri, 02 Sep 2022 13:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662151293; cv=none; d=google.com; s=arc-20160816; b=vOk3fC/LM4N09QBdL4uZMVRk2JwXM0FiIFMtOetdjEixF7VJheVm4f2QC6vTpym/fL frCewnm06zCd68lbkEaQJCdRASwprOajrIeFZo4H3L8d0KjBhL+x6c0kFxIlbQMbWkLj 2voEDvq9zBuiLTEZ2zSaOsciFYZnQWy0JOaytKB0ju2kdnsakD7fmjGEmGsI0DC1jedV xiT3dsiVcsRQtF2JZonAffGqLISdhFP2k9yAF+wob9+xa4i3E3IJBF5nxFqyO65MJcdd zHL8LpQ+mwdSTVKVj0OQDL3jW5av+QczBadb9Z6086tbAWMWMP0hqHvHyQuIwtIxiOKq iwZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=yaswVVzodwomNg7OJoqsjfX9xQUObSy00raw0PfY2Ys=; b=hN0o5cPGf4zIG+Vz1Qt7C4nbfucnwiiWsc7kH0+XP8zwEQeFTYt11z+7O0UD+fYhcm w3dnA5QAEeXfiZm/c642N/ycuB/drg9LZKsWpmRIuh8M8EUkVBdoOAvnKyMVFh5G73tu Ufj8LB0IaTG29GcVpfLiCfo/P4y7BMeMWVXmrWQqMAsfO81+RTd/ZOjXhHpMh+xOKBfG iFgWdTAzn0KZkVfCcxYcnEg5RyuACWWtl2U/pKNXTtGZzPQ0gWsABf18GESnWsCbwGxK 53Kh2AcdxQGl43rmH94xkldowQ50C+uBXghjVW0mt0b06aueZ0O1zfP4OK7X2dO1vzuA 3QBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=MYk3h2p+; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Return-Path: Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v11-20020a1709067d8b00b00741521e9a3esi2393780ejo.235.2022.09.02.13.41.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 13:41:33 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=MYk3h2p+; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 455293884F0C for ; Fri, 2 Sep 2022 20:41:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 455293884F0C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1662151292; bh=yaswVVzodwomNg7OJoqsjfX9xQUObSy00raw0PfY2Ys=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=MYk3h2p+4dXFII3w+KR9kxdfE5GaUFL2qylDAI9BrnWmDnko2W3SbYR8+qgdf2SqQ XgDZJ03CPpY9vLJ8Epvrb+Iq3W0hrz0IlU8TulMayyipI/K+kXdOfwI6hYqNe1zBNL DXqif/trv8xM3QNwW3JZOW5QtKADYgF5/0Q+aAQs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by sourceware.org (Postfix) with ESMTPS id 148B13857349 for ; Fri, 2 Sep 2022 20:40:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 148B13857349 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-11ee4649dfcso7673160fac.1 for ; Fri, 02 Sep 2022 13:40:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=yaswVVzodwomNg7OJoqsjfX9xQUObSy00raw0PfY2Ys=; b=I6o5dG6UK3BDXN+v3FmePCn3bx2r58gOFlKhPXhU4dPmnHj7loySPNFLnonNSI9eiE 9aiq9/20Le1SOhAM8PCcIocY1BMORVLTu4wmzsai4DRQXkiKsDHNcRaS7PlV/87L2wZX wLueYsKr1qDGyOigoDynjHAY5fAD4RfGRK6kG3cK/o47LoYbbmjKWmswJ3IYmDw7HlqT w6JqhH2nH+J/lF0DN/NEquqeQ65sUvQH0rnBEt/4pF6sGNqjsgTnoVHqyiAaHnMJeN+D cMEd73K0zlrvzFnMgXI4aQuWyyGPCdzFbi4V8sVvelJ1/hYJH3vTR4XuryiiDS55Xl9f Odsg== X-Gm-Message-State: ACgBeo3bHOX+HVKJ4moHz8dgUmDbJUwf+yzB8DtW2mksEB5Lf0b4jjSo NIzhpsk628RmfLOvacyFZF0R2hHLe5IjrA== X-Received: by 2002:a05:6870:b00f:b0:11f:b1e:6142 with SMTP id y15-20020a056870b00f00b0011f0b1e6142mr3077773oae.234.1662151205632; Fri, 02 Sep 2022 13:40:05 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:dfed:72d1:946c:4eb1:ce5f]) by smtp.gmail.com with ESMTPSA id i27-20020a4a6f5b000000b00425678b9c4bsm1107902oof.0.2022.09.02.13.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 13:40:05 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 12/17] hppa: Add memcopy.h Date: Fri, 2 Sep 2022 17:39:35 -0300 Message-Id: <20220902203940.2385967-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220902203940.2385967-1-adhemerval.zanella@linaro.org> References: <20220902203940.2385967-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: Richard Henderson , Joseph Myers , caiyinyu Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org Sender: "Libc-alpha" 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. --- sysdeps/hppa/memcopy.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 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 0000000000..288b5e9520 --- /dev/null +++ b/sysdeps/hppa/memcopy.h @@ -0,0 +1,42 @@ +/* Definitions for memory copy functions, PA-RISC version. + Copyright (C) 2022 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 + +static inline op_t +MERGE (op_t w0, int shl, op_t w1, int shr) +{ + _Static_assert (OPSIZ == 4 || OPSIZ == 8, "Invalid OPSIZE"); + + 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)); + return res; +}