From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Allister MacLeod Newsgroups: gmane.lisp.guile.user Subject: OT: x86 assembly timings/size (was Re: Does anyone have a better scm_string_hash ?) Date: Mon, 17 Nov 2003 14:17:48 -0500 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <20031117191748.GA28701@mv3d.com> References: <8765hnf308.fsf@zagadka.ping.de> <1068823738.13123.54.camel@localhost> <20031114155148.GI16650@powergnu.laas.fr> <1069058032.1638.21.camel@localhost> <874qx3rogk.fsf@zagadka.ping.de> <87u153q8yk.fsf@zagadka.ping.de> <87n0avq7pf.fsf@zagadka.ping.de> <20031117164819.GA28322@mv3d.com> <878ymeri6x.fsf@zagadka.ping.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1069096920 17634 80.91.224.253 (17 Nov 2003 19:22:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2003 19:22:00 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Nov 17 20:21:57 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ALowf-0000ad-00 for ; Mon, 17 Nov 2003 20:21:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ALpt9-00053f-Bl for guile-user@m.gmane.org; Mon, 17 Nov 2003 15:22:23 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ALpqg-0004cN-9d for guile-user@gnu.org; Mon, 17 Nov 2003 15:19:50 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ALpq9-0004MV-RO for guile-user@gnu.org; Mon, 17 Nov 2003 15:19:48 -0500 Original-Received: from [24.218.48.114] (helo=mv3d.com) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ALpq7-0004LG-9d for guile-user@gnu.org; Mon, 17 Nov 2003 15:19:15 -0500 Original-Received: by yogmoth (Postfix, from userid 1000) id 9501D1200B0; Mon, 17 Nov 2003 14:17:48 -0500 (EST) Original-To: guile-user@gnu.org Mail-Followup-To: guile-user@gnu.org Content-Disposition: inline In-Reply-To: <878ymeri6x.fsf@zagadka.ping.de> User-Agent: Mutt/1.5.4i X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2404 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2404 On Mon, Nov 17, 2003 at 06:57:58PM +0100, Marius Vollmer wrote: > Allister MacLeod writes: > > I assume from your pleased comments that > > assign-from-plus-and-multiply is sufficiently fast > "x =3D h + h*8" is in reality "lea (%edi,%edi,8),%edx" which is not a > general multiply-add. Ok.. judging from that, I'd guess that x86 has a set of instructions of the form: "lea (R1,R2,N),D" where R1, R2, and D are registers, and N is a power of 2. Perhaps a better made-up name for it would be "assign from plus and multiply by power of two." I forget the original expansion of lea.. maybe load extended address? I really ought to go look at an assembly reference myself. A brief google for "x86 assembly timings lea" didn't turn up anything immediately and eminently useful in the first few hits. It did list a PDF about Pentium-optimized hashing, though. > > I'm curious as to why the last line of the second > > way ends up being h=3Dx+a*1, instead of h=3Dx+a. > It's "lea (%edx,%eax,1),%edi". Maybe the x86 doesn't have a 3-op add > instruction? Well, I think your transliteration of the first method showed some assignments from an addition. Looking back at it, though, it looks like in each case one of the operands to the addition is also the destination for the result. More like +=3D than =3D...+... Anyway, probably the one with just lea's is slightly faster. Certainly unless the D=3DR1+R2*N instruction is more than twice as big as D=3DD+R1 or D=3DD< | http://amacleod.is-a-geek.org/ Elen s=EDla l=FAmenn'omentielvo. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user