From patchwork Fri Jan 20 21:16:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 644653 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp1017389pvb; Fri, 20 Jan 2023 13:19:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXuOuTEsJoo8af7YzZqXjpDj/KjTBkho+8Fd9PP43le9aHGk2yqdV2ag9bu1tmEGwtEBluCV X-Received: by 2002:a17:907:d506:b0:7c0:cc69:571b with SMTP id wb6-20020a170907d50600b007c0cc69571bmr19626256ejc.8.1674249589874; Fri, 20 Jan 2023 13:19:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674249589; cv=none; d=google.com; s=arc-20160816; b=UXHUgmRncFgvwJY7VZR/Hlema4qUzno80GdffyENhiudzmuhMEVzXFw58Ha8vgm1OV v0g/j/H5ZNwwKeN7AVoDLSamIacFsW83uwVSbciGIZD5WLLvrFAGjwpU+PZLmLoS0mRo 1Y1uTcbom3iqk8ZTzC05vFSoVaoyp82cXC8Zef91zpgWF7OFkIsgv+xtk76URI1FTGcc ZXTRv9Im4GI1ImQqWJsYwONfziIbV8azoBfkznP9gygMrhpXd6fTaRHWnm8pYfsqSc65 1zi03N5mKGXd4ef/9QTf5aWHgsJEIlaTkyxehwaq5Jg8hcP8Niac5Zf5J7V5uEJLjiDn e6Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=uR+tmviJAnIQt3Uy9C/8G52NzH6k6qWZDh0/RH+zyro=; b=f1usz9FWZ6HPhTEw2Qt1/sw0WdTAR6x+xvYgKYySuCfsvW/FCkYDNR14oSiP8J6MLK O3DpBGTwAu3Zsl6wTekMTP1Mrt/4SXf2AIjrF1tVWSEQiH78RKSUc4hNaXlRPJJXRQrI KTES+198SlN3ofDPZXcDOjg6oBws1ApfoUFvSK4MlaFt23npDy9fV+CzyN9IjZjByBYS 2E9/pRSJpH0WFPES9mDfrQD+RZbk7O7cxDFlKzyNhzbLk7ALkmoQBp24+/vC5UUN2u8S GEJbbIk8J8YoOk59LbAkBfmRaOKtSZG5zuknjVNdtfimio63M0XjB7DrBUSwxHuLgOTR j8jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="uGWdk/6F"; 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 ae1-20020a17090725c100b007c4f78e610asi12344788ejc.442.2023.01.20.13.19.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 13:19:49 -0800 (PST) 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="uGWdk/6F"; 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 7DFCF3858024 for ; Fri, 20 Jan 2023 21:19:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7DFCF3858024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674249588; bh=uR+tmviJAnIQt3Uy9C/8G52NzH6k6qWZDh0/RH+zyro=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=uGWdk/6FPsbbQOAjOrYW0B2ygS/6qifmo6UZ6exfIKoQO7yjZTBWGCGjLDN90rToq 2kBIx3VspPquwAl9LLScr5yqoqy1TOZVeNWTR4z7jwoSqSDOMiJuToCes3kEMXKZYm iV0EqJs2MMMo8Lh01x0HWcPQ1tSGX+ZcipkKWRKM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 2EFBD3839C75 for ; Fri, 20 Jan 2023 21:16:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2EFBD3839C75 Received: by mail-ot1-x32a.google.com with SMTP id n24-20020a0568301e9800b006865671a9d5so3813644otr.6 for ; Fri, 20 Jan 2023 13:16:56 -0800 (PST) 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uR+tmviJAnIQt3Uy9C/8G52NzH6k6qWZDh0/RH+zyro=; b=DIGFRMJw3KJFxV8hPrg8MQidJI8zeVCaZWniu/+BhB6Vdl3nNvSHyI1PkQGN3VmdXo RKLAiDLFHy1fRDIP+GUPIyQvYv//8/CXV6XWzUfJmbo21B9JLWa89OnXEljo3vMCg0dw dsO1HdPlusW4xvsCp2o7dIJKh+uXZLBBz73leKgV5opTxr/OJfE4QiEAXIL3F0La/Gy1 DutK1/D0kCewD8hL8hoHDKGvn3c1x1yJw3/EOGE+P8AsnOfqBzmHqRlod8d9AbUothpi Q3bn8lpwhhkkJ7RZ/GyXrJfuRA+CLTqV0tb/VbHgKlKTf0Hh71ZCCAsKV0vHSa/YMkOE UMGQ== X-Gm-Message-State: AFqh2kq4A9d1/qC8vnGF6HLGLDM1vDJEM9ZhLI+n14wVUI7v8EBiqMIE yNIzugYgP68M6R3gqWe8rxGtwkmad1sXr6zYNTM= X-Received: by 2002:a9d:6b98:0:b0:670:9610:1ce4 with SMTP id b24-20020a9d6b98000000b0067096101ce4mr7473134otq.24.1674249414943; Fri, 20 Jan 2023 13:16:54 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c1:7e99:f284:be2f:4ee5:d122]) by smtp.gmail.com with ESMTPSA id d18-20020a056830139200b00686467f920bsm6937432otq.48.2023.01.20.13.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 13:16:54 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Noah Goldstein Subject: [PATCH v10 12/24] hppa: Add memcopy.h Date: Fri, 20 Jan 2023 18:16:10 -0300 Message-Id: <20230120211622.3445279-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230120211622.3445279-1-adhemerval.zanella@linaro.org> References: <20230120211622.3445279-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 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 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 Reply-To: Adhemerval Zanella 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..0d4b4ac435 --- /dev/null +++ b/sysdeps/hppa/memcopy.h @@ -0,0 +1,42 @@ +/* Definitions for memory copy functions, PA-RISC version. + Copyright (C) 2023 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 __always_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; +}