Message board for the users of flat assembler.
> Main > What is the fastest instruction to increment eaxregister?
Goto page Previous 1, 2
revolution 05 Feb 2013, 01:20
Well it has to be said: You are all wasting your time here. Hehe.
1) Any tests you can come up with and run will, by necessity, be artificial and bear no relationship to an actual running program.
And 2) results will be dependant upon which CPU/mobo/memory configuration you have when running the test. All of these things change with time and are different for other people. Which is why I posted above that there is no answer to this (and other similar "which is faster") questions.
Hope that helps.
|05 Feb 2013, 01:20||
sinsi 05 Feb 2013, 02:50
We did some tests on another forum, the results were...unsatisfying.
Pre-P4: inc was a bit faster over millions of iterations
P4: inc was a lot slower
Post-P4: practically the same
Most AMDs: inc was a bit faster
"practically/a bit/a lot" means you couldn't tell the difference in the Read World
Of course, you can use LEA ECX,[ECX+1] to inc without affecting any flags.
|05 Feb 2013, 02:50||
revolution 05 Feb 2013, 10:46
Wonder no longer. ARM does not have an INC opcode. And AFAICT there is no equivalent instruction either. ADD R1,1 will increment R1 but no flags are changed. ADDS R1,1 will also increment R1 but all the flags are altered. There is a way to use AND/ORR sequences and other tricks to increment a register and still preserve the carry flag but that would not be a single instruction.
I wonder if ARM has still an inc or dec instruction - not sure about it.
|05 Feb 2013, 10:46||
|Goto page Previous 1, 2
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.