From: Denys Vlasenko <vda.linux@googlemail.com>
To: Rich Felker <dalias@libc.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>, musl@lists.openwall.com
Subject: [PATCH 1/3] i386/memset: argument load code need not be separate
Date: Mon, 12 Oct 2015 20:30:32 +0200 [thread overview]
Message-ID: <1444674635-25421-1-git-send-email-vda.linux@googlemail.com> (raw)
"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
next reply other threads:[~2015-10-12 18:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 18:30 Denys Vlasenko [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444674635-25421-1-git-send-email-vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).