From: Carlos O'Donell <carlos@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v5 02/17] Parameterize OP_T_THRES from memcopy.h
Date: Tue, 20 Sep 2022 06:49:38 -0400 [thread overview]
Message-ID: <YymawrivZblFTQHt@fedora> (raw)
In-Reply-To: <20220919195920.956393-3-adhemerval.zanella@linaro.org>
On Mon, Sep 19, 2022 at 04:59:05PM -0300, Adhemerval Zanella via Libc-alpha wrote:
> From: Richard Henderson <rth@twiddle.net>
>
> 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.
This is a generic refactor which I think can go in regardless.
We can always reorganize again if we end up wtih too many split headers
and want to talk about unrolling in different contexts.
LGTM.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> 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 <string-optype.h>
> +#include <string-opthr.h>
> #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
> + <http://www.gnu.org/licenses/>. */
> +
> +#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 <sysdeps/generic/memcopy.h>
>
> -#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
> + <http://www.gnu.org/licenses/>. */
> +
> +#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
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-09-20 10:49 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-19 19:59 [PATCH v5 00/17] Improve generic string routines Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 01/17] Parameterize op_t from memcopy.h Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 02/17] Parameterize OP_T_THRES " Adhemerval Zanella
2022-09-20 10:49 ` Carlos O'Donell [this message]
2022-09-19 19:59 ` [PATCH v5 03/17] Add string-maskoff.h generic header Adhemerval Zanella
2022-09-20 11:43 ` Carlos O'Donell
2022-09-22 17:31 ` Adhemerval Zanella Netto
2023-01-05 22:49 ` Noah Goldstein
2023-01-05 23:26 ` Alejandro Colomar
2023-01-09 18:19 ` Adhemerval Zanella Netto
2023-01-09 18:02 ` Adhemerval Zanella Netto
2022-09-19 19:59 ` [PATCH v5 04/17] Add string vectorized find and detection functions Adhemerval Zanella
2023-01-05 22:53 ` Noah Goldstein
2023-01-09 18:51 ` Adhemerval Zanella Netto
2023-01-05 23:04 ` Noah Goldstein
2023-01-09 19:34 ` Adhemerval Zanella Netto
2022-09-19 19:59 ` [PATCH v5 05/17] string: Improve generic strlen Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 06/17] string: Improve generic strnlen Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 07/17] string: Improve generic strchr Adhemerval Zanella
2023-01-05 23:09 ` Noah Goldstein
2023-01-05 23:19 ` Noah Goldstein
2023-01-09 19:39 ` Adhemerval Zanella Netto
2022-09-19 19:59 ` [PATCH v5 08/17] string: Improve generic strchrnul Adhemerval Zanella
2023-01-05 23:17 ` Noah Goldstein
2023-01-09 20:35 ` Adhemerval Zanella Netto
2023-01-09 20:49 ` Richard Henderson
2023-01-09 20:59 ` Noah Goldstein
2023-01-09 21:01 ` Noah Goldstein
2023-01-09 23:33 ` Richard Henderson
2023-01-10 14:18 ` Adhemerval Zanella Netto
2023-01-10 16:24 ` Richard Henderson
2023-01-10 17:16 ` Noah Goldstein
2023-01-10 18:19 ` Adhemerval Zanella Netto
2023-01-10 17:17 ` Noah Goldstein
2023-01-10 18:16 ` Adhemerval Zanella Netto
2022-09-19 19:59 ` [PATCH v5 09/17] string: Improve generic strcmp Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 10/17] string: Improve generic memchr Adhemerval Zanella
2023-01-05 23:47 ` Noah Goldstein
2023-01-09 20:50 ` Adhemerval Zanella Netto
2023-01-05 23:49 ` Noah Goldstein
2023-01-09 20:51 ` Adhemerval Zanella Netto
2023-01-09 21:26 ` Noah Goldstein
2023-01-10 14:33 ` Adhemerval Zanella Netto
2022-09-19 19:59 ` [PATCH v5 11/17] string: Improve generic memrchr Adhemerval Zanella
2023-01-05 23:51 ` Noah Goldstein
2022-09-19 19:59 ` [PATCH v5 12/17] hppa: Add memcopy.h Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 13/17] hppa: Add string-fzb.h and string-fzi.h Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 14/17] alpha: " Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 15/17] arm: Add string-fza.h Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 16/17] powerpc: " Adhemerval Zanella
2022-09-19 19:59 ` [PATCH v5 17/17] sh: Add string-fzb.h Adhemerval Zanella
2022-12-05 17:07 ` [PATCH v5 00/17] Improve generic string routines Xi Ruoyao
2023-01-05 21:56 ` Adhemerval Zanella Netto
2023-01-05 23:52 ` Noah Goldstein
2023-01-06 13:43 ` Adhemerval Zanella Netto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YymawrivZblFTQHt@fedora \
--to=carlos@redhat.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).