mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 1/3] i386/memset: argument load code need not be separate
@ 2015-10-12 18:30 Denys Vlasenko
  2015-10-12 18:30 ` [PATCH 2/3] i386/memset: do not fetch fill char from memory again Denys Vlasenko
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Denys Vlasenko @ 2015-10-12 18:30 UTC (permalink / raw)
  To: Rich Felker; +Cc: Denys Vlasenko, musl

"large memset" and "small memset" code paths were using two separate copies
of loads from 8(%esp) and 4(%esp). No need to have this duplication.

While at it, fix whitespace.

   text	   data	    bss	    dec	    hex	filename
    188	      0	      0	    188	     bc	memset.o
    182	      0	      0	    182	     b6	memset1.o

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
CC: Rich Felker <dalias@libc.org>
CC: musl@lists.openwall.com
---
 src/string/i386/memset.s | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/string/i386/memset.s b/src/string/i386/memset.s
index d00422c..d6118c7 100644
--- a/src/string/i386/memset.s
+++ b/src/string/i386/memset.s
@@ -2,11 +2,11 @@
 .type memset,@function
 memset:
 	mov 12(%esp),%ecx
+	movzbl 8(%esp),%edx
+	mov 4(%esp),%eax
 	cmp $62,%ecx
 	ja 2f
 
-	mov 8(%esp),%dl
-	mov 4(%esp),%eax
 	test %ecx,%ecx
 	jz 1f
 
@@ -47,12 +47,11 @@ memset:
 	mov %edx,(-1-2-4-8-8)(%eax,%ecx)
 	mov %edx,(-1-2-4-8-4)(%eax,%ecx)
 
-1:	ret 	
+1:	ret
 
-2:	movzbl 8(%esp),%eax
-	mov %edi,12(%esp)
-	imul $0x1010101,%eax
-	mov 4(%esp),%edi
+2:	mov %edi,12(%esp)
+	mov %eax,%edi
+	imul $0x1010101,%edx,%eax
 	test $15,%edi
 	mov %eax,-4(%edi,%ecx)
 	jnz 2f
@@ -63,7 +62,7 @@ memset:
 	mov 4(%esp),%eax
 	mov 12(%esp),%edi
 	ret
-	
+
 2:	xor %edx,%edx
 	sub %edi,%edx
 	and $15,%edx
-- 
1.8.1.4



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-05  2:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 18:30 [PATCH 1/3] i386/memset: argument load code need not be separate Denys Vlasenko
2015-10-12 18:30 ` [PATCH 2/3] i386/memset: do not fetch fill char from memory again Denys Vlasenko
2015-11-05  2:54   ` Rich Felker
2015-10-12 18:30 ` [PATCH 3/3] i386/memset: move byte-extending IMUL up, drop one insn Denys Vlasenko
2015-10-14 23:20 ` [PATCH 1/3] i386/memset: argument load code need not be separate Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).