From patchwork Tue Jan 10 21:01:01 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: 640902 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2916694pvb; Tue, 10 Jan 2023 13:02:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXv6wuZWFrwnNeByc6ZS42ESO2SMHZZuWXPna5QW6c7C0eIJfPoQ4cgJFjfItYsuKwWtrfz6 X-Received: by 2002:a05:6402:5293:b0:497:c96b:4dea with SMTP id en19-20020a056402529300b00497c96b4deamr12927658edb.5.1673384579218; Tue, 10 Jan 2023 13:02:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673384579; cv=none; d=google.com; s=arc-20160816; b=weHIDp6tMSdWFRDVi44oIM0ATDINSN6AzAw/zE4MnvCYX/CzdeTvg8dU2XWhkcqlvT mxlkTOPnMNYWVEr1UHt79QXa8Xg9YXOYypxjF+LBvC81uQJLsaX2eh0joeYFm5HDbAQ0 SsKQavnrwDA9YukYuZ5H/za7qYla61pdEW43RliTf7HAE7PLzsRicC3vab/gIcsGYgPK K0WratUxasmWn5RCb78TK5edAxWEUlgJ+EiGkZKDofHuZG+aIU6IZzHABmQU1nYYAsay iBlTJ9E5AxXIcKWbsfJl0DvSnH99TTCLbiLMRo91LiInxyQqYNzOl09tCdwTosp0wNnU xOUA== 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=yAUE/W7bhP/xnSiR+tMxAdu+laX4H3BJeJyE+1FP//enLaOJQsgXlG8T7Xzg1Iblyf dXXp0xhvmYEg9w7GQRR1WhyQPqyhdYYJH7z/Fh2HS2xEEK7zOZNyTa/II/V9ZnRTaQDh hllJJh3GenyetUCTCNCjjnr7Cps2P80UgQWK/Ekl/S3nz0+6uRc6z2jR8MNj+2s5Q8yh R/nJRQ+QvywAEnDrYGluGPIVXH6tWTQ2D4K7P/54KaekwZMtcDBRpJrgcOrD5yKRsTVi gNODmVgwfCMi47HYybua4BzrArA67csIn6z28yO5Lo+Jcr8/T+WMqc+IJQildf/j+5QW tWHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=US60Rbhq; 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 t23-20020aa7d717000000b004534c6c4bd7si11695541edq.433.2023.01.10.13.02.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 13:02:59 -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=US60Rbhq; 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 DA38F38493ED for ; Tue, 10 Jan 2023 21:02:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA38F38493ED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673384577; 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=US60RbhqfcaIShtkN2k01c9g3WajyoyleRQ+873s+o3jYa7NkVY0eM+lnft9KmHKm EUq8cmKmX+idaM3rSfv/Kg4+b9IRia1BggIF7JQBx8MLLTDN7N+mQIfPpiZigKv5If m8AuJtxBSTGXCTWdHc2G+amHE6xGrvTnzf1uWU2Q= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by sourceware.org (Postfix) with ESMTPS id D49D13858281 for ; Tue, 10 Jan 2023 21:01:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D49D13858281 Received: by mail-oo1-xc29.google.com with SMTP id q20-20020a4a3314000000b004f2177e6b38so601279ooq.3 for ; Tue, 10 Jan 2023 13:01: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=r47wAbb4Zb0DhJKaSYrA88SYbfspY7wru8yg4/bnClOx7Kv+IsRy9avcz0wAajV43j ET9j9G7SI1GJlt7ogWOnoSfrhRW5aldjpi6zlkE84fsZi9cdfnE4+DuoR6ik5EDRjKhP U7qE99oZpU31qNMRRMCjlW98MJpK4FkD1u4EoQuU4f8Tbq934FiUO8Juev29yHvURPxg c6cI4fuUELAs0QQeD6C4r6NzN7uXOqmdXGPnPnbHCs99quA/JlXXtk4L0qEX6/JKjyln l+iM3P+rxUYIebppymhbIdaU7R+5mzu45Q4JT4nuybWj65uELCCw9j1jfjawFgPvzcmC BOug== X-Gm-Message-State: AFqh2kp9Cg/DvIy2X7GBTNynNWL8KPNZn+ppu+sDfmOnR9XLPHjpX/bf IGfaR5HPU8hWqvZRuAKlZvhPKXgPy8b3SwQLxTQ= X-Received: by 2002:a4a:952f:0:b0:49f:8941:ffed with SMTP id m44-20020a4a952f000000b0049f8941ffedmr30671136ooi.9.1673384501451; Tue, 10 Jan 2023 13:01:41 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c0:a93a:e8a0:dd55:3328:997]) by smtp.gmail.com with ESMTPSA id r5-20020a4a83c5000000b0049ee88e86f9sm6202193oog.10.2023.01.10.13.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 13:01:40 -0800 (PST) To: libc-alpha@sourceware.org, Noah Goldstein , Richard Henderson Subject: [PATCH v6 12/17] hppa: Add memcopy.h Date: Tue, 10 Jan 2023 18:01:01 -0300 Message-Id: <20230110210106.1457686-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110210106.1457686-1-adhemerval.zanella@linaro.org> References: <20230110210106.1457686-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 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; +}