flat assembler
Message board for the users of flat assembler.

Index > Main > movq in GAS

Author
Thread Post new topic Reply to topic
pal



Joined: 26 Aug 2008
Posts: 227
pal 06 Jul 2009, 12:52
Wrong forum I know so move it if you want to.

Obviously I don't use GAS but I found something which made me think. In GAS the mov mnemonic have suffixes which determine what size operands are being used right e.g. movb $0x10,%al

When working with 64-bit registers the suffix is a q yeah, e.g. movq $0xDEADC0DEDEADC0DE,%rax or something right.

What happens when you want to use the MMX instruction mnemonic movq then? How does the assembler know whether you are using their suffixed version or the MMX version? Is it just to do with whether or not there is an XMM register involved?

Also what is up with GAS syntax? Why is it the opposite of all others Confused

Cheers.
Post 06 Jul 2009, 12:52
View user's profile Send private message Reply with quote
drhowarddrfine



Joined: 10 Jul 2007
Posts: 533
drhowarddrfine 06 Jul 2009, 14:01
pal wrote:

Also what is up with GAS syntax? Why is it the opposite of all others Confused

GAS was built upon ATT syntax which was around long before most of the others so the question should be why the others are the opposite. But GAS was designed to be used by language compilers and not humans.
Post 06 Jul 2009, 14:01
View user's profile Send private message Reply with quote
Fanael



Joined: 03 Jul 2009
Posts: 168
Fanael 06 Jul 2009, 15:12
Maybe
Code:
movqq (%eax), %mm0 //;movq mm0, qword [eax]    
? If it doesn't work, then try the following code:
Code:
.intel_syntax noprefix //;switch to Intel syntax
movq mm0, qword ptr [eax]
.att_syntax prefix //;switch back to AT&T syntax    
Post 06 Jul 2009, 15:12
View user's profile Send private message Reply with quote
pal



Joined: 26 Aug 2008
Posts: 227
pal 06 Jul 2009, 16:03
drhowarddrfine: Good point; I forgot it was based on the AT&T syntax.

Fanael: Good idea I guess; if I download GAS I'll try it.

Cheers.
Post 06 Jul 2009, 16:03
View user's profile Send private message 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.