Replace add instructions with addi where applicable in
the size optimized versions of memmove(), memset(), memcpy(),
and strcmp(). This change does not affect the functions themselves
and is only done to improve syntactic accuracy.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
---
newlib/libc/machine/riscv/memcpy-asm.S | 6 +++---
newlib/libc/machine/riscv/memmove.S | 2 +-
newlib/libc/machine/riscv/memset.S | 4 ++--
newlib/libc/machine/riscv/strcmp.S | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
@@ -20,9 +20,9 @@ memcpy:
1:
lbu a4, 0(a1)
sb a4, 0(a3)
- add a2, a2, -1
- add a3, a3, 1
- add a1, a1, 1
+ addi a2, a2, -1
+ addi a3, a3, 1
+ addi a1, a1, 1
bnez a2, 1b
2:
@@ -29,7 +29,7 @@ memmove:
add a1, a1, a3
.Lcopy:
lbu a5, 0(a1)
- add a2, a2, -1 /* copy bytes as long as a2 (= the number of bytes to be copied) > 0. the increment is done here to relax the RAW dependency between load and store */
+ addi a2, a2, -1 /* copy bytes as long as a2 (= the number of bytes to be copied) > 0. the increment is done here to relax the RAW dependency between load and store */
sb a5, 0(a4)
bnez a2, .Lincrement
@@ -19,8 +19,8 @@ memset:
.Lset:
sb a1, 0(a3)
- add a2, a2, -1
- add a3, a3, 1
+ addi a2, a2, -1
+ addi a3, a3, 1
bnez a2, .Lset
.Ldone:
@@ -19,8 +19,8 @@ strcmp:
1:
lbu a2, 0(a0)
lbu a3, 0(a1)
- add a0, a0, 1
- add a1, a1, 1
+ addi a0, a0, 1
+ addi a1, a1, 1
bne a2, a3, 2f
bnez a2, 1b