flat assembler
Message board for the users of flat assembler.

flat assembler > Compiler Internals > Replace add eax,1 with inc eax

Author
Thread Post new topic Reply to topic
MIHIP



Joined: 14 Feb 2013
Posts: 130
Hello. Can you replace instructions in source code of fasm ("add eax,1 & etc.") to inc eax? This is very small optimization, but is very useful. Trust me, in your code many of not optimized instructions. Fix it, if you can. Thx. Very Happy
Post 20 Apr 2015, 18:10
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1394
Location: Toronto, Canada
Intel says "Avoid using INC/DEC" and replace it with ADD xx,1 or SUB xx,1.
The reference is here:
http://www.agner.org/optimize/optimizing_assembly.pdf

Part 16.2
Post 20 Apr 2015, 18:35
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16782
Location: In your JS exploiting you and your system
MIHIP: Those instructions are not the same because the FLAGS are set differently.

AsmGuru62: Those old optimisations are not relevant on newer CPUs AFAICT. Since the carry flag was placed into a separate register internally there is no longer any penalty.
Post 20 Apr 2015, 23:00
View user's profile Send private message Visit poster's website Reply with quote
MIHIP



Joined: 14 Feb 2013
Posts: 130
Ok. Thanks.
Post 21 Apr 2015, 17:31
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:  


< 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-2019, Tomasz Grysztar.

Powered by rwasa.