From patchwork Mon Sep 19 19:59:15 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: 607328 Delivered-To: patch@linaro.org Received: by 2002:ab3:1c02:0:b0:1e7:4ce8:c350 with SMTP id u2csp1668784lth; Mon, 19 Sep 2022 13:03:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sTCA+dARjrrAuqRysJ4kqNfVHuUDbSyCUYBfwxnTswAiVoQiCKBr00YN4phPhaJ/vidn5 X-Received: by 2002:a17:907:a06:b0:77b:6eca:c089 with SMTP id bb6-20020a1709070a0600b0077b6ecac089mr13554442ejc.362.1663617804367; Mon, 19 Sep 2022 13:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663617804; cv=none; d=google.com; s=arc-20160816; b=kAa3E8bboSIqHCnVdb7+WDMePZpcZNI5QpD5Tn6Xi8MDwIGtKZcQnUs0Th2PZyxYJQ eDYNoahHHNpxVHRVjWcCFt68Lb9j8VFmG8Ud/3td49TZk6MoXCz+TXwCWdbACK4484jZ lgPccFxfPRFDcaCA2HsBklNmybgMK6WRs+UJl+iqJvk9ZcVUZZLvBpcehz8JKCcsonG3 R6q0TIj+kEbGRaERTvhGz8R44/xUTev/eD/wdJesmDL4KP3HZ35Yu40ahQalNamkWjM6 DVuTrO2eUMkWvZ8msPwxmgRyimbKFanN4bGk6sKih6PV57ImZLA8N7pQKmlOFsTYvpZK nsuA== 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=nKvNt5mZxk/ls5lxgfhgKS3xMhTAa6xYJBVx/k9MNc+Srd59pS46JS8Tsb+17zRFXE 2i8Ssqpsi2S4BMCaQ60630l43mvaR62szk8gM5ze5wvbKFKlMhQBNBwWSqlfRAg/uP2b H7nzotRpqIUhHbELvMNDjze/vZuDmn7L9lzqvUZtZmD0ItaYub4V5WndEX7oJYxw33sw bXELH81YtDS2qMHqQp2nRCtIK7dFeVdAqnbaw1VShbqtWYK2UHE2pTxuVaFxCNUmzYcM LGD+bwi/qF8ufN7eV78PkEkAfSHS5tdQxzdAccj3wn/YD5irafPf6XMJSN+EyIlfX83X WKxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=lK4aLiuq; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id hd19-20020a170907969300b0077d8a49f36dsi23902272ejc.691.2022.09.19.13.03.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 13:03:24 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=lK4aLiuq; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 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 5A3A5384D1A7 for ; Mon, 19 Sep 2022 20:03:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A3A5384D1A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663617803; 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=lK4aLiuqc1Q/2emkiVdTHM4rkxrGISpdEM1KlBrMVNrUig0qroCJ2D5SkekA5lAW5 6Mk1YXZWGeegxP5txzffoTIPYI7EWtCgZ3tWniN8d1KfzrVuTTk3ERYtZJJLxNELlx T51hdC9EnWGrK7ZeBoigKs73gwHPNZq/0AxYHutY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by sourceware.org (Postfix) with ESMTPS id 3455A3858282 for ; Mon, 19 Sep 2022 19:59:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3455A3858282 Received: by mail-oi1-x22b.google.com with SMTP id v130so909796oie.2 for ; Mon, 19 Sep 2022 12:59:44 -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=ZW7+mynIxYtKN3OWPIPQu+mzZT9W0a1ejYhn/4fsNCFepplasFHF5bj2/4LDS/oJUR BvpF0U8s2yT/tF0/BISdLZLs+z2MQvw8dObLHnJUmxJSH8fnaNQtyDna7nrg8HX5ykix CF82lY8zoySbshzwbl23x3e5k3SR8pbVkliDKAIrx7ByYT6Y5fG/Q/g/QOzOhaUUEppu enKCm7+vJpR8Kv27kO4n65Qp8rxUItiOrFJGiqFUuJmbxzgqHWzlr+dYbEs71FiWP4cN sxBMGH3FUQnmWN0ZIwvOV9AlEuDqQqc3sEIEjXEEJdT8G3r3NE8WdjJV/EXed/u5kEbA Y0Mg== X-Gm-Message-State: ACrzQf0YhKXd2wbT3ZW9GzHhOtgsSoEykj1BPw7DssMqqKwuYKWGREwR iMxY8bVzpIli6+YvY9iJSodXYLWjFPGOWgpn X-Received: by 2002:a54:4482:0:b0:34f:b980:e74a with SMTP id v2-20020a544482000000b0034fb980e74amr8842453oiv.32.1663617582466; Mon, 19 Sep 2022 12:59:42 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:c266:b3ad:a56d:1ca:d6ea]) by smtp.gmail.com with ESMTPSA id l7-20020a4ab0c7000000b00475dc6c6f31sm4532291oon.45.2022.09.19.12.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 12:59:42 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v5 12/17] hppa: Add memcopy.h Date: Mon, 19 Sep 2022 16:59:15 -0300 Message-Id: <20220919195920.956393-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220919195920.956393-1-adhemerval.zanella@linaro.org> References: <20220919195920.956393-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 Netto Reply-To: Adhemerval Zanella Cc: Richard Henderson 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; +}