![]() |
Checking for SSE / SSE2 support
In a program, does anyone know how one would check for SSE / SSE2 support being enabled in the OS without using exception handling/signals?
Thanks for any help!! drivingon9 |
You might want to check out the code MPlayer uses for runtime cpu detection.
|
Would it be possible to just read in /proc/cpuinfo and search for "sse" or sse2"
|
Using /proc/cpuinfo is implicitly discouraged by the kernel folks, since the API may change in a nanosecond and is thus not stable, even though it has been for a longish while. Under 2.6, sysfs might have the CPU flags somewhere in an easy-to-parse place, but I doubt it.
See the mplayer program for how it detects SSE and SSE2. |
Re: Checking for SSE / SSE2 support
Unfortunately, MPlayer uses signal handling. It executes an SSE/SSE2 instructions and catches the exception if the OS doesn't handle it. I was wondering if there was a cleaner way to do it.
Thanks. |
Use the assembler instruction CPUID
I found a small C program here that does pretty much exactly what you want: http://www-ti.informatik.uni-tuebing...heim/software/ Martin |
Quote:
CPUID will tell you whether the CPU supports SSE/SSE2, but not the OS. The OS (linux in this case) can have SSE and/or SSE2 disabled. |
Quote:
That was new to me. What do you mean by that? Is it possible for the OS to turn off certain instructions in the CPU, or is it just a question of whether the shared libs are compiled with SSE support? Martin |
All times are GMT -5. The time now is 02:13 PM. |