Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-12-2003, 02:09 PM
|
#1
|
LQ Newbie
Registered: Nov 2003
Posts: 3
Rep:
|
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
|
|
|
11-12-2003, 02:19 PM
|
#2
|
Member
Registered: Oct 2003
Distribution: Debian/unstable
Posts: 85
Rep:
|
You might want to check out the code MPlayer uses for runtime cpu detection.
|
|
|
11-13-2003, 10:46 AM
|
#3
|
Member
Registered: Oct 2001
Distribution: Gentoo
Posts: 140
Rep:
|
Would it be possible to just read in /proc/cpuinfo and search for "sse" or sse2"
|
|
|
11-13-2003, 11:21 AM
|
#4
|
Member
Registered: Oct 2003
Distribution: Debian GNU/Linux 11 (amd64) w/kernel 6.0.15
Posts: 299
Rep:
|
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.
|
|
|
11-13-2003, 12:02 PM
|
#5
|
LQ Newbie
Registered: Nov 2003
Posts: 3
Original Poster
Rep:
|
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.
|
|
|
11-13-2003, 06:31 PM
|
#7
|
LQ Newbie
Registered: Nov 2003
Posts: 3
Original Poster
Rep:
|
Can't do that.
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.
|
|
|
11-14-2003, 06:42 AM
|
#8
|
Member
Registered: Nov 2003
Location: Ronneby, Sweden
Posts: 555
Rep:
|
Quote:
Originally posted by drivingon9
The OS (linux in this case) can have SSE and/or SSE2 disabled.
|
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 01:17 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|