Commit 551f4134 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390/lib: improve memmove, memset and memcpy

Improve the memmove implementation to save one instruction and use
better label names. Also use better label names for the memset and
memcpy implementations so everything looks consistent.
Suggested-by: default avatarJens Remus <jremus@linux.vnet.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent e3850ecf
...@@ -14,31 +14,29 @@ ENTRY(memmove) ...@@ -14,31 +14,29 @@ ENTRY(memmove)
ltgr %r4,%r4 ltgr %r4,%r4
lgr %r1,%r2 lgr %r1,%r2
bzr %r14 bzr %r14
aghi %r4,-1
clgr %r2,%r3 clgr %r2,%r3
jnh .Lmemmove_forward jnh .Lmemmove_forward
la %r5,0(%r4,%r3) la %r5,1(%r4,%r3)
clgr %r2,%r5 clgr %r2,%r5
jl .Lmemmove_reverse jl .Lmemmove_reverse
.Lmemmove_forward: .Lmemmove_forward:
aghi %r4,-1
srlg %r0,%r4,8 srlg %r0,%r4,8
ltgr %r0,%r0 ltgr %r0,%r0
jz .Lmemmove_rest jz .Lmemmove_forward_remainder
.Lmemmove_loop: .Lmemmove_forward_loop:
mvc 0(256,%r1),0(%r3) mvc 0(256,%r1),0(%r3)
la %r1,256(%r1) la %r1,256(%r1)
la %r3,256(%r3) la %r3,256(%r3)
brctg %r0,.Lmemmove_loop brctg %r0,.Lmemmove_forward_loop
.Lmemmove_rest: .Lmemmove_forward_remainder:
larl %r5,.Lmemmove_mvc larl %r5,.Lmemmove_mvc
ex %r4,0(%r5) ex %r4,0(%r5)
br %r14 br %r14
.Lmemmove_reverse: .Lmemmove_reverse:
aghi %r4,-1
.Lmemmove_reverse_loop:
ic %r0,0(%r4,%r3) ic %r0,0(%r4,%r3)
stc %r0,0(%r4,%r1) stc %r0,0(%r4,%r1)
brctg %r4,.Lmemmove_reverse_loop brctg %r4,.Lmemmove_reverse
ic %r0,0(%r4,%r3) ic %r0,0(%r4,%r3)
stc %r0,0(%r4,%r1) stc %r0,0(%r4,%r1)
br %r14 br %r14
...@@ -70,12 +68,12 @@ ENTRY(memset) ...@@ -70,12 +68,12 @@ ENTRY(memset)
srlg %r3,%r4,8 srlg %r3,%r4,8
ltgr %r3,%r3 ltgr %r3,%r3
lgr %r1,%r2 lgr %r1,%r2
jz .Lmemset_clear_rest jz .Lmemset_clear_remainder
.Lmemset_clear_loop: .Lmemset_clear_loop:
xc 0(256,%r1),0(%r1) xc 0(256,%r1),0(%r1)
la %r1,256(%r1) la %r1,256(%r1)
brctg %r3,.Lmemset_clear_loop brctg %r3,.Lmemset_clear_loop
.Lmemset_clear_rest: .Lmemset_clear_remainder:
larl %r3,.Lmemset_xc larl %r3,.Lmemset_xc
ex %r4,0(%r3) ex %r4,0(%r3)
br %r14 br %r14
...@@ -87,12 +85,12 @@ ENTRY(memset) ...@@ -87,12 +85,12 @@ ENTRY(memset)
aghi %r4,-2 aghi %r4,-2
srlg %r3,%r4,8 srlg %r3,%r4,8
ltgr %r3,%r3 ltgr %r3,%r3
jz .Lmemset_fill_rest jz .Lmemset_fill_remainder
.Lmemset_fill_loop: .Lmemset_fill_loop:
mvc 1(256,%r1),0(%r1) mvc 1(256,%r1),0(%r1)
la %r1,256(%r1) la %r1,256(%r1)
brctg %r3,.Lmemset_fill_loop brctg %r3,.Lmemset_fill_loop
.Lmemset_fill_rest: .Lmemset_fill_remainder:
larl %r3,.Lmemset_mvc larl %r3,.Lmemset_mvc
ex %r4,0(%r3) ex %r4,0(%r3)
br %r14 br %r14
...@@ -115,7 +113,7 @@ ENTRY(memcpy) ...@@ -115,7 +113,7 @@ ENTRY(memcpy)
ltgr %r5,%r5 ltgr %r5,%r5
lgr %r1,%r2 lgr %r1,%r2
jnz .Lmemcpy_loop jnz .Lmemcpy_loop
.Lmemcpy_rest: .Lmemcpy_remainder:
larl %r5,.Lmemcpy_mvc larl %r5,.Lmemcpy_mvc
ex %r4,0(%r5) ex %r4,0(%r5)
br %r14 br %r14
...@@ -124,7 +122,7 @@ ENTRY(memcpy) ...@@ -124,7 +122,7 @@ ENTRY(memcpy)
la %r1,256(%r1) la %r1,256(%r1)
la %r3,256(%r3) la %r3,256(%r3)
brctg %r5,.Lmemcpy_loop brctg %r5,.Lmemcpy_loop
j .Lmemcpy_rest j .Lmemcpy_remainder
.Lmemcpy_mvc: .Lmemcpy_mvc:
mvc 0(1,%r1),0(%r3) mvc 0(1,%r1),0(%r3)
EXPORT_SYMBOL(memcpy) EXPORT_SYMBOL(memcpy)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment