[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
OT: x86 assembly timings/size (was Re: Does anyone have a better scm_str
From: |
Allister MacLeod |
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 |
User-agent: |
Mutt/1.5.4i |
On Mon, Nov 17, 2003 at 06:57:58PM +0100, Marius Vollmer wrote:
> Allister MacLeod <address@hidden> writes:
> > I assume from your pleased comments that
> > assign-from-plus-and-multiply is sufficiently fast
> "x = 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=x+a*1, instead of h=x+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 += than =...+...
Anyway, probably the one with just lea's is slightly faster.
Certainly unless the D=R1+R2*N instruction is more than twice as big
as D=D+R1 or D=D<<N, the resulting binary will be smaller :^)
Cheers,
Allister
--
Allister MacLeod <address@hidden> | http://amacleod.is-a-geek.org/
Elen síla lúmenn'omentielvo.
- Re: cmod-play 1 available + modsup.h additions, (continued)
- Re: cmod-play 1 available + modsup.h additions, Marius Vollmer, 2003/11/14
- Does anyone have a better scm_string_hash ?, Roland Orre, 2003/11/14
- Re: Does anyone have a better scm_string_hash ?, Ludovic Courtès, 2003/11/14
- Re: Does anyone have a better scm_string_hash ?, Roland Orre, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Ludovic Courtès, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Allister MacLeod, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/17
- OT: x86 assembly timings/size (was Re: Does anyone have a better scm_string_hash ?),
Allister MacLeod <=
- Re: OT: x86 assembly timings/size, Marius Vollmer, 2003/11/17
- Re: Does anyone have a better scm_string_hash ?, Ludovic Courtès, 2003/11/19
- Re: Does anyone have a better scm_string_hash ?, Marius Vollmer, 2003/11/19
Re: cmod-play 1 available + modsup.h additions, Thien-Thi Nguyen, 2003/11/14