Created
January 18, 2015 20:15
-
-
Save RobinDavid/65d781e6edfd5ffeb379 to your computer and use it in GitHub Desktop.
Retrieve MMX and SSE support using the CPUID assembly command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(int argc,char* argv[]) | |
{ | |
unsigned int cpeinfo; | |
unsigned int cpsse3; | |
__asm__( | |
"mov $01,%%eax;" | |
"cpuid;" | |
"mov %%edx,%0;" | |
"mov %%ecx,%1" | |
:"=r"(cpeinfo),"=r"(cpsse3) | |
); | |
cout << "1 - Instruction set is supported by CPU\n"; | |
cout << "0 - Instruction set not supported\n"; | |
cout << "--------------------------------\n"; | |
cout << "MMX: " << ((cpeinfo >> 23) & 0x1 ) << "\tSSE: " << ((cpeinfo >> 25) & 0x1 ) << "\tSSE2: " << ((cpeinfo >> 26) & 0x1 ) << "\n"; | |
cout << "SSE3: " << ((cpsse3 ) & 0x1 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment