|
|
Message-Id: <1444674635-25421-1-git-send-email-vda.linux@googlemail.com>
Date: Mon, 12 Oct 2015 20:30:32 +0200
From: Denys Vlasenko <vda.linux@...glemail.com>
To: Rich Felker <dalias@...c.org>
Cc: Denys Vlasenko <vda.linux@...glemail.com>, musl@...ts.openwall.com
Subject: [PATCH 1/3] i386/memset: argument load code need not be separate
"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@...glemail.com>
CC: Rich Felker <dalias@...c.org>
CC: musl@...ts.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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.