From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8651 Path: news.gmane.org!not-for-mail From: Denys Vlasenko Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 1/3] i386/memset: argument load code need not be separate Date: Mon, 12 Oct 2015 20:30:32 +0200 Message-ID: <1444674635-25421-1-git-send-email-vda.linux@googlemail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1444674657 22523 80.91.229.3 (12 Oct 2015 18:30:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Oct 2015 18:30:57 +0000 (UTC) Cc: Denys Vlasenko , musl@lists.openwall.com To: Rich Felker Original-X-From: musl-return-8663-gllmg-musl=m.gmane.org@lists.openwall.com Mon Oct 12 20:30:56 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Zlhs5-0006tT-Lq for gllmg-musl@m.gmane.org; Mon, 12 Oct 2015 20:30:53 +0200 Original-Received: (qmail 7834 invoked by uid 550); 12 Oct 2015 18:30:51 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 7816 invoked from network); 12 Oct 2015 18:30:50 -0000 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Xref: news.gmane.org gmane.linux.lib.musl.general:8651 Archived-At: "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 CC: Rich Felker 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