![]() |
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?
|
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.
|
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.
|
In GAS syntax, instruction sizes are usually explicitly defined. You use movl here because you're dealing with 32-bit values:
:
movl %eax, %ebx:
movw %ax, %bx:
mov $someVar, %edxIn 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. |
>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] |
(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