From patchwork Thu Feb 2 18:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 649664 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp395563pva; Thu, 2 Feb 2023 10:15:17 -0800 (PST) X-Google-Smtp-Source: AK7set85MwKgoOtjx1P1H8EBsVoM368PYJ/q9aBl267uxNQJWxgG1ppuWTtq3zeeFdiHqCz8DaZ3 X-Received: by 2002:a05:6402:b27:b0:4a2:2daf:adcd with SMTP id bo7-20020a0564020b2700b004a22dafadcdmr7216367edb.27.1675361717771; Thu, 02 Feb 2023 10:15:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675361717; cv=none; d=google.com; s=arc-20160816; b=hDj6DMySs4cuMWE7h2gtVejiw54G6zEbHMryh46OvRIS9hbEMSm6gWLLs83DIwlgvc /JplVlhfX3NpDkrMldo61Zr7tJiWZPw4y0UUo5XTvXWkINXxKG9iaqzTim6CVzFjhoyh WM2PHZFJdPmV+OsGT0rIIeMiuCibTTNfBfG/AR3uJ5CZ7wrEYc8BxK+Rb/StE1uLfyPQ zRZF627unwFyi319Me2YjyTF4LTcXDnZuQEaH+ZQBXELQ45TpsVElzdPH50XfnupiVcj X9oUH5XeMylRrIlrEWcbsy7YVaQGQDpWcDGna89u7bnGuQ7IVn21F+BlwEFi8pspobX8 gYTw== 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=h+vPvH7WJFuFiXaNRppqjpFasecUdh17PIqB9elepeI=; b=XviG0QHNm2UuhVLFQagAMCv2wlKikL1Sh1tFXe/lueIYyFglJMVQM2dkPlTO5BREVH 4lmbs2fVWIWFRok18rIXndPb0oCfottEV8VB0tLnlcPs6AURH+Utz3wRlWQephDfxqLC vKJ5iAY6rWbHMSzWJpLXjciGtw/egFdxup1H0rnU7up4+AK4X23xOUqKKbMycSwDAV+k 26MaQMUSq3NM+LowdmdlVWrYPvwevE0rY0N9MtIgO/m3sZVkGot2MhPKqTs4kQi2gQtk ECWqruGmQBJqCFQqmg0Ii2yXJ7HwYIu8eEfXF6V/ldYvypLaTeTwlmHzZ3+vqcL3xZwg wiwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=AuI3Yd8D; 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 fd1-20020a056402388100b004a23153d992si74513edb.238.2023.02.02.10.15.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 10:15:17 -0800 (PST) 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=AuI3Yd8D; 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 AC6853943417 for ; Thu, 2 Feb 2023 18:15:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC6853943417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675361716; bh=h+vPvH7WJFuFiXaNRppqjpFasecUdh17PIqB9elepeI=; 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=AuI3Yd8DpK5T0bnkFKoMIkao+1trFD0WulaAh0bZkjwO7clQhZ/v4MpKTED2/fJiz 8OZpcwK8H6TvhGTfrtKiX1i5ZFCO/FaQOyHPhk0hEN/+uGiLhpdh+SME7IMUwfDkQY yu+1qwZa1bMnZ2SSAFkFZ7dMp858s3DgYXQpzOt0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 4D942385700E for ; Thu, 2 Feb 2023 18:12:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D942385700E Received: by mail-ot1-x335.google.com with SMTP id g21-20020a9d6495000000b0068bb336141dso687807otl.11 for ; Thu, 02 Feb 2023 10:12:33 -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=h+vPvH7WJFuFiXaNRppqjpFasecUdh17PIqB9elepeI=; b=BL//Gt/57RUYJJFOEn0X/j+vHwb3Mz7/u0ysqrW26i0ZXbWH4+LzpRaurDzhBma+Gz 0NGwC/UJOjKHhgggO7Gj+dUQDrfequyp0ZvI1y/5uVKW0+pGc7y1wRyLfrTgbPbRze6W 6m71HyKo9hXUTqLmXl65CqB/Hmnd8NrULuxRI86OxMnxk2nasUGBOttpIQLoFRo3T65s KHyqiHlj1ijr2UaURx/WYtu/ruR8FZ4P0oCIhhwAGtkeLGUsmuaEvzXM0lBwkp7bfPp1 5LMqqxQ/10/m/nxDvV9JuoiLr9D1NMGlbsc0/k76fQ8nP7S78YB+BqLroRQOwz/LBI7g T6Zw== X-Gm-Message-State: AO0yUKVGPqszsxG3IDa7u6let9f5tvKVyXZyukOgHUjdtKWZeAcHEmSI r/1/skfgmK/i6+oGMEufP4QcUtGs1jKeIdM5Bbw= X-Received: by 2002:a9d:6a05:0:b0:68b:cd66:2c52 with SMTP id g5-20020a9d6a05000000b0068bcd662c52mr3202226otn.5.1675361552460; Thu, 02 Feb 2023 10:12:32 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:1887:da12:b9d3:2162:a28c]) by smtp.gmail.com with ESMTPSA id ci10-20020a05683063ca00b00684a10970adsm126689otb.16.2023.02.02.10.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 10:12:31 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Jeff Law , Xi Ruoyao , Noah Goldstein Subject: [PATCH v12 15/31] hppa: Add memcopy.h Date: Thu, 2 Feb 2023 15:11:33 -0300 Message-Id: <20230202181149.2181553-16-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202181149.2181553-1-adhemerval.zanella@linaro.org> References: <20230202181149.2181553-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 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. Reviewewd-by: Adhemerval Zanella --- 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; +}