flat assembler
Message board for the users of flat assembler.

Index > Main > What is the fastest instruction to increment eaxregister?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
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. Wink
Post 05 Feb 2013, 01:20
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 713
Location: Adelaide
sinsi
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.
Post 05 Feb 2013, 02:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
shutdownall wrote:
I wonder if ARM has still an inc or dec instruction - not sure about it.
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.
Post 05 Feb 2013, 10:46
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.