From patchwork Wed Jan 10 12:47:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124088 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5236109qgn; Wed, 10 Jan 2018 04:50:31 -0800 (PST) X-Google-Smtp-Source: ACJfBouJ5z1uX6mPTiUl17BMGxXW8EAsATNqY8jXsU2P5YRYmo0lXimhDkFE5SBLbyPjKYTC4HAU X-Received: by 10.101.69.70 with SMTP id x6mr14888084pgr.409.1515588631365; Wed, 10 Jan 2018 04:50:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515588631; cv=none; d=google.com; s=arc-20160816; b=Oocg1+Ceu3oNfiZhsL0RW9Z1ZZO2LNuKycpzMRzlGIEpv+P1+sHlWAJJzfhNy5ySaX zbsdIv+/BYE+tDFQ56zSAXDEQLIUUKGGLxzCLYmDxZedNEOzh95qdh31rXnPJSetCXtf 1aPHCZZlo+/2M/D0OnkDOIXZHmrZTTSJG9QKAZJpqJv00LSCjgUI7CwRjTvs+fQOoWfC hm4UggYC0JJdBDXxmva+ayNA2xQbw9E/7P3I1ax1DOtvsNAFXJmfxJvA46p+UmhEvxZd XjsfTJ9086zIcowSASra1K/YJXmZZ1uBaykovzOhujQSbM6Dwn2fCfp3uI4vCohW7BSs 7Rbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :delivered-to:sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=eD85uWCnr4Atzm05xkWv+fULYu/xpkegtpu4R4H3F5c=; b=hrWh4x0qTVbbNeBYuGS9DyWu5Ny7dAcA0b2R0oN9KqJjl8GdDU/5R5XywuBDZ52vXi zICWB04GxCCbzKJL1aOECyx6Soo6Cgn+xP1XnkrbpQUt2sv/kbO8fYvE6OtQYmwhj6E4 rlVJEBpGoMcnh2YaO6lIOj0DX7yQ+XLx3AM8SYekLfmSzVGtq/HUYxSBi4ldA2i+GShi TB2AaDY8g0nWR880F2KZ+lcIJzdo5W+j9SOf/GYbcBbN4lhaojS/yzp6+fPfcogVYhew 4ib9nIY+SCEMnh7LFUT8D3+eg4emF0OWSiBEfMVx53iuTvcmYfbdOa91+gD4vCAsaWtS Jy4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=l6RXEQeC; spf=pass (google.com: domain of libc-alpha-return-89010-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-89010-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m7si10552336pgt.469.2018.01.10.04.50.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 04:50:31 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-89010-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=l6RXEQeC; spf=pass (google.com: domain of libc-alpha-return-89010-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-89010-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=cGQ7xsWfFHD72iuJn+xujTm3oUeW3gt qCUy4CxpP9p/++SEIEL9DN/EkOnX5U2m2KizpsgDF7VuJMQiYQrx8gd07YPM0hVq zvrfd/JVp+RrBvhB5vyuSYmEg9h/3jp+dWUsdnUqrL5vd+JnM8WnCPCvSpTkQMPq 5WA4Iv4R/mOw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=liInf4XmOTu4HGQf59LUW8TisZk=; b=l6RXE QeCp13hnnstOwh/MfauYWIhLCEsQmHjVt3b6p8oGjijVZIfmkgEp4T9bP31zllPL ToNdkvMi30xa2PytLUJX9d3RTwePP6h/BI+rsuGj12aEJJChGacdek00mB+/yk+l 9/aRmerUSHtS4ERAIzpX9BLyZWVIpj+Dpp4Tmk= Received: (qmail 130457 invoked by alias); 10 Jan 2018 12:48:44 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 120633 invoked by uid 89); 10 Jan 2018 12:48:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=assumptions, H*Ad:U*rth X-HELO: mail-qt0-f193.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eD85uWCnr4Atzm05xkWv+fULYu/xpkegtpu4R4H3F5c=; b=TYIks5MN5TjYa0Zuia4mJDjKvPZytDkfMx4k7IPGvY69N/JbUh2WhAxT5Wdz6U+MRN HsmLM9WKzD64RL7xC8Durn1YeEMK8BeREvKOarGXTsnNr8Bnr7xuPOgp954QsXljJSgy ogLMvmza8ogmvGaUVZP9McHcB9wcJuDrPxEXwD1M+2BQ262J7WF8JOD0qs8UrddVOcZz Q2B3Zx43gEVC0tGpTrH2+A22+ftZehrXG0kK/1QwsERIJ+ij5Ir6NkwPvIGN2V1MGTw5 oCAUAtElOODvtbuh50imCoxzeoIg19G5ikoNKQw1mSjTgwsilBMcxZmDhuq4ZcjhJgpe Ci2Q== X-Gm-Message-State: AKwxytf+b8UeDHU77KymLWl8jOin8oxAXyd/4pzKa5qbL7a7NYb7+IKp wpR6KcL1EoMrer1qNDcMi5Rllf6tLWg= X-Received: by 10.200.58.228 with SMTP id x91mr26318657qte.323.1515588492533; Wed, 10 Jan 2018 04:48:12 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Richard Henderson Subject: [PATCH v3 02/18] Parameterize OP_T_THRES from memcopy.h Date: Wed, 10 Jan 2018 10:47:46 -0200 Message-Id: <1515588482-15744-3-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1515588482-15744-1-git-send-email-adhemerval.zanella@linaro.org> References: <1515588482-15744-1-git-send-email-adhemerval.zanella@linaro.org> From: Richard Henderson Basically 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 (alpha, aarch64, arm, hppa, i686, ia64, m68k, microblaze, mips, mips64, nios2, powerpc, powerpc64le, s390x, sh4, sparc64, tilegx, and x86_64). Richard Henderson Adhemerval Zanella * sysdeps/generic/memcopy.h (OP_T_THRES): Move... * sysdeps/generic/string-opthr.h: ... here; new file. * sysdeps/i386/memcopy.h (OP_T_THRES): Move... * sysdeps/i386/string-opthr.h: ... here; new file. * sysdeps/m68k/memcopy.h (OP_T_THRES): Remove. * string/memcmp.c (OP_T_THRES): Remove definition. * sysdeps/powerpc/powerpc32/power4/memcopy.h (OP_T_THRES): Likewise. --- 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 -- 2.7.4 diff --git a/string/memcmp.c b/string/memcmp.c index 4fd2f83..82ad082 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 c7e9cc9..1698379 100644 --- a/sysdeps/generic/memcopy.h +++ b/sysdeps/generic/memcopy.h @@ -58,6 +58,7 @@ /* Type to use for aligned memory operations. */ #include +#include #define OPSIZ (sizeof(op_t)) @@ -190,9 +191,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 0000000..17fa627 --- /dev/null +++ b/sysdeps/generic/string-opthr.h @@ -0,0 +1,25 @@ +/* Define a threshold for word access. Generic 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 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 12bb39f..28cee47 100644 --- a/sysdeps/i386/memcopy.h +++ b/sysdeps/i386/memcopy.h @@ -19,9 +19,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 0000000..ed3e4b2 --- /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 58569c6..ee0c5fc 100644 --- a/sysdeps/m68k/memcopy.h +++ b/sysdeps/m68k/memcopy.h @@ -21,9 +21,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 8050abc..37ed40b 100644 --- a/sysdeps/powerpc/powerpc32/power4/memcopy.h +++ b/sysdeps/powerpc/powerpc32/power4/memcopy.h @@ -51,11 +51,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