Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

x86 assembly question

Name: Anonymous 2007-04-19 20:01 ID:qoBRsMAB

WHAT THE FUCK DOES THE DAMN LEA INSTRUCTION DO THAT MOV DOESN'T?

Name: Anonymous 2007-04-19 20:06 ID:26amq1tl

doesn't affect the flags

Name: Anonymous 2007-04-19 20:48 ID:923hHve8

you can do a lot with lea actually
its useful for quick additions
for example
lea eax,[edx+ecx]
would result in eax = edx+ecx
don't forget that you can have multipliers for it, its useful in general

Name: Anonymous 2007-04-20 3:46 ID:yywhtRqE

>>2, >>3
Thank you for your response.

Name: Anonymous 2007-04-20 4:26 ID:iOAX+s8M

LEA = load effective address - lea dest, source
MOV = Move (copy) - mov dest, source (intel)

Name: Anonymous 2007-04-20 5:13 ID:yM/4j0tt

I believe I heard somewhere that Mov is also faster

Name: Anonymous 2007-04-20 5:52 ID:iOAX+s8M

>>6
algorithm used > difference between instructors.
remember that

Name: Anonymous 2007-04-20 6:43 ID:nnknohvK

Both names can be confusing.
MOV (Move) just copies data (reg-reg, reg-imm, reg-mem, mem-reg, and IIRC, mem-imm).
LEA (Load Effective Address) uses the processor effective address calculation unit (different from usual arithmetic operations) as if it would calculate a memory address for a memory operation, but stores the result in a register. This engine is able to perform certain operations with certain registers (IIRC, in 32 bit mode, addition of two any registers plus immediate value and a bit shift), all optional and in a simple clock cycle (in theory). As a drawback, it doesn't set FLAGS/EFLAGS.

In theory, LEA is faster than its equivalent series of MOV, ADD, and SHL/SHR instructions, so while this unit was intended to calculate memory offsets (e.g. as required by MOV EAX, [ESI+ECX]), it's also offered as an alternative simple, fast, incomplete arithmetic unit.

Whether LEA is faster than the equivalent regular ALU instructions, it depends on the processor you're using. I know it used to be a good optimization. I don't know how it's now. Benchmark, then let me know, for curiosity.

Name: Anonymous 2007-04-20 7:27 ID:9nOyFz8D

>>7
algorithm used > difference between instructors

actually a given algorithm will execute a number of extructions dependant on the inputs, that number of instructions is important.
the algorithm defines the relation.

Name: Anonymous 2009-01-14 13:11

SICP

Name: Anonymous 2009-03-06 15:01

Actually invented some of your tunnelz from?

Name: Anonymous 2010-12-22 1:12

Name: Anonymous 2012-03-25 14:19

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

Name: Sgt.Kabu�﹪kiman縱ィ 2012-05-29 0:24

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List