Alex Rivera | Logout

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

Asked 2009-05-06T22:01:42.360
11

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

Edit
Report

1 Answer

6

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.

answered 2009-05-06T22:07:08.977

Your Answer