From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3983 Path: news.gmane.org!not-for-mail From: Andre Renaud Newsgroups: gmane.linux.lib.musl.general Subject: Re: Optimized C memset [v2] Date: Wed, 28 Aug 2013 12:05:43 +1200 Message-ID: References: <20130827083020.GA4503@brightrain.aerifal.cx> <20130827162205.GU20515@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 1377648355 19982 80.91.229.3 (28 Aug 2013 00:05:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Aug 2013 00:05:55 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3987-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 28 02:05:58 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1VETGo-0000lF-5Q for gllmg-musl@plane.gmane.org; Wed, 28 Aug 2013 02:05:58 +0200 Original-Received: (qmail 28558 invoked by uid 550); 28 Aug 2013 00:05:57 -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 28550 invoked from network); 28 Aug 2013 00:05:56 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=HNhg5a7K1C321KTHfo2hfSaNbM8gaxr667kSmjviZX0=; b=pCavb8wfDKZE/5lWi9L1bcZRZyIAbOhL72wwTTGwCZIQf7dAnKUWw7FdNp4CdUR2gk DoXc8oMstl7mycqdSv6Gntk6hLaM7cTVOsaRvF5/oc+01X4tu7bi0vjoqhK0b9+57ADa KeurOvr9ZS7y89JgCc5ZxBoSik+GmHbpQFaaPSdmySsu7uq+6A0wlV6P4Q7kd13qKF0E V6AahI8Lnxpj0VIMBXJKrbg8gUst17JxhYdX3nFq4Ms6yyj1YFEMCtGeU1iunEaiO04F UjrLbPDJqVWf2rWG0abUhaVjAR+ldQDf4oQUeb6GhyE3CWOxTbxSYye7jhfTlPT88qQz 22Hw== X-Gm-Message-State: ALoCoQmkNMevHBsi/saz9EIA0ZPGNs5+NsZO9Qwr6M/y3LdGi1fEVK6XJf++2LnGV7i5DAhRftYF X-Received: by 10.58.215.15 with SMTP id oe15mr3977679vec.25.1377648343977; Tue, 27 Aug 2013 17:05:43 -0700 (PDT) In-Reply-To: <20130827162205.GU20515@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:3983 Archived-At: Hi Rich, On 28 August 2013 04:22, Rich Felker wrote: > Here's version 2 (filename version 6, in honor of glibc ;) of the > memset code. I fixed a bug in the logic for coverage of the tail (the > part past what's covered by the loop) for some values of n and > alignments, and cleaned up the __GNUC__ usage a bit to use less > #ifdeffery. The remaining test at the top for the __GNUC__ version is > ugly, I admit, and should possibly just be removed and replaced by a > configure check to add -D__may_alias__= to the CFLAGS if the compiler > defines __GNUC__ but does not recognize __attribute__((__may_alias__)) > -- opinions on this? Can you explain the algorithm a bit - I can't entirely follow the us of negation/masking, but it looks like at the end you're doing a loop of 64-bit aligned writes, but I don't see how it can work if the tail end ends in something that isn't 64-bit aligned? Is this assuming that unaligned writes will work ok? Regards, Andre