views:

25

answers:

1

I've noticed that many Intel 32-bit programs have an i386 target, yet some have i486, i586 or i686 as their build architecture. Are there any new features or instructions added to the instruction set in the latter three processor architectures?

+2  A: 

They change tons of things about the architecture, and add new instructions (and sets) all the time. If you want the latest cutting edge performance you need to compile for your specific variant of your architecture. See 2.1 BRIEF HISTORY OF INTEL® 64 AND IA-32 ARCHITECTURE of Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 1: Basic Architecture.

Off the top of my head, MMX, 3DNOW, SSE*, x87 FPU, some other things like RDTSC were not in the original models IIRC. Actually, i[3,4,5,6]86 are really nothing at all like what we have today... Even in new processor models they are adding things like AES-NI and newer iterations of SSE, etc.

Wikipedia's pages also say a bit that changed in them, for instance in P6 it says they added CMOV.

Longpoke
Okay, does this mean, if I compile for `i686`, writing in C, for example, it'll work just the same as compiling for `i386`, but takes advantage of these new features? Will, e.g. `gcc` optimise code to use these features when `i686` is selected or do I need to write code manually to take advantage?
Delan Azabani
Check the "Intel 386 and AMD x86-64 Options" section of `gcc(1)`. Specifically, the paragraph next to `native`. There are two options `-mtune` and `-march`, the former will optimize for a specific model such as `i386`, while the latter is more aggressive and will take advantage of features (or anomalies) of your specific CPU type, and thus may not work on even other x86 CPUs.
Longpoke

related questions