英特尔指令集:与EAX,EBX,ECX或EDX倍增? [英] Intel instruction set: multiply with EAX, EBX, ECX or EDX?

查看:237
本文介绍了英特尔指令集:与EAX,EBX,ECX或EDX倍增?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你怎么想知道,当MUL ECX被执行死刑。 ECX将与EAX相乘?而不是与EBX或EDX?

How do you suppose to know that when 'mul ecx' was executed. ECX would be multiplied with EAX? And not with EBX or EDX?

mul ecx, eax

会更有意义,但。

would make more sense though.

推荐答案

该指令集被简单地定义这种方式。

The instruction set is simply defined that way.

英特尔可能会在其他方面,包括将允许您完全指定输入和输出寄存器的方式定义,但他们没有这样做。

Intel could have defined it in other ways, including ways that would have allowed you to completely specify input and output registers, but they did not.

借口可以说,在不同的乘法指令加入到指令集的CPU时间(8086葡萄酒,我认为),即现有的指令没有任何明显的地方把乘法它可以共享可用于其他指令(例如,MOV,加,异或等),有没有很多可用的晶体管做花哨的解码方案,使一些其他的方式来连接code通用操作数,而一般的解码方案这是任何可用的晶体管较好专用于乘法/除法逻辑。

The excuse is arguably that at the time the various multiply instructions were added to the instruction set of the CPU (8086 vintage, I think), that the existing instruction didn't have any obvious places to put multiply where it could share the general decoding scheme available to other instructions (e.g., mov, add, xor, etc), that there were not a lot of available transistors to do fancy decoding schemes to enable some other way to encode general operands, and that any transistors that were available were better dedicated to the multiplication/division logic.

最后,需要的乘法指令,而较少往往比一般指令(MOV,添加异或),并因此对操作数移动到位努力/从固定场所的结果不会导致大量$ C $的c膨胀或影响性能的多。设计师没有找到一种方法,包括一个源操作数。你应该考虑一下幸运的它不是简单的定义为乘以EAX和EDX生产EDX:EAX,这是许多早期的计算机体系结构采用了由来已久的计划。而需求并没有多大改变为自x86指令集整数乘法。

Finally, the multiply instruction is needed rather less often than the general instructions (mov, add, xor) and so the effort to move the operands into place/results from fixed places doesn't cause a lot of code bloat or impact performance much. The designers did find a way to include a source operand. You should consider it lucky it wasn't simply defined as multiplying EAX and EDX to produce EDX:EAX, which is a time-honored scheme used in many earlier computer architectures. And the needs haven't changed much for integer multiply in the x86 instruction set since.

浮点/向量运算是一个完全不同的问题。

The floating point/vector arithmetic is an entirely different matter.

这篇关于英特尔指令集:与EAX,EBX,ECX或EDX倍增?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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