diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-02-10 12:51:24 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-02-23 14:18:18 -0300 |
commit | a61933fe27dff18f274b39f46dde7e739696d4cb (patch) | |
tree | 784fe0126badb70d36a09772bceee7167e9e7eeb /sysdeps | |
parent | c0d215f162049e7ab8e86e9d2d76c87e41a55ebd (diff) | |
download | glibc-a61933fe27dff18f274b39f46dde7e739696d4cb.tar.gz glibc-a61933fe27dff18f274b39f46dde7e739696d4cb.tar.xz glibc-a61933fe27dff18f274b39f46dde7e739696d4cb.zip |
sparc: Remove bzero optimization
The symbol is not present in current POSIX specification and compiler already generates memset call.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/sparc/sparc32/bzero.c | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/memset.S | 37 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/sparcv9/bzero.c | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/sparcv9/multiarch/bzero.c | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/bzero.c | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/memset.S | 30 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/multiarch/bzero.c | 33 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c | 9 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/multiarch/ifunc-memset.h | 2 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/multiarch/memset-niagara1.S | 5 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/multiarch/memset-niagara4.S | 6 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/multiarch/memset-niagara7.S | 7 | ||||
-rw-r--r-- | sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 |
14 files changed, 30 insertions, 105 deletions
diff --git a/sysdeps/sparc/sparc32/bzero.c b/sysdeps/sparc/sparc32/bzero.c deleted file mode 100644 index 37f0f6f993..0000000000 --- a/sysdeps/sparc/sparc32/bzero.c +++ /dev/null @@ -1 +0,0 @@ -/* bzero is in memset.S */ diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S index d222fa7506..b1b67cb2d1 100644 --- a/sysdeps/sparc/sparc32/memset.S +++ b/sysdeps/sparc/sparc32/memset.S @@ -42,25 +42,6 @@ .text .align 4 -ENTRY(__bzero) - b 1f - mov %g0, %g3 - -3: cmp %o2, 3 - be 2f - stb %g3, [%o0] - - cmp %o2, 2 - be 2f - stb %g3, [%o0 + 0x01] - - stb %g3, [%o0 + 0x02] -2: sub %o2, 4, %o2 - add %o1, %o2, %o1 - b 4f - sub %o0, %o2, %o0 -END(__bzero) - ENTRY(memset) and %o1, 0xff, %g3 sll %g3, 8, %g2 @@ -73,7 +54,7 @@ ENTRY(memset) mov %o0, %g1 andcc %o0, 3, %o2 - bne 3b + bne 3f 4: andcc %o0, 4, %g0 be 2f @@ -146,7 +127,19 @@ ENTRY(memset) stb %g3, [%o0 + 6] 0: retl nop + +3: cmp %o2, 3 + be 2f + stb %g3, [%o0] + + cmp %o2, 2 + be 2f + stb %g3, [%o0 + 0x01] + + stb %g3, [%o0 + 0x02] +2: sub %o2, 4, %o2 + add %o1, %o2, %o1 + b 4b + sub %o0, %o2, %o0 END(memset) libc_hidden_builtin_def (memset) - -weak_alias (__bzero, bzero) diff --git a/sysdeps/sparc/sparc32/sparcv9/bzero.c b/sysdeps/sparc/sparc32/sparcv9/bzero.c deleted file mode 100644 index 37f0f6f993..0000000000 --- a/sysdeps/sparc/sparc32/sparcv9/bzero.c +++ /dev/null @@ -1 +0,0 @@ -/* bzero is in memset.S */ diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/bzero.c b/sysdeps/sparc/sparc32/sparcv9/multiarch/bzero.c deleted file mode 100644 index cf6803ef44..0000000000 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/bzero.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/sparc/sparc64/multiarch/bzero.c> diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S index 6038611134..2dda6f1ed6 100644 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S +++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S @@ -25,6 +25,5 @@ # define weak_alias(x, y) # define memset __memset_ultra1 -# define __bzero __bzero_ultra1 # include <sysdeps/sparc/sparc32/sparcv9/memset.S> #endif diff --git a/sysdeps/sparc/sparc64/bzero.c b/sysdeps/sparc/sparc64/bzero.c deleted file mode 100644 index 37f0f6f993..0000000000 --- a/sysdeps/sparc/sparc64/bzero.c +++ /dev/null @@ -1 +0,0 @@ -/* bzero is in memset.S */ diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S index a7f8361fa3..33ecbc93fe 100644 --- a/sysdeps/sparc/sparc64/memset.S +++ b/sysdeps/sparc/sparc64/memset.S @@ -31,6 +31,16 @@ stx source, [base - offset - 0x08]; \ stx source, [base - offset - 0x00]; +#define ZERO_BLOCKS(base, offset, source) \ + stx source, [base - offset - 0x38]; \ + stx source, [base - offset - 0x30]; \ + stx source, [base - offset - 0x28]; \ + stx source, [base - offset - 0x20]; \ + stx source, [base - offset - 0x18]; \ + stx source, [base - offset - 0x10]; \ + stx source, [base - offset - 0x08]; \ + stx source, [base - offset - 0x00]; + /* Well, memset is a lot easier to get right than bcopy... */ .text .align 32 @@ -174,22 +184,7 @@ ENTRY(memset) nop ba,pt %xcc, 18b ldd [%o0], %f0 -END(memset) -libc_hidden_builtin_def (memset) -#define ZERO_BLOCKS(base, offset, source) \ - stx source, [base - offset - 0x38]; \ - stx source, [base - offset - 0x30]; \ - stx source, [base - offset - 0x28]; \ - stx source, [base - offset - 0x20]; \ - stx source, [base - offset - 0x18]; \ - stx source, [base - offset - 0x10]; \ - stx source, [base - offset - 0x08]; \ - stx source, [base - offset - 0x00]; - - .text - .align 32 -ENTRY(__bzero) #ifndef USE_BPR srl %o1, 0, %o1 #endif @@ -307,6 +302,5 @@ ENTRY(__bzero) stb %g0, [%o0 - 1] 0: retl mov %o5, %o0 -END(__bzero) - -weak_alias (__bzero, bzero) +END(memset) +libc_hidden_builtin_def (memset) diff --git a/sysdeps/sparc/sparc64/multiarch/bzero.c b/sysdeps/sparc/sparc64/multiarch/bzero.c deleted file mode 100644 index 409d66a864..0000000000 --- a/sysdeps/sparc/sparc64/multiarch/bzero.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Multiple versions of bzero. SPARC64/Linux version. - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2017-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 - <https://www.gnu.org/licenses/>. */ - -#if IS_IN (libc) -# define bzero __redirect_bzero -# include <string.h> -# undef bzero - -# include <sparc-ifunc.h> - -# define SYMBOL_NAME bzero -# include "ifunc-memset.h" - -sparc_libc_ifunc_redirected (__redirect_bzero, __bzero, IFUNC_SELECTOR) -weak_alias (__bzero, bzero) - -#endif diff --git a/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c b/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c index 05926e605b..9be12f9130 100644 --- a/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c +++ b/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c @@ -61,15 +61,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, __mempcpy_ultra3) IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_ultra1)); - IFUNC_IMPL (i, name, bzero, - IFUNC_IMPL_ADD (array, i, bzero, hwcap & HWCAP_SPARC_ADP, - __bzero_niagara7) - IFUNC_IMPL_ADD (array, i, bzero, hwcap & HWCAP_SPARC_CRYPTO, - __bzero_niagara4) - IFUNC_IMPL_ADD (array, i, bzero, hwcap & HWCAP_SPARC_BLKINIT, - __bzero_niagara1) - IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ultra1)); - IFUNC_IMPL (i, name, memset, IFUNC_IMPL_ADD (array, i, memset, hwcap & HWCAP_SPARC_ADP, __memset_niagara7) diff --git a/sysdeps/sparc/sparc64/multiarch/ifunc-memset.h b/sysdeps/sparc/sparc64/multiarch/ifunc-memset.h index 56893b6883..0a2f16b3f1 100644 --- a/sysdeps/sparc/sparc64/multiarch/ifunc-memset.h +++ b/sysdeps/sparc/sparc64/multiarch/ifunc-memset.h @@ -1,4 +1,4 @@ -/* Common definition for memset/bzero implementation. +/* Common definition for memset implementation. All versions must be listed in ifunc-impl-list.c. Copyright (C) 2017-2022 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/sysdeps/sparc/sparc64/multiarch/memset-niagara1.S b/sysdeps/sparc/sparc64/multiarch/memset-niagara1.S index 13432effc1..7865691eca 100644 --- a/sysdeps/sparc/sparc64/multiarch/memset-niagara1.S +++ b/sysdeps/sparc/sparc64/multiarch/memset-niagara1.S @@ -45,9 +45,6 @@ ENTRY(__memset_niagara1) sllx %o2, 32, %g1 ba,pt %XCC, 1f or %g1, %o2, %o2 -END(__memset_niagara1) - -ENTRY(__bzero_niagara1) clr %o2 1: # ifndef USE_BRP @@ -171,6 +168,6 @@ ENTRY(__bzero_niagara1) 90: retl mov %o3, %o0 -END(__bzero_niagara1) +END(__memset_niagara1) #endif diff --git a/sysdeps/sparc/sparc64/multiarch/memset-niagara4.S b/sysdeps/sparc/sparc64/multiarch/memset-niagara4.S index 1ccf24e516..d6fbd83009 100644 --- a/sysdeps/sparc/sparc64/multiarch/memset-niagara4.S +++ b/sysdeps/sparc/sparc64/multiarch/memset-niagara4.S @@ -39,10 +39,6 @@ ENTRY(__memset_niagara4) sllx %o2, 32, %g1 ba,pt %icc, 1f or %g1, %o2, %o4 -END(__memset_niagara4) - - .align 32 -ENTRY(__bzero_niagara4) clr %o4 1: cmp %o1, 16 ble %icc, .Ltiny @@ -118,6 +114,6 @@ ENTRY(__bzero_niagara4) bne,pt %icc, 1b add %o0, 0x30, %o0 ba,a,pt %icc, .Lpostloop -END(__bzero_niagara4) +END(__memset_niagara4) #endif diff --git a/sysdeps/sparc/sparc64/multiarch/memset-niagara7.S b/sysdeps/sparc/sparc64/multiarch/memset-niagara7.S index 491b203ff9..6fcbf56675 100644 --- a/sysdeps/sparc/sparc64/multiarch/memset-niagara7.S +++ b/sysdeps/sparc/sparc64/multiarch/memset-niagara7.S @@ -99,13 +99,6 @@ .text .align 32 -ENTRY(__bzero_niagara7) - /* bzero (dst, size) */ - mov %o1, %o2 - mov 0, %o1 - /* fall through into memset code */ -END(__bzero_niagara7) - ENTRY(__memset_niagara7) /* memset (src, c, size) */ mov %o0, %o5 /* copy sp1 before using it */ diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S index e0d3424307..3c3add791e 100644 --- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S +++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S @@ -25,6 +25,5 @@ # define weak_alias(x, y) # define memset __memset_ultra1 -# define __bzero __bzero_ultra1 # include <sysdeps/sparc/sparc64/memset.S> #endif |