From patchwork Mon Sep 19 19:59:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 607322 Delivered-To: patch@linaro.org Received: by 2002:ab3:1c02:0:b0:1e7:4ce8:c350 with SMTP id u2csp1666459lth; Mon, 19 Sep 2022 12:59:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM788lqr8H3Z5qst5kpnD5yB5Lf2/2Ow3LtfHBoMzvmP4HiTKTzmEy78aUWXSNYOdSw4bqPB X-Received: by 2002:a05:6402:190f:b0:452:d6ba:a150 with SMTP id e15-20020a056402190f00b00452d6baa150mr16975034edz.126.1663617580402; Mon, 19 Sep 2022 12:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663617580; cv=none; d=google.com; s=arc-20160816; b=E+7b8C0xI5jPPBF+huZkZ29Z6OieLMkRT41XRb3C2GMK2fjNYHpOf3yVgqmd1KQbdL Vy2Yr5anZm+qYRJNFBGAQv0ZsDevOVTqDIJ90Vgv8Vnqy9TFhH8M7wOIJP/9UeXDWo/k tgeQAqVam7W3WYz7oiwWmuntFDXFrBLiq5Hyq3+NEwu1j05Zt8bzfI1dIYuyoW7niG5K SDJ8rq9yTsEYYKxiAKZVAXl6TY8ioXlmNqfivzu8um5MfQTXKRdFwR8DsT7bWhxkbW8O fOCVYO4ZzCarmMbN4ppoKRd4xHoTrXXZIOO0Lc4hrLhN/i/0p5xitjNE5ObU4mJSO5hS dnyQ== 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=sH7XP65dr4Y5FSbOljjOPzXkAP0NsQyXcAoyHJedZ9k=; b=Q8NJGxp/wacI5XHNaXiZPPmFmq5v8tSFtO5+7E75goOG+5mAl94RPNM8AFKMfm0NoF /WLEsLVFYf0LajG9mezPC/PMJZoE3z1gtvYH4cNpQ9Ae+EovX0/u/ug9t7qNICUhcJxO YTOGYAO9/H2cc0u1COHMVwuyk1h612F1YQ73EOdoZJzi2rRyorBb2a7BE6y9tFtOnXHl BNi+XrgVZznD1I7rdcdz9nMgBKY9TNef00/avLsmS0ivaTu91s9C2ZrzRqD4WjB3UU4y HsRCGKUEIuPxjSTzphHk1M9mdu5u7py7IPEuXczyhsaGAevPoz3vheiskb5gTZptaiLY uu+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=FFKa54we; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sd23-20020a1709076e1700b0077b771999absi957163ejc.870.2022.09.19.12.59.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 12:59:40 -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=FFKa54we; 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 5F1FF385801E for ; Mon, 19 Sep 2022 19:59:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F1FF385801E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663617579; bh=sH7XP65dr4Y5FSbOljjOPzXkAP0NsQyXcAoyHJedZ9k=; 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=FFKa54weXxi3d5Ggi2HwKcya/B5nx5lfocQY91UltAsOHtFp47dWWYELcaORAU31r xWNjPNT5zM3ILz5TkzQq2Uv4vnJczCDfQNadNuyFFsBY57x9nMLzZPlrZKLf/H6tyg fv+8nGndJ99F4yk1fAZFQLuGFiRi6FKKGMhJoEMc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id 327AD3858C2F for ; Mon, 19 Sep 2022 19:59:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 327AD3858C2F Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-11eab59db71so959621fac.11 for ; Mon, 19 Sep 2022 12:59:30 -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=sH7XP65dr4Y5FSbOljjOPzXkAP0NsQyXcAoyHJedZ9k=; b=GzvyZPa8DdqxiJli2IGVcZ4dMugDbXK9m8SsdQYLWuUVfYKC3WoJLo3dsG4D0cYRyz uqi4ZzOvp18L+kSWGwr6GgRm+CwVLNp/ZrFVKLgB1ii8L0+eoOFNrvFJ5D+YZtEMIGSh yFkV0LYp+SSHMl7rJr+5QaBYmNiPl7XZexDboQqlIz3Y9PyQOELeD9uLYUx/SDdCRIAo zcOvAEM+rF2iCfejWlfbtb/SsUcnG6iYWPejcDUGCqRgPZF9JbXIi5WP8WvnEMjo7fC5 1P2A68ElogAx0Btc5st6+WwEN23GC9H07hfmvqOBg/ywdd6oih/zrZD7Aim1+EHeKf7x LoIA== X-Gm-Message-State: ACrzQf17Bbt8bYowx8nWOfWFPZ7CgO+ICY0Gls2FzrzQ82c63Y5r8/lv 4wEBrZCbXJfDSF+xWZX6iGUnaCz2bTZ27Kea X-Received: by 2002:a05:6870:6195:b0:12b:7db:d7ba with SMTP id a21-20020a056870619500b0012b07dbd7bamr10491677oah.82.1663617569005; Mon, 19 Sep 2022 12:59:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 12:59:28 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v5 02/17] Parameterize OP_T_THRES from memcopy.h Date: Mon, 19 Sep 2022 16:59:05 -0300 Message-Id: <20220919195920.956393-3-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.4 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 Reply-To: Adhemerval Zanella Cc: Richard Henderson Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org Sender: "Libc-alpha" From: Richard Henderson It moves OP_T_THRES out of memcopy.h to its own header and adjust each architecture that redefines it. Checked with a build and check with run-built-tests=no for all major Linux ABIs. Co-authored-by: Adhemerval Zanella Reviewed-by: Carlos O'Donell --- string/memcmp.c | 3 --- sysdeps/generic/memcopy.h | 4 +--- sysdeps/generic/string-opthr.h | 25 ++++++++++++++++++++++ sysdeps/i386/memcopy.h | 3 --- sysdeps/i386/string-opthr.h | 25 ++++++++++++++++++++++ sysdeps/m68k/memcopy.h | 3 --- sysdeps/powerpc/powerpc32/power4/memcopy.h | 5 ----- 7 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 sysdeps/generic/string-opthr.h create mode 100644 sysdeps/i386/string-opthr.h diff --git a/string/memcmp.c b/string/memcmp.c index 6a9ceb8ac3..7c4606c2d0 100644 --- a/string/memcmp.c +++ b/string/memcmp.c @@ -48,9 +48,6 @@ and store. Must be an unsigned type. */ # define OPSIZ (sizeof (op_t)) -/* Threshold value for when to enter the unrolled loops. */ -# define OP_T_THRES 16 - /* Type to use for unaligned operations. */ typedef unsigned char byte; diff --git a/sysdeps/generic/memcopy.h b/sysdeps/generic/memcopy.h index efe5f2475d..a6baa4dfbb 100644 --- a/sysdeps/generic/memcopy.h +++ b/sysdeps/generic/memcopy.h @@ -57,6 +57,7 @@ /* Type to use for aligned memory operations. */ #include +#include #define OPSIZ (sizeof (op_t)) /* Type to use for unaligned operations. */ @@ -188,9 +189,6 @@ extern void _wordcopy_bwd_dest_aligned (long int, long int, size_t) #endif -/* Threshold value for when to enter the unrolled loops. */ -#define OP_T_THRES 16 - /* Set to 1 if memcpy is safe to use for forward-copying memmove with overlapping addresses. This is 0 by default because memcpy implementations are generally not safe for overlapping addresses. */ diff --git a/sysdeps/generic/string-opthr.h b/sysdeps/generic/string-opthr.h new file mode 100644 index 0000000000..eabd9fd669 --- /dev/null +++ b/sysdeps/generic/string-opthr.h @@ -0,0 +1,25 @@ +/* Define a threshold for word access. Generic 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 + . */ + +#ifndef _STRING_OPTHR_H +#define _STRING_OPTHR_H 1 + +/* Threshold value for when to enter the unrolled loops. */ +#define OP_T_THRES 16 + +#endif /* string-opthr.h */ diff --git a/sysdeps/i386/memcopy.h b/sysdeps/i386/memcopy.h index 8cbf182096..66f5665f82 100644 --- a/sysdeps/i386/memcopy.h +++ b/sysdeps/i386/memcopy.h @@ -18,9 +18,6 @@ #include -#undef OP_T_THRES -#define OP_T_THRES 8 - #undef BYTE_COPY_FWD #define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \ do { \ diff --git a/sysdeps/i386/string-opthr.h b/sysdeps/i386/string-opthr.h new file mode 100644 index 0000000000..ed3e4b2ddb --- /dev/null +++ b/sysdeps/i386/string-opthr.h @@ -0,0 +1,25 @@ +/* Define a threshold for word access. i386 version. + Copyright (C) 2018 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 + . */ + +#ifndef I386_STRING_OPTHR_H +#define I386_STRING_OPTHR_H 1 + +/* Threshold value for when to enter the unrolled loops. */ +#define OP_T_THRES 8 + +#endif /* I386_STRING_OPTHR_H */ diff --git a/sysdeps/m68k/memcopy.h b/sysdeps/m68k/memcopy.h index cf147f2c4a..3777baac21 100644 --- a/sysdeps/m68k/memcopy.h +++ b/sysdeps/m68k/memcopy.h @@ -20,9 +20,6 @@ #if defined(__mc68020__) || defined(mc68020) -#undef OP_T_THRES -#define OP_T_THRES 16 - /* WORD_COPY_FWD and WORD_COPY_BWD are not symmetric on the 68020, because of its weird instruction overlap characteristics. */ diff --git a/sysdeps/powerpc/powerpc32/power4/memcopy.h b/sysdeps/powerpc/powerpc32/power4/memcopy.h index a98f6662d8..d27caa2277 100644 --- a/sysdeps/powerpc/powerpc32/power4/memcopy.h +++ b/sysdeps/powerpc/powerpc32/power4/memcopy.h @@ -50,11 +50,6 @@ [I fail to understand. I feel stupid. --roland] */ - -/* Threshold value for when to enter the unrolled loops. */ -#undef OP_T_THRES -#define OP_T_THRES 16 - /* Copy exactly NBYTES bytes from SRC_BP to DST_BP, without any assumptions about alignment of the pointers. */ #undef BYTE_COPY_FWD