Re: [PATCH 07/12] RISC-V: memcpy() size optimized version: Replace lb with lbu

Kito Cheng <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CA+yXCZAges6y3hkqk_ZVxmLCCkN1yTEcD9diTx0HuM8mowLwUA@mail.gmail.com>
Although I think it's no difference, but maybe some arch may have
higher cost to doing the sign-extension, so LGTM

On Wed, Apr 9, 2025 at 2:59 PM m fally <[email protected]> wrote:
>
> From: Mahmoud Abumandour <[email protected]>
>
> Replace lb with lbu to avoid unnecessary sign extension.
>
> Reviewed-by: Christian Herber <[email protected]>
> Signed-off-by: Mahmoud Abumandour <[email protected]>
> ---
>  newlib/libc/machine/riscv/memcpy-asm.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/newlib/libc/machine/riscv/memcpy-asm.S b/newlib/libc/machine/riscv/memcpy-asm.S
> index 5571e4704..d05ff5055 100644
> --- a/newlib/libc/machine/riscv/memcpy-asm.S
> +++ b/newlib/libc/machine/riscv/memcpy-asm.S
> @@ -18,7 +18,7 @@ memcpy:
>    beqz a2, 2f
>
>  1:
> -  lb t2, 0(a1)
> +  lbu t2, 0(a1)
>    sb t2, 0(t1)
>    add   a2, a2, -1
>    add   t1, t1, 1
> --
> 2.49.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.