flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > 64bit code and Inc/Dec instructions

Author
Thread Post new topic Reply to topic
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden 06 Oct 2005, 07:20
When porting 32bit code to 64bit code.. will the compiler automaticly convert
Inc/Dec instructions to Add/Sub instructions? Inc/Dec bytes are used for the REX prefix on 64bit machines and are now obsolite.

Or do we need to define new inc & dec macro's to do the inc/dec convertion. I dont have a 64bit system and havn't been able to any debug testing.

_________________
New User.. Hayden McKay.
Post 06 Oct 2005, 07:20
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 06 Oct 2005, 08:16
INC/DEC still exist in 64-bit code, since only their short forms for registers (opcodes 40h-4Fh) have been used for other purposes, and their long forms (opcodes 0FEh-0FFh) are still available.

Any such "conversion" would not be suitable, since "INC EAX" is not the same as "ADD EAX,1" - the second one affects CF, while first one doesn't. This is important and utilized feature - thus they could not remove the INC/DEC from the instruction set.
Post 06 Oct 2005, 08:16
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.