Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do Off-the-shelf applications work on both Intel and AMD processors?

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

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?

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?

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"?

like image 740
romandas Avatar asked May 06 '09 22:05

romandas


People also ask

Can AMD and Intel run the same programs?

Yes, both AMD and Intel processors fully implement the IA-32 and x86–64 instruction sets, and can execute the same software. Depending on the speed of the CPU, one may execute software more quickly than the other, but both will work.

What is the main difference between AMD processors and Intel processors?

Intel processors are less expensive compared to the AMD ones at the lower range. AMD processors are less expensive compared to the Intel ones at the higher range. It may heat up when someone uses it with a Clock Speed Boost of 14nm. The AMD processor generally stays cooler than Intel due to its small lithography.

What are the similarities between AMD and Intel?

Both AMD and Intel produce mother boards which are the circuitry at the base of all personal computers. AMD and Intel also create CPU or Central Processing Unit chips for the personal computer. While both are in the same industry but are always vying against each other for marketshare and technological changes.

Why are Intel and AMD the only processors?

Why do only Intel and AMD make processors? Actually AMD doesn't make CPUs, they just design them and either TSMC or global Foundries makes them. Intel on the other hand have their own manufacturing plants and they do make their own CPUs.


4 Answers

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.

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.

like image 78
Zifre Avatar answered Oct 10 '22 06:10

Zifre


Actually they do have a cross-licensing agreement. Information and innovation flowed from Intel to AMD back in the 90's when AMD was a second source of 386 and 486 processors, and then from AMD to Intel when Intel adopted the x86-64 extensions.

like image 40
florin Avatar answered Oct 10 '22 06:10

florin


Remember also that the instruction sets for these processors are publicly documented; typically one vendor will invent a new set of instructions, and a generation or two later the other vendor will implement compatible extensions. As such, rather than IF 386 .... you have something more along the lines of IF SSE4 IS SUPPORTED ..., without regard to the specific vendor.

like image 31
bdonlan Avatar answered Oct 10 '22 05:10

bdonlan


Both vendors implement the same instruction set, so when your compiled code gets turned into machine instructions, they will work on both chips. However, there are some special instruction sets such as SSE that can be specific to one vendor or another. If you want to improve performance for an application, you can make runtime checks to use these features when available.

like image 41
Tim Rupe Avatar answered Oct 10 '22 06:10

Tim Rupe