sparc: Remove bzero optimization

The symbol is not present in current POSIX specification and compiler
already generates memset call.
This commit is contained in:
Adhemerval Zanella 2022-02-10 12:51:24 -03:00
parent c0d215f162
commit a61933fe27
14 changed files with 30 additions and 105 deletions

View File

@ -1 +0,0 @@
/* bzero is in memset.S */

View File

@ -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)

View File

@ -1 +0,0 @@
/* bzero is in memset.S */

View File

@ -1 +0,0 @@
#include <sysdeps/sparc/sparc64/multiarch/bzero.c>

View File

@ -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

View File

@ -1 +0,0 @@
/* bzero is in memset.S */

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -25,6 +25,5 @@
# define weak_alias(x, y)
# define memset __memset_ultra1
# define __bzero __bzero_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif