flat assembler
Message board for the users of flat assembler.
Index
> Main > optimization |
Author |
|
FlashBurn 23 Jul 2005, 10:07
I like to know which code I should use!
Code: mov esi,ADDR mov eax,[esi+foo_t.data] or Code: mov eax,[ADDR+foo_t.data] |
|||
23 Jul 2005, 10:07 |
|
El Tangas 23 Jul 2005, 17:26
This kind of code, when you change a register just before using it as part of an adress, can generate a penalty called Address Generation Interlock (AGI), causing the processor to stall for 1 cycle.
Code: mov esi,ADDR mov eax,[esi+foo_t.data] So, if you can choose, this is better. Code: mov eax,[ADDR+foo_t.data] |
|||
23 Jul 2005, 17:26 |
|
james 08 Sep 2005, 09:10
But are they really equivilant ?
|
|||
08 Sep 2005, 09:10 |
|
Matrix 08 Sep 2005, 14:11
james,
they are fully exchangeable, the difference is : this uses register (dynamic) Code: mov esi,ADDR mov eax,[esi+foo_t.data] this uses immediate value (fix) Code: mov eax,[ADDR+foo_t.data] |
|||
08 Sep 2005, 14:11 |
|
shoorick 08 Sep 2005, 14:18
but first alter esi
|
|||
08 Sep 2005, 14:18 |
|
vid 08 Sep 2005, 14:58
??? i don't understand, if ADDR is constant value (it has to be for "mov esi,ADDR" to work), and "foo_t.data" is constant value too, then "ADDR + foo_t.data" is also constant value, so you are asking on difference between
Code: mov esi,const mov eax,[esi + const] Code: mov eax,[const] so difference is clear. sorry if i misunderstood something |
|||
08 Sep 2005, 14:58 |
|
Vasilev Vjacheslav 08 Sep 2005, 16:04
for dynamic value:
Code: lea esi,[stack_structure] mov eax,[esi+stack_structure.somevalue] for immediate value: Code: mov eax,[constant_structure.somevalue] ps. they are totally different _________________ [not enough memory] |
|||
08 Sep 2005, 16:04 |
|
james 08 Sep 2005, 20:56
Hmmmn. I thought you had to dereference the addr first (ie: [ADDR])
then make an adjustment for the field you need. Am I thinking that ADDR is a constant and not a pointer ? |
|||
08 Sep 2005, 20:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.