flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
Code: macro inc v {add v,1} macro dec v {sub v,1} Of course, you need to make sure you do not need to preserve the carry flag! |
|||
![]() |
|
vid
someone could create optimization macros for particular processors
|
|||
![]() |
|
beppe85
It's not optimization if it alter meaning of an instruction. In the first case(revolution), you need to preserve CF. In the second(Matrix), you need to not preserve any but CF. Also, touching the stack may slow down things and disrupt programmer intention.
I think if there's a better way to do in some circunstances, you do not do it by macros. |
|||
![]() |
|
revolution
Beppe85: Yeah, I already mentioned about the carry, but I find very rarely do I actually need to preserve the CF.
Matrix: using add and sub are faster on the P4 because it modifies all the flags, but inc/dec preserve CF. So in the P4 inc/dec stall until the flags are updated. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.