为什么现成的应用程序可同时在Intel和AMD处理器上运行? [英] Why do Off-the-shelf applications work on both Intel and AMD processors?

查看:143
本文介绍了为什么现成的应用程序可同时在Intel和AMD处理器上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我缺乏了解的一件事是如何为AMD CPU编译代码.

One thing I lack understanding on is how can code compiled for an Intel CPU work on an AMD CPU.

我的基本理解是,例如,如果您编译C代码,则编译器会将源代码转换为机器语言,该语言将具有针对特定处理器的指令.因此,您需要使用编译器针对希望应用程序使用的任何平台进行编译.为什么您不要求针对AMD与Intel的编译器,而必须购买用于特定处理器的软件?

My base understanding is that if you compile C code, for example, the compiler turns the source code into machine language which will have instructions for a particular processor. So, you need to compile with a compiler for whatever platform you want your application to use. Why don't you require a compiler for AMD versus Intel, and have to buy software for a particular processor?

我知道AMD处理器和Intel处理器在较早的x86指令中具有某些兼容性;我想知道的是他们如何做到的?我的意思是,这并不像AMD或Intel互相呼吁并互相告诉他们自己的商业机密一样,那么它们如何创建兼容的指令集呢?

I know that AMD processors and Intel processors share some compatibility in the older x86 instructions; what I'd like to know is how do they do that? I mean, it's not like AMD or Intel are calling each other up and telling each other their trade secrets, so how can they create instruction sets that are compatible?

所有兼容性是否仍基于386指令集,并带有诸如"IF AMD CPU,这ELSE IF INTEL可以做到这一点"之类的语句吗?

Is all compatibility still based on the 386 instruction set, with a bunch of statements like "IF AMD CPU, do this ELSE IF INTEL do that"?

推荐答案

AMD与Intel x86和x86-64 CPU几乎完全兼容.它们都实现了x86和x86-64的全部.它们每个都有自己的扩展名(例如MMX和3DNow),但是除非您告诉他们,否则编译器通常不会使用它们.如今,AMD和Intel几乎都支持彼此的所有扩展.您唯一需要担心的区别就是您正在做真正的低级内核工作.

AMD and Intel x86 and x86-64 CPUs are almost entirely compatible. They both implement all of x86 and x86-64. They each have their own extensions (like MMX and 3DNow), but compilers don't generally use them unless you tell them to. Nowadays, AMD and Intel both support almost all of each other's extensions. The only time you may have to worry about the difference is when you are doing really low-level kernel stuff.

顺便说一句,指令集并不是真正的商业秘密".实现是.两家公司都在指令集上提供文档,因此每个公司都可以复制它.这样做的原因可能是,如果更多的公司生产兼容的芯片,则将为该指令集编写更多的软件,因此会有更多的人购买这些芯片.x86/x86-64基本上是台式机的标准体系结构,从而确保人们将继续购买Intel和AMD芯片.英特尔和AMD的实现有很大不同,它们只是执行相同的代码.

By the way, the instruction set isn't really a "trade secret." The implementation is. Both companies produce documentation on the instruction set, so each can copy it. The reason for this is probably that if more companies produce compatible chips, more software will be written for this instruction set, so more people will buy these chips. x86/x86-64 is basically the standard architecture for desktops, guaranteeing that people will continue to buy Intel and AMD chips. Intel and AMD have very different implementations, they just execute the same code.

这篇关于为什么现成的应用程序可同时在Intel和AMD处理器上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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