On Mi, Apr 28, 2010 at 02:07:56 (CEST), Kip Warner wrote: > On Wed, 2010-04-28 at 00:32 +0200, Benjamin Drung wrote: >> >> The best solution would be autodetection of SSE2 on runtime. That can >> be >> done with a few lines of code. > > You're right, that can indeed be done with a few lines of code. e.g. > cpuid instruction.
SSE2 can be disabled for userland in the kernel. The implementation of [1] requires this for example. [1] http://portal.acm.org/citation.cfm?id=1752046.1752053 more safe approach include: - "avcodec": installing a SIGILL handler to divert some function pointers - "vlc": spawning a child process that does some sse instructions and check if it dies. > The problem is that you then have to perform a branch every time you > could potentially use hardware acceleration: a condition for when, > say, SSE2 is available, and another for a generic implementation. > > It isn't ideal performance wise. If you have both an SSE2 and C only implementation, you can use function pointers that are set once, not every time the function is called. If properly implemented, this hardly impacts performance. > Perhaps for 32-bit x86 architectures where SIMD is required, I could > build the package for i686 and have it detect at runtime before said is > actually used, whether it is available or not. If it is not, raise a > user visible error and terminate. This can be implemented as SIGILL handler. > This method assumes the user knows that it is only supported on P4 or > later generation of x86. -- Gruesse/greetings, Reinhard Tartler, KeyID 945348A4 -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87aaso5diu....@faui44a.informatik.uni-erlangen.de