News:

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

OPTIMISATION and stalls ?

Started by James Ladd, September 11, 2005, 02:25:57 AM

Previous topic - Next topic

James Ladd

I read elsewhere that code like this

mov esi, addr
mov eax, [esi + struct.field]


Caused a stall of some sort because esi was being set and then immediately read.
If this is true, then how can you avoid it ?

Can you avoid it in all sitations ?

Do you have an example of avoiding it ?

rgs, striker.

hutch--

James,

It looks like a normal read after write stall and about all you can do is try and put some other instruction between the two. From memory if you have a 4 instruction spacing you fully avoid the proglem but note that its only a problem with high speed loop code, apar from tha it just does not matter.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

AeroASM

If you think of the processor as executing one instruction, completing it and then moving on to the next, there is no stall. The stall is because modern processors have a pipeline: they start executing one instruction before the previous one has finished. The stall is very small, only a few clock ticks, so it is only worth avoiding in code which is looped heavily.