flat assembler
Message board for the users of flat assembler.
Index
> Main > AND vs OR vs TEST |
Author |
|
vid 19 Dec 2006, 21:03
we should also take CMP ("proper" way...) into account
|
|||
19 Dec 2006, 21:03 |
|
revolution 19 Dec 2006, 23:03
If your goal is optimisation: The most optimal instruction is TEST. This is because there is no write back register resource allocated. With AND and OR each require a register to be written back. CMP requires more bytes to encode and thus pollutes the cache.
If your goal is something else: Use whichever instruction you are most comfortable with. Last edited by revolution on 19 Dec 2006, 23:09; edited 1 time in total |
|||
19 Dec 2006, 23:03 |
|
asmfan 19 Dec 2006, 23:05
some values are simplier and better tested with bitwise-operations -> *test* is considered the best way to test on zero val, also if we need to know is there some submask in val we cannot just use cmp. Wast variety of methods there are -> test on (-1= 0F...Fh) =
Code: inc val jz @F etc... _________________ Any offers? |
|||
19 Dec 2006, 23:05 |
|
vid 19 Dec 2006, 23:14
wait... i missed "before cmp" part. In such case, AFAIK, the instruction does nothing.
|
|||
19 Dec 2006, 23:14 |
|
salefrais 20 Dec 2006, 15:28
I normally use "test" anyway with optimization in mind, so it's good to know that I'm not wrong in doing so. Thanks a lot!
|
|||
20 Dec 2006, 15:28 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.