# Re: \[PATCH 13/19\] LoongArch: Add some library functions

- From: Arnd Bergmann \<arnd@arndb.de\>
- Date: 2021-07-06 10:17:50 
- List: linux-arch
- Page: https://ratatoskr.run/linux-arch/2021/07/13337034
- Thread: https://ratatoskr.run/linux-arch/2021/07/13337006/t.md

```text
On Tue, Jul 6, 2021 at 6:18 AM Huacai Chen [ref] wrote:
>
> +/*
> + * long __strncpy_from_user(char *to, const char *from, long len)
> + *
> + * a0: to
> + * a1: from
> + * a2: len
> + */
> +SYM_FUNC_START(__strncpy_from_user)
> +       move    a3, zero
> +

I doubt this is better than the C version in lib/strncpy_from_user.c

> diff --git a/arch/loongarch/lib/strnlen_user.S b/arch/loongarch/lib/strnlen_user.S
> new file mode 100644
> index 000000000000..9288a5ad294e
> --- /dev/null
> +++ b/arch/loongarch/lib/strnlen_user.S
> @@ -0,0 +1,47 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited
> + */

Same here.

Have you done any measurement to show that the asm version actually helps
here? If not, just use the generic version.


       Arnd
```
