Every new generation of CPU introduces some sets of new instructions, i.e. MMX, 3DNOW, SSE and so on.
I've got few general questions about them:
To elaborate on Michael Madsen's answer for question 4, GCC defaults to generating code for an i386 processor. It provides a flag called -march
(also known as -mcpu
) that determines which kinds of instructions the compiler will emit. Microsoft's cl.exe
provides /arch:
and /Gx
flags for the same purpose.
The flag also affects how the instructions are ordered, because different CPUs can be relatively slower or faster executing a given piece of code, depending on the order in which the instructions appear.
I'm not aware of any static compiler that will create automatic feature-set fallback code. Usually that must be done explicitly by the programmer. But the good news is that that programmer need not be you; for example, the liboil
library (of Optimized Inner Loops) will, at runtime, select the best code to run depending on the machine it's being run on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With