From patchwork Tue Jan 17 20:00:03 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: 643410 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp1366129pvb; Tue, 17 Jan 2023 12:03:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXuGDBlBA/++BzbkbUuZaf1gvWhT3SXnMDwLUyDJS5ClRME8GCX8Di2cLN47bmChF5jbVpZz X-Received: by 2002:a17:906:3487:b0:843:770e:777d with SMTP id g7-20020a170906348700b00843770e777dmr3888100ejb.11.1673985816891; Tue, 17 Jan 2023 12:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673985816; cv=none; d=google.com; s=arc-20160816; b=DDFtv1aZyQEZK6gnbR88dO+6/IpinaqeZVhI/w4BsB6WtV3J0RrAICV3U3lkhFrbc8 XmLXIMFg2vjZO7xdzd37c8Lq4EV23UAfD//ZSt5uGbSQnAT2nnUxD+5LvpYXaNV0UqYU L/dt/xS6wyzU2eaLTu6IvuPpoIEMHkFHhXe+hpD6wZoKQj0QjabPvWkzNb9MM7M+XLhB 3c/H8OJUClfbVViRU3DTtWofmagRTbgNSrjlqHBJBW37d+DrBtHbt0OdyPPPztQUXE8s E/0ohvVRO5uLWnOT2JzaVY2ykLxB+lZVU/36g1XGS/amPw1E7OOlB+KXzE3CX00RGpQf PvPw== 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=Mq1SjUWZ+UjmM7yval62LkQmxQlT/BAGNYwkWx3wO1OYRIVuEqS9rOJPpi/A4jXU++ vAu19Qu5O71XE70PDwc+S3TYWQylT92b5nYBx4bpiQLVxdrj67ZeyLZoKXrDBysvHL+Q pIDacX+kCMmvnJ+qTKXSETrBafREdVg6YB4Y2im0MQXSwGOpjhaMlkJhzbnNqH1rq2TL l4n8b6pOpyqXBtAVJlOlLu2csjwppWtrezRuQNqS2Otyjdk3lBTJG+OwXPyCXvgYAaYp I3+r9lPKhqubGHce4xDgDm7dwfftTaYIWRbVysN6HRtd84LVEgAABI2FtdkhriOW9qqG Emig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=lnuYZBHQ; 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 l15-20020a170906794f00b00875abc669casi712928ejo.572.2023.01.17.12.03.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 12:03:36 -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=lnuYZBHQ; 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 BE52D3858031 for ; Tue, 17 Jan 2023 20:03:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE52D3858031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673985815; 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=lnuYZBHQeXLvoQyg5Civ0Vo413KPjune4Xektz8DDoYWqyoOd6B0w6Q9bfKqJZ+7i xd1v0ODWByIrAJZs6Ns7SgWyc93ETuL06L0muw+ZGPYsbz/gKB6SVtUUxRezCpPBI9 Tj53ZeQXZflVCA5csj0L0qiwIAQsjt9XmqgJldTY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id 562C3385800C for ; Tue, 17 Jan 2023 20:00:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 562C3385800C Received: by mail-oi1-x233.google.com with SMTP id o66so26870262oia.6 for ; Tue, 17 Jan 2023 12:00:43 -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=ykHeY5svgim3IDg77bBL+N9ll4tJ9p2BVlkakwXtNmrhPx53JcKlVXOhooRFrfUFbZ mi2B27h49mh8MO1Y67U0dFgGc69O53cIMutncjv8OHmZZhg+t+05ol8Fi07xkJkfeckI WKn5NXzGCvU16xapYffJp0gPsDa/ru1w3f/GF5BrvmUrMOKk441XgQ+/jUwj5eN4UwPO 1IBScLz2K+YbolJ2eP7d1PukEvnFqaz6Ve8lDSosyM00YpTW4CKfPzbqNgJ6C/iNDtbq GE3UWTHLJCnQjQEaGdme5ie9yfbOrBD4mgOspJEcfBmImdYNIDalO1u6KSkw36K24Xg6 4g1A== X-Gm-Message-State: AFqh2kr8Fzr5jTlG7T8ArjJnN9tVAAUVhqRMds+cSVRrFi/lbTNheTV+ 9iA2b1u0adnDXKEXIhZbpeC9FezH0nO8BdNRXac= X-Received: by 2002:a05:6808:1687:b0:364:c2a9:5584 with SMTP id bb7-20020a056808168700b00364c2a95584mr2941953oib.32.1673985642204; Tue, 17 Jan 2023 12:00:42 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c1:1652:fbfc:c80a:f5e8:5ed9]) by smtp.gmail.com with ESMTPSA id l10-20020a056808020a00b00360e46a1edasm15095866oie.22.2023.01.17.12.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 12:00:41 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Noah Goldstein Subject: [PATCH v9 11/22] hppa: Add memcopy.h Date: Tue, 17 Jan 2023 17:00:03 -0300 Message-Id: <20230117200014.1299923-12-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117200014.1299923-1-adhemerval.zanella@linaro.org> References: <20230117200014.1299923-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. --- 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; +}