]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Parameterize OP_T_THRES from memcopy.h
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 10 Jan 2023 21:00:51 +0000 (18:00 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 6 Feb 2023 19:19:35 +0000 (16:19 -0300)
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 <adhemerval.zanella@linaro.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
string/memcmp.c
sysdeps/generic/memcopy.h
sysdeps/generic/string-opthr.h [new file with mode: 0644]
sysdeps/i386/memcopy.h
sysdeps/i386/string-opthr.h [new file with mode: 0644]
sysdeps/m68k/memcopy.h
sysdeps/powerpc/powerpc32/power4/memcopy.h

index ea0fa03e1c8fbe937c683e4eb9d79ece6e3eb8ad..047ca4f98e0d158e6e26bf5d2eab08d6f2afd47d 100644 (file)
@@ -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;
 
index b5ffa4d114765419f54e50aee7847c71367d2f18..e9b3f227b2ff4122d954a3f03373bdfb2904dc62 100644 (file)
@@ -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 (file)
index 0000000..6f10a98
--- /dev/null
@@ -0,0 +1,25 @@
+/* Define a threshold for word access.  Generic 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
+   <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 */
index 4f82689b848f3832da9a3849491c59057665c2cf..1aa7c3a8502a095ac3cd8e136bd4b18c5cad94ca 100644 (file)
@@ -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 (file)
index 0000000..ed3e4b2
--- /dev/null
@@ -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 */
index accd81c1c3e4058e194dae5f5a82139df917167c..610577071d435aaedfb7e2893d11b443b6d960fc 100644 (file)
@@ -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.  */
 
index 384f33b02956c6b433448144e4bbcbe517177423..872157e48594284d26c31132dd876389463174eb 100644 (file)
      [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