From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7027 Path: news.gmane.org!not-for-mail From: Denys Vlasenko Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH 1/2] x86_64/memset: avoid multiply insn if possible Date: Fri, 13 Feb 2015 17:38:45 +0100 Message-ID: References: <1423761423-30050-1-git-send-email-vda.linux@googlemail.com> <20150212172735.GX23507@brightrain.aerifal.cx> <20150213072436.GD23507@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1423845563 15176 80.91.229.3 (13 Feb 2015 16:39:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Feb 2015 16:39:23 +0000 (UTC) To: musl Original-X-From: musl-return-7040-gllmg-musl=m.gmane.org@lists.openwall.com Fri Feb 13 17:39:22 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 1YMJH0-0007Qh-8S for gllmg-musl@m.gmane.org; Fri, 13 Feb 2015 17:39:22 +0100 Original-Received: (qmail 26573 invoked by uid 550); 13 Feb 2015 16:39:20 -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 26520 invoked from network); 13 Feb 2015 16:39:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=bDq0ZV/Uw/vLKmDh1A91NZnd2tnRY6ILUbH/4uMTpmM=; b=UhtzZfjz63trIUXkps1U8dzBXZuYcGr+0Iwtnxlz7hlOAZFaYe3ESvYpz6n9ZwjRNW 1TcOH/8KDIc1eBer6qzdWoNWuk7AtkJzGn+Wb8Py/R6KEnsyS6SnudhGKFZsSBFjI1jq aWlDeNsQJ/nq4B4QRk6smFovjzak/PAf4a4Pt6wiFNjb6pXM55eaY110IsJxM6RxVqGS s/fr6Nsg6c7h8gDjmXzUCPDE/qn7PE+onytzWFciMYdf5ZwHwdAkcQWWzx2/mJkCLTD2 aWuF6rNbY0V5ZlE7nYUWdBlK3hilAQoIT/T27Ryvk6vnHuaQxplC5kTYtDPXBQ+jfQz0 E4Mw== X-Received: by 10.140.150.16 with SMTP id 16mr1454280qhw.67.1423845545569; Fri, 13 Feb 2015 08:39:05 -0800 (PST) In-Reply-To: <20150213072436.GD23507@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:7027 Archived-At: On Fri, Feb 13, 2015 at 8:24 AM, Rich Felker wrote: > On Thu, Feb 12, 2015 at 09:36:26PM +0100, Denys Vlasenko wrote: > In practice it performs quite well. x86's are good at this. The > generic C code in memset.c does not do any overlapping writes of > different sizes for the short buffer code path -- all writes there are > single-byte, and multiple-write only happens for some of the inner > bytes depending on the value of n. Measurements agree: I was not able to make it faster by doing it differently. I did find it possible to extend your trick to be usable for up to 30 byte blocks. Sending the patch...