Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Assembly (http://www.programmingforums.org/forum20.html)
-   -   What's the difference between mov and movl? (http://www.programmingforums.org/showthread.php?t=11974)

purpleorange Nov 23rd, 2006 12:30 AM

What's the difference between mov and movl?
 
After reading through some of Programming from the Ground Up, I can't help but notice that the author uses 'movl'. In the Tajga Tutorial, the author uses 'mov'. What does the 'l' stand for and is there a difference between the two instructions? In this wikibook page, it shows some other mov's with different endings, but not the one with the 'l' even though it uses it in it's sample. Is the 'movl' instruction specific to GAS?

grimpirate Nov 23rd, 2006 2:16 AM

There is no movl instruction, all you have to do is check the Intel docs at the Intel website and you'll see that such an opcode is not supported. Most likely it is something specific to GAS. The closest opcode to the one you're describing is MOVLHPS which is move packed single-precision floating-point values low to high. It could also be a typo, perhaps he meant to type mov al which is to move some value into the al register.

Jimbo Nov 23rd, 2006 3:15 AM

I seem to remember something about some commands having l at the end but having no particular performance changes. Take it with the usual disclaimer though, as it's really a vague recollection.

niteice Nov 23rd, 2006 10:36 AM

In GAS syntax, instruction sizes are usually explicitly defined. You use movl here because you're dealing with 32-bit values:
:

movl %eax, %ebx
However, you would use movw for a different size:
:

movw %ax, %bx
Generally, the instruction size can be inferred, but suppose you have a variable:
:

mov $someVar, %edx
How does GAS know the size?

In NASM syntax, however, instruction size is inferred by the operands, so you deal with a syntax that is a lot closer to the machine code.

Narue Nov 23rd, 2006 10:38 AM

>Is the 'movl' instruction specific to GAS?
It's specific to assemblers with AT&T syntax. The l is a size suffix that tells you you're working with dwords. To change the size, you change the suffix (b, w, l, q for byte, word, dword, and qword).

[edit: gah, beaten]

mackenga Dec 1st, 2006 5:16 PM

(gah, beaten twice, and by miles...) :)


All times are GMT -5. The time now is 1:29 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC