123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- From 0dfcc83599765108e12ab6630a16bd27adae2b6a Mon Sep 17 00:00:00 2001
- From: "max.ma" <max.ma@starfivetech.com>
- Date: Thu, 16 Mar 2023 00:22:15 -0700
- Subject: [PATCH 2/2] [RISCV] revert strchrnul/strncmp/strnlen
- ---
- .../riscv/rv64/multiarch/ifunc-impl-list.c | 11 ---
- sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S | 1 -
- sysdeps/riscv/rv64/multiarch/rtld-strncmp.S | 1 -
- sysdeps/riscv/rv64/strchrnul.S | 80 -------------------
- sysdeps/riscv/rv64/strncmp.S | 74 -----------------
- sysdeps/riscv/rv64/strnlen.S | 65 ---------------
- 6 files changed, 232 deletions(-)
- delete mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
- delete mode 100644 sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
- delete mode 100644 sysdeps/riscv/rv64/strchrnul.S
- delete mode 100644 sysdeps/riscv/rv64/strncmp.S
- delete mode 100644 sysdeps/riscv/rv64/strnlen.S
- diff --git a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
- index 7bba6fa30c..07d584deec 100644
- --- a/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
- +++ b/sysdeps/riscv/rv64/multiarch/ifunc-impl-list.c
- @@ -61,17 +61,6 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
- IFUNC_IMPL_ADD (array, i, memset, use_rvv, __memset_vector)
- IFUNC_IMPL_ADD (array, i, memset, 1, __memset_riscv));
-
- - IFUNC_IMPL (i, name, strchr,
- - IFUNC_IMPL_ADD (array, i, strchr, use_rvv, __strchr_riscv)
- - IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_riscv));
- -
- - IFUNC_IMPL (i, name, strchrnul,
- - IFUNC_IMPL_ADD (array, i, strchrnul, use_rvv, __strchrnul_riscv)
- - IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_riscv));
- -
- - IFUNC_IMPL (i, name, strncmp,
- - IFUNC_IMPL_ADD (array, i, strncmp, use_rvv, __strncmp_riscv)
- - IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_riscv));
- #endif
- return i;
- }
- diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S b/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
- deleted file mode 100644
- index 5799994393..0000000000
- --- a/sysdeps/riscv/rv64/multiarch/rtld-strchrnul.S
- +++ /dev/null
- @@ -1 +0,0 @@
- -#include "../strchrnul.S"
- diff --git a/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S b/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
- deleted file mode 100644
- index c5a02a137c..0000000000
- --- a/sysdeps/riscv/rv64/multiarch/rtld-strncmp.S
- +++ /dev/null
- @@ -1 +0,0 @@
- -#include "../strncmp.S"
- diff --git a/sysdeps/riscv/rv64/strchrnul.S b/sysdeps/riscv/rv64/strchrnul.S
- deleted file mode 100644
- index 6cf125cf46..0000000000
- --- a/sysdeps/riscv/rv64/strchrnul.S
- +++ /dev/null
- @@ -1,80 +0,0 @@
- -/* The assembly function for strchrnul. RISC-V 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/>. */
- -
- -#include <sysdep.h>
- -
- - .p2align 6
- -ENTRY (__strchrnul)
- - andi a1, a1, 0xff
- -
- -.Lmisaligned:
- - andi a5, a0, 7
- - beqz a5, .Laligned
- - lbu a5, 0(a0)
- - beq a5, a1, .Ldone
- - beqz a5, .Ldone
- - addi a0, a0, 1
- - j .Lmisaligned
- -
- -.Laligned:
- - slli a5, a1, 0x8
- - or a5, a5, a1
- - slli t0, a5, 0x10
- - or t0, t0, a5
- - slli a5, t0, 0x20
- - or t0, t0, a5
- -
- - li a5, -1
- - addi a0, a0, -8
- - .p2align 3
- -.Lloop:
- - addi a0, a0, 8
- - ld a2, 0(a0)
- - orc.b t1, a2
- - bne t1, a5, .Lnull
- - xor a3, a2, t0
- - orc.b a3, a3
- - bne a3, a5, .Lfind
- - orc.b a2, a2
- - beq a2, a5, .Lloop
- -
- -.Ldone:
- - ret
- -
- -.Lfind:
- - not a3, a3
- - ctz a3, a3
- - srli a3, a3, 3
- - add a0, a0, a3
- - ret
- -
- -# cases in which a null byte was detected
- -.Lnull:
- - bne a2, t0, .Lend
- - j .Lfind
- -
- -.Lend:
- - lbu a5, 0(a0)
- - beq a5, a1, .Ldone
- - beqz a5, .Ldone
- - addi a0, a0, 1
- - j .Lend
- -
- -END (__strchrnul)
- -weak_alias (__strchrnul,strchrnul)
- -libc_hidden_builtin_def (__strchrnul)
- \ No newline at end of file
- diff --git a/sysdeps/riscv/rv64/strncmp.S b/sysdeps/riscv/rv64/strncmp.S
- deleted file mode 100644
- index 200bee4fe1..0000000000
- --- a/sysdeps/riscv/rv64/strncmp.S
- +++ /dev/null
- @@ -1,74 +0,0 @@
- -/* The assembly function for strncmp. RISC-V 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/>. */
- -
- -#include <sysdep.h>
- -
- - .p2align 6
- -ENTRY (strncmp)
- - beqz a2, .Lequal
- - or a4, a0, a1
- - li t2, -1
- - and a4, a4, 7
- - beqz a4, .Lenter
- - j .Lmisaligned
- -
- - .p2align 3
- -.Lloop:
- - addi a0, a0, 8
- - addi a1, a1, 8
- - addi a2, a2, -8
- -
- -.Lenter:
- - addi a5, a2, -8
- - blez a5, .Lmisaligned
- - ld a3, 0(a0)
- - ld a4, 0(a1)
- - orc.b t0, a3
- - bne t0, t2, .Lnull
- - beq a3, a4, .Lloop
- - rev8 a6, a3
- - rev8 a7, a4
- - bgeu a6, a7, 1f
- - li a0, -1
- - ret
- -1:
- - li a0, 1
- - ret
- -
- -.Lmisaligned:
- - blez a2, .Ldone
- - lbu a3, 0(a0)
- - lbu a4, 0(a1)
- - addi a0, a0, 1
- - addi a1, a1, 1
- - addi a2, a2, -1
- - bne a3, a4, .Ldone
- - bnez a3, .Lmisaligned
- -.Ldone:
- - sub a0, a3, a4
- - ret
- -
- -# cases in which a null byte was detected
- -.Lnull:
- - bne a3, a4, .Lmisaligned
- -.Lequal:
- - li a0, 0
- - ret
- -
- -END (strncmp)
- -libc_hidden_builtin_def (strncmp)
- \ No newline at end of file
- diff --git a/sysdeps/riscv/rv64/strnlen.S b/sysdeps/riscv/rv64/strnlen.S
- deleted file mode 100644
- index 502f108710..0000000000
- --- a/sysdeps/riscv/rv64/strnlen.S
- +++ /dev/null
- @@ -1,65 +0,0 @@
- -/* The assembly function for strnlen. RISC-V 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/>. */
- -
- -#include <sysdep.h>
- -
- - .p2align 6
- -ENTRY (__strnlen)
- - mv a2, a0
- - mv a0, a1
- - li a3, -1
- - beqz a1, .Ldone
- - add a0, a2, a1
- - bleu a2, a0, 1f
- - li a0, -1
- -1:
- - mv a5, a2
- -
- -.Lmisaligned:
- - andi a4, a5, 7
- - beqz a4, .Lloop
- - lbu a4, 0(a5)
- - beqz a4, .Llenth
- - addi a5, a5, 1
- - j .Lmisaligned
- -.p2align 3
- -.Laligned:
- - addi a5, a5, 8
- - addi a1, a1, -8
- -.Lloop:
- - bleu a1, x0, .Llenth
- - ld a4, 0(a5)
- - orc.b a4, a4
- - beq a4, a3, .Laligned
- - not a4, a4
- - ctz a4, a4
- - srli a4, a4, 3
- - add a5, a5, a4
- -.Llenth:
- - minu a5, a5, a0
- - sub a0, a5, a2
- -.Ldone:
- - ret
- -
- -END (__strnlen)
- -
- -#ifndef STRNLEN
- -libc_hidden_def (__strnlen)
- -weak_alias (__strnlen, strnlen)
- -#endif
- -libc_hidden_def (strnlen)
- --
- 2.25.1
|