View Single Post
Old 2020-10-25, 23:11   #3
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

5×1,249 Posts
Default

Quote:
Originally Posted by retina View Post
IMO the only true-and-correctTM method of finding out what one's system can execute is to simply execute an instruction from the set. If you get an exception then you can't use that set.

This it because it isn't just the CPU you are testing for, it is also the OS. If the OS doesn't enable, and support the instruction set you want to use, even if the CPU has it, then you won't be able to execute them. If you get no exception thrown then you are good to go.

And it generalises to all OSes and systems out there. No need to find special files and parse text outputs and whatnot.
If you want to check programatically, you can use __builtin_cpu_supports() in C/C++. Write a small command line program that checks for each feature you care about.
rogue is offline   Reply With Quote