From patchwork Wed Jan 11 20:45:53 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: 641276 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp3458894pvb; Wed, 11 Jan 2023 12:49:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXvafN25at6tdw644MoYGBgHhmH21zOZzD/77gkYtJvg9D1ZB5tG+YKqXZLkAwXUlTNfmbCz X-Received: by 2002:a05:6402:401c:b0:48e:94ec:b7ac with SMTP id d28-20020a056402401c00b0048e94ecb7acmr33018460eda.7.1673470169959; Wed, 11 Jan 2023 12:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673470169; cv=none; d=google.com; s=arc-20160816; b=hqej5UQT5XBr5juAMNNc8ickxV7akfuIjOo2uD4G1LFBedY3G39iIYJ/xtDWB7CElo 1qcOZ/DZbX3I0RdSZh76MLuTiSvM37Ro0EiHIWyG5WFbS8h9KX6xYT+m8nL6edhHnXEt uEH3wrGcfZYBEfNuOBbub4mLV5IO9BdagKc/MEpRKT6z9ZhwQtfuZfcS6Se7GtUVKKLP F8XejR4PAXvP8y6qssSTejpNxEDw67DvcnCzMf2Iztx9TI3s4pFBPXMz6Vcr21qTE4G8 ZeKj2LmuSyCNcP8NjK8OPlXhKFw4AMjDB0X3PEZQWx5bY/TE+Q41pGISPBhw5LrLFp+c Zrww== 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=ntgFb2f4r/RvGxDDajgZiku44lG1xuRP7fSSl+VgLA0zAMNTLLk5nORyvhPxt+YHC6 0rLA1iSA0Lcue9C0JcT14rRmdZKcrLc+iwWfytsSkNRd48mZpDIuI8iejXMdG6JSa+KD 9y2fsItZxaQpqbi10Xwl025fIJe0vRkRSGEk3PMOlQecLJNPdEx1PlRe48gEY65o607/ oBGcM/PuOZq0kvb83RbvUUq3yo6Pi9LUlvSwBh1/bB2a67kHTfvWu7qLp50jFgTJ/Q+y OCrJ6Se41YpP+ilA1aHB6eFsqdlxXmYWJewwCPUT1+OrhMeZaVnKlEBWE53S4eFGuMcS s9eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=JmAg7ZGb; 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 x21-20020a05640226d500b0046de8e02697si19166790edd.239.2023.01.11.12.49.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 12:49:29 -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=JmAg7ZGb; 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 94BAE382FCB4 for ; Wed, 11 Jan 2023 20:49:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94BAE382FCB4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673470168; 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=JmAg7ZGb78Jn8tT7Ad+Xpfkvzn0HMQY+9VDUEeG4pqbSz3s8WCAQLy4XkF+SBnfi0 o0W3Elbi8pIQzNPerhUknzgrjCG2PrVzd+cXmNMjcG0fqUsgbpQEZsvI3hcflfhfbW jBTTeWrycXzy9Hrm5sVZ6k0Xub+AEWorEE0a4E9k= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by sourceware.org (Postfix) with ESMTPS id 87B3A38555B6 for ; Wed, 11 Jan 2023 20:46:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87B3A38555B6 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-15eaa587226so2148441fac.8 for ; Wed, 11 Jan 2023 12:46:30 -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=FLx9aghkcNrCgtTJTl2Wnoa2BoD0Cl2U7dsUDy4suiXoo4BfELSpdUez2Y/Rj3sjVC uK2dY1sZWKEKTgzN4Mll856NYmFIisjtv00xv9UtzkAkm4/IHHOmZO31glyW/HtPs0qP jggluONKrQTFAZqE+JzZ1Gxly5yrW48jlfNcgGHqfT9lIdRZiRQDNr63aMZrlPdZNb5i Kv6WhRRzDd1pRJGpvh+BZq0L1Rde7Ll3RMwAvvHqiS9MghvzBcECTphERNOOzonEQaYp Lr5RVt4/+V/nnxbj977XAsnAexagC9aDI/elce7y2U23HXrF/uVcdKDVsJkihzj4xqKB fKig== X-Gm-Message-State: AFqh2kqHGc2vuoUA4M8Y/PMWo4YqzeAnpo4HtH0/NK8PfxGgBpYitk8O h3OTS97MHOyEOPQolD4b7JYuLqSkbqFdGYV0xJM= X-Received: by 2002:a05:6871:b08:b0:15e:b2f4:adb7 with SMTP id fq8-20020a0568710b0800b0015eb2f4adb7mr729918oab.9.1673469989396; Wed, 11 Jan 2023 12:46:29 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c0:a93a:a504:f3f6:dd7b:801]) by smtp.gmail.com with ESMTPSA id kw18-20020a056870ac1200b0014c8b5d54b2sm7990274oab.20.2023.01.11.12.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 12:46:28 -0800 (PST) To: libc-alpha@sourceware.org, Noah Goldstein , Richard Henderson Subject: [PATCH v7 12/17] hppa: Add memcopy.h Date: Wed, 11 Jan 2023 17:45:53 -0300 Message-Id: <20230111204558.2402155-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230111204558.2402155-1-adhemerval.zanella@linaro.org> References: <20230111204558.2402155-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 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; +}