3 ms·
Depends on the compiler. Gcc compiles to the lowest common denominator while icc offers "Processor dispatch technology performs a check at execution time to det
by lozenge 6y ago
Depends on the compiler. Gcc compiles to the lowest common denominator while icc offers "Processor dispatch technology performs a check at execution time to determine which processor the application is running on and use the most suitable code path for that processor. Compatible, non-Intel processors will take the default optimized code path."
For HPC they will always compile to use the full set of instructions and see how it performs. For some software there will be explicit checks and loading the right compiled code(compression, video effects etc). On a desktop most things are compiled for the minimum processor though. The CPU might still be able to use its new features like wide registers of the instructions are in just the right order.
If you run something with instructions your processor doesn't have it will crash.
- majewsky 6y ago> If you run something with instructions your processor doesn't have it will crash. I would be very surprised if the processor itself crashed. I haven't encountered it in actuality so far, but as far as I'm aware, illegal instructions raise an interrupt that the OS can catch. On Unix, this should result in the corresponding user space process receiving SIGILL. It appears that SIGILL is actually preemptible. Could this be used as a poor man's CPU feature detection mechanism?
- lozenge 6y agoI meant the process crash not the CPU, you are correct. Also, my gcc knowledge is outdated. People have mapped out the millions of "undocumented instructions" by trapping SIGILL.