From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7096 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: Draft of improved memset.s for i386 Date: Tue, 24 Feb 2015 00:36:45 -0500 Message-ID: <20150224053645.GI23507@brightrain.aerifal.cx> References: <20150224010952.GA10683@brightrain.aerifal.cx> <20150224031811.GH23507@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1424756235 30224 80.91.229.3 (24 Feb 2015 05:37:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2015 05:37:15 +0000 (UTC) Cc: musl To: Denys Vlasenko Original-X-From: musl-return-7109-gllmg-musl=m.gmane.org@lists.openwall.com Tue Feb 24 06:37:07 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 1YQ8B8-0007z0-9w for gllmg-musl@m.gmane.org; Tue, 24 Feb 2015 06:37:06 +0100 Original-Received: (qmail 26077 invoked by uid 550); 24 Feb 2015 05:37:04 -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 26021 invoked from network); 24 Feb 2015 05:36:58 -0000 Content-Disposition: inline In-Reply-To: <20150224031811.GH23507@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:7096 Archived-At: On Mon, Feb 23, 2015 at 10:18:11PM -0500, Rich Felker wrote: > On Tue, Feb 24, 2015 at 04:06:06AM +0100, Denys Vlasenko wrote: > > On Tue, Feb 24, 2015 at 4:02 AM, Denys Vlasenko > > wrote: > > > On Tue, Feb 24, 2015 at 2:09 AM, Rich Felker wrote: > > >> mov %edi,12(%esp) > > > > > > Shouldn't this be "mov 12(%esp),%edi"? > > > It's a load of dst pointer from stack, right? > > > > Erm... no it is not, 12(%esp) is size param. > > > > Looks like this insn serves no purpose? > > This will simply trash size param on stack, > > since %edi is not initialized. > > The purpose is saving %edi, since %edi is not call-clobbered on the > i386 ABI. I'm just storing it over top of an argument we already > loaded (argument space belongs to the callee per the ABI) instead of > adjusting the stack pointer. But I'm missing the instruction to restore it before return. Based on your comment about an immediate in the imul, it might make more sense just to load the dest addr into edx rather than edi, then schedule push at a reasonable place and pop at the end. The sub $4,%edi can then be replaced with a lea -4(%edx),%edi. Rich