" Enter]键。 VS"推EBP; MOV EBP,ESP;子ESP,IMM"和"假" VS" MOV ESP,EBP;流行EBP" [英] "enter" vs "push ebp; mov ebp, esp; sub esp, imm" and "leave" vs "mov esp, ebp; pop ebp"

查看:134
本文介绍了" Enter]键。 VS"推EBP; MOV EBP,ESP;子ESP,IMM"和"假" VS" MOV ESP,EBP;流行EBP"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之间有什么区别的输入

push ebp
mov  ebp, esp
sub  esp, imm

说明?是否有一个性能自动区别吗?如果是这样,这是更快,为什么编译器始终将后者?

instructions? Is there a performence difference? If so, which is faster and why do compilers always use the latter?

与相若的离开

mov  esp, ebp
pop  ebp

指令。

推荐答案

有一个性能的差异,尤其是对输入。现代处理器本德codeS到约10至20μops,而3个指令序列是约4至6,这取决于结构。有关详情请咨询瓦格纳雾的指令表。

There is a performance difference, especially for enter. On modern processors this decodes to some 10 to 20 µops, while the three instruction sequence is about 4 to 6, depending on the architecture. For details consult Agner Fog's instruction tables.

此外在输入指令通常具有相当高的延迟,例如8个时钟上酷睿2相比,3个指令序列的3个时钟依赖链。

Additionally the enter instruction usually has a quite high latency, for example 8 clocks on a core2, compared to the 3 clocks dependency chain of the three instruction sequence.

另外三个指令序列可能为s $ P $垫了编译器为调度宗旨,视场周围code,允许进一步的指令并行执行。

Furthermore the three instruction sequence may be spread out by the compiler for scheduling purposes, depending on the surrounding code of course, to allow more parallel execution of instructions.

这篇关于" Enter]键。 VS"推EBP; MOV EBP,ESP;子ESP,IMM"和"假" VS" MOV ESP,EBP;流行EBP"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆