[10/12] RISC-V: memset() size optimized version: Rename local labels

Message ID 20250409064701.3435-11-marlene.fally@gmail.com
State New
Headers
Series newlib: RISC-V: Optimize memory and string functions for code size |

Commit Message

m fally April 9, 2025, 6:46 a.m. UTC
  Rename local labels to improve readability.

Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
---
 newlib/libc/machine/riscv/memset.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Kito Cheng April 9, 2025, 7:22 a.m. UTC | #1
LGTM, thanks, that made the code more readable :)

On Wed, Apr 9, 2025 at 2:52 PM m fally <marlene.fally@gmail.com> wrote:
>
> Rename local labels to improve readability.
>
> Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
> Signed-off-by: m fally <marlene.fally@gmail.com>
> ---
>  newlib/libc/machine/riscv/memset.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/newlib/libc/machine/riscv/memset.S b/newlib/libc/machine/riscv/memset.S
> index fac0f73a2..943835dc5 100644
> --- a/newlib/libc/machine/riscv/memset.S
> +++ b/newlib/libc/machine/riscv/memset.S
> @@ -15,15 +15,15 @@
>  memset:
>  #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
>    mv a3, a0
> -  beqz a2, 2f
> +  beqz a2, .Ldone
>
> -1:
> +.Lset:
>    sb a1, 0(a3)
>    add   a2, a2, -1
>    add   a3, a3, 1
> -  bnez a2, 1b
> +  bnez a2, .Lset
>
> -2:
> +.Ldone:
>    ret
>
>  #else
> --
> 2.49.0
>
  

Patch

diff --git a/newlib/libc/machine/riscv/memset.S b/newlib/libc/machine/riscv/memset.S
index fac0f73a2..943835dc5 100644
--- a/newlib/libc/machine/riscv/memset.S
+++ b/newlib/libc/machine/riscv/memset.S
@@ -15,15 +15,15 @@ 
 memset:
 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
   mv a3, a0
-  beqz a2, 2f
+  beqz a2, .Ldone
 
-1:
+.Lset:
   sb a1, 0(a3)
   add   a2, a2, -1
   add   a3, a3, 1
-  bnez a2, 1b
+  bnez a2, .Lset
 
-2:
+.Ldone:
   ret
 
 #else