装配莱亚尔和MOVL差异 [英] assembly leal and movl difference
问题描述
leal(%eax,%ecx,4), %edx
,因为我是从我的计算机系统的电子书阅读,
如果$ EAX包含x值和%ECX包含Ÿ可以去看premises,
那么上面的方法,X + 4Y付诸%EDX。
as I was reading from my computer systems book, if there`s premises that $eax contains x value and %ecx contains y, then the above means, x+4y putting into %edx.
那么,如果它是
movl(%eax,%ecx,4), %edx
,然后isn`t的同一个以上利尔前pression?
, then isn`t the same one with leal expression above?
据我所知,莱亚尔创建一个可参考的地址,而不是本身引用MOVL一样,但
As I know, leal creates address that can be referenced,not referencing by itself like movl, but
当我看到莱亚尔(%eax中,%ECX,4),%EDX
等于把 X + 4Y
到 EDX
注册,
然后没有按 T这意味着它引用
%EAX 和
%ecx`提取值x和y使用计算??
when I saw leal(%eax,%ecx,4), %edx
equals putting x+4y
into edx
register,
then doesnt it mean that it 'referenced'
%eaxand
%ecx` and extracted value x and y for using computation??
- 不`吨了()的意思是'引用'??
推荐答案
LEA
加载由地址计算到寄存器产生一个有效的地址。 MOV
使用SIB寻址作为源操作数,当某个地方移动的东西,它的动作无论是在的由地址计算到目标操作数生成的地址。
LEA
loads an effective address generated by an address calculation into a register. MOV
moves something somewhere, when using SIB addressing as source operand, it moves whatever is at the address generated by the address calculation into the target operand.
所以:
leal (%eax,%ecx,4), %edx ← moves %eax+%ecx*4 into %edx
movl (%eax,%ecx,4), %edx ← moves whatever is at address %eax+%ecx*4 into %edx
这篇关于装配莱亚尔和MOVL差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!