News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

LEA

Started by bomz, July 04, 2011, 10:00:07 PM

Previous topic - Next topic

dedndave

        lea     edx,[4*eax+eax]
        lea     ebx,[2*edx+ecx]
        mov     eax,ebx


it would help if you could place unrelated instructions in between..
        lea     edx,[4*eax+eax]
        mov     esi,offset SomeData
        lea     ebx,[2*edx+ecx]
        mov     edi,offset SomeOtherData
        mov     eax,ebx

bomz

I try LEA NOP MOV ADD. (lea ebx, [ebx])
this method don't still register's for cycle

qWord

Quote from: bomz on July 09, 2011, 08:51:04 PM
I try LEA NOP MOV ADD.
you may try to test a useful algorithm!
FPU in a trice: SmplMath
It's that simple!

bomz



may be somebody with good or native English write latter to Intel?

qWord

Quote from: bomz on July 09, 2011, 09:51:26 PMmay be somebody with good or native English write latter to Intel?
and whats the message for Intel?
FPU in a trice: SmplMath
It's that simple!

bomz

how lea work for arithmetic

qWord

Quote from: bomz on July 09, 2011, 10:27:55 PM
how lea work for arithmetic
strange question in context to your previous posts - However, you should read Intel's Documentation before asking.
FPU in a trice: SmplMath
It's that simple!

bomz

if information about LEA was known I will find it with Google.

jj2007

Quote from: bomz on July 09, 2011, 09:51:26 PM


may be somebody with good or native English write letter to Intel?

Hi Bomz,

I admire your icons, they are really cute and funny. Do you create them yourself?
:U


bomz

http://www.en.kolobok.us/download.php?view.15

Support:

KOLOBOK Smiles for Firefox
KOLOBOK Smiles for Opera 9
KOLOBOK Smiles for Internet Explorer
KOLOBOK Smiles for Google Chrome

redskull

I haven't looked at the actual code, but anytime you use the same registers for input and output, you'll get a dependency chain. Basically, it can't start the second lea until it knows the output from the first, and can't start the third until its done second, all the way up to 100. With different registers, the value of eax doesn't change, it doesn't have to wait on anything to do any of the lea instructions. But again, that's based on just a cursory look at the results.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

jj2007

Quote from: redskull on July 10, 2011, 11:55:37 AM
I haven't looked at the actual code, but anytime you use the same registers for input and output, you'll get a dependency chain. Basically, it can't start the second lea until it knows the output from the first

red,

that sounds plausible, and bomz' P4 behaves like that. My Celeron M, in contrast, couln't care less which regs are involved :bg

redskull

Quote from: jj2007 on July 10, 2011, 03:28:37 PM
that sounds plausible, and bomz' P4 behaves like that. My Celeron M, in contrast, couln't care less which regs are involved :bg

Like hutch said, breaking the LEA down into additions and multiplcations is probably what does it.  Per the timings, an M only has a latency of 1 for LEA, but the PIV has a latency of 4.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

bomz

Quote from: redskull on July 10, 2011, 11:55:37 AM
I haven't looked at the actual code, but anytime you use the same registers for input and output, you'll get a dependency chain. Basically, it can't start the second lea until it knows the output from the first, and can't start the third until its done second, all the way up to 100. With different registers, the value of eax doesn't change, it doesn't have to wait on anything to do any of the lea instructions. But again, that's based on just a cursory look at the results.

-r

and how break this chain?

Quote   lea ebx, [4*EAX+EAX]
   mov edx, ebx
   lea ebx, [2*EDX+ECX]  - 3000

Quote   lea ebx, [4*EAX+EAX]
   mov edx, ebx
   lea ebx, [2*EDX+ECX]
   mov eax, ebx - 10000

This LEA using for matrix?