Skip to contentSkip to conversation

.../asm-i386/bitops.h performance improvements

DISCUSSION Bodo Eggert 7 participants 8 messages Jun 15, 2005 – Jun 16, 2005 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · Gene Heskett
Quoted 2 lines

leal (%%edx,%%edi,8),%%edx

To what cpu families does this apply? eg, this may be true for intel, but what about amd, via etc?

lea is an 8086 instruction. All clones have it in it's basic form. However, the multiplicator is not documented for i486, therefore it will be a i586 extension.

Signature · 2 lines
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.
#3 lore raw
Quoted 3 lines · Bodo Eggert

lea is an 8086 instruction. All clones have it in it's basic form. However, the multiplicator is not documented for i486, therefore it will be a i586 extension.

Huh? The SIB byte has been added in the original i386 with 32-bit
addressing.

Maciej

#4 lore raw
Quoted 10 lines · Maciej W. Rozycki
Quoted 3 lines · Bodo Eggert

lea is an 8086 instruction. All clones have it in it's basic form. However, the multiplicator is not documented for i486, therefore it will be a i586 extension.

Huh? The SIB byte has been added in the original i386 with 32-bit addressing.

Maciej

Well the __documented__ '486 LEA instruction doesn't even allow the double-register indirect. It's just

	LEA r16,m
	LEA r32,m

... repeated twice

Page 26-190, Intel486(tm) Microprocessor Programmer's Reference Manual. ISBN 1-55512-195-4. The instruction may have been one of those "immature features", read broken.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.11.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.

#5 lore raw
Quoted 11 lines · Richard B. Johnson

Well the __documented__ '486 LEA instruction doesn't even allow the double-register indirect. It's just

LEA r16,m
LEA r32,m

... repeated twice

Page 26-190, Intel486(tm) Microprocessor Programmer's Reference Manual. ISBN 1-55512-195-4. The instruction may have been one of those "immature features", read broken.

And "m" is presumably described in details elsewhere as the semantics is
common for all instructions involving address calculation. There is no point in repeating the lengthy explanation for every instruction, is it? Or would you prefer having each possible register and/or value of constant arguments described for every instruction separately?

Maciej

#6 lore raw
Quoted 8 lines · Maciej W. Rozycki
Quoted 6 lines · Richard B. Johnson

Well the __documented__ '486 LEA instruction doesn't even allow the double-register indirect. It's just

LEA r16,m
LEA r32,m

Quoted 8 lines
Quoted 5 lines

... repeated twice

Page 26-190, Intel486(tm) Microprocessor Programmer's Reference Manual. ISBN 1-55512-195-4. The instruction may have been one of those "immature features", read broken.

And "m" is presumably described in details elsewhere as the semantics is
common for all instructions involving address calculation.

My documentation says:

lea reg16, mem
Available on 8086, 80186, 80286, 80386, 80486
32-bit-extension available
Opcode: 8D mod reg r/m

reg will be the target register (AX .. DI), and mod and r/m will select something like a direct address, a register or a combination like BP+DI+ofs (I won't copy the table). A multiplier is not mentioned there.

Signature · 1 line
Microwave: Signal from a friendly micro... 
#7 lore raw
Quoted 11 lines · On Wed, 15 Jun 2005 21:10:26 +0200 (CEST) Bodo Eggert <[email protected]> wrote:

My documentation says:

lea reg16, mem
Available on 8086, 80186, 80286, 80386, 80486
32-bit-extension available
Opcode: 8D mod reg r/m

reg will be the target register (AX .. DI), and mod and r/m will select something like a direct address, a register or a combination like BP+DI+ofs (I won't copy the table). A multiplier is not mentioned there.

In 32 bit mode on the 386 and above, a two byte version of the "mod reg r/m" is possible which contains the scaling field ...

On the 386, using a second register in the ea calculation costs another cycle.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#8 lore raw
In reply to Bodo Eggert
Quoted 10 lines · Bodo Eggert

My documentation says:

lea reg16, mem
Available on 8086, 80186, 80286, 80386, 80486
32-bit-extension available
Opcode: 8D mod reg r/m

reg will be the target register (AX .. DI), and mod and r/m will select something like a direct address, a register or a combination like BP+DI+ofs (I won't copy the table). A multiplier is not mentioned there.

You're looking at the wrong parts of the documentation. The 16-bit mode ModR/M doesn't have SIB, but the 32-bit mode does. The SIB includes the scaled index. All IA32 processors have it. The only LEA-related quirk is that its ModR/M must not describe a non-memory operand.

#9 lore raw
In reply to Bodo Eggert

Ummm, in simple terms - this statement is flat out 100% wrong.

LEA with the SIB byte has been around since 386 and is included on every CPU Linux is capable of running on.

Compile this using -m386 and look at the ASM listing file and convince yourself.

unsigned int foo(int bar)
{
return ((bar<<3)+bar);
}

GCC is going to generate a MOV of parm to EAX, then a LEA EAX,[EAX+EAX*8]

Don't trust me - compile this and prove it to yourself.

----- Original Message -----
From: "Bodo Eggert" <[email protected]>
To: "Gene Heskett" <[email protected]>; <[email protected]>; <linux->

Quoted 2 lines

However, the multiplicator is not documented for i486, therefore it will

be a i586

Quoted 1 line

extension.