#include
#define CPUID(f,ax,bx,cx,dx) __asm__ __volatile__ \
("cpuid": "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (f))// denormal protection
static int set_DAZ_and_FTZ(int /*bool*/ on)
{
int sse_level = 0;if(on)
{
unsigned long ax, bx, cx, dx;CPUID(0x00,ax,bx,cx,dx);
CPUID(0x01,ax,bx,cx,dx);if (dx & 0x02000000)
{
sse_level = 1;
// set FLUSH_TO_ZERO to ON and
// set round towards zero (RZ)
_mm_setcsr(_mm_getcsr() | 0x8000|0x6000);if (dx & 0x04000000)
{
sse_level = 2;if (cx & 0x00000001)
{
sse_level = 3;
// set DENORMALS_ARE_ZERO to ON
_mm_setcsr(_mm_getcsr() | 0x0040);
}
// we should have checked for AMD K8 without SSE3 here:
// if(AMD_K8_NO_SSE3)
// .. but I can't recall how to that :-/
}
}
} else
// clear underflow and precision flags
// and set DAZ and FTZ to OFF
// and restore round to nearest (RN)
_mm_setcsr(_mm_getcsr() & ~(0x0030|0x8000|0x0040|0x6000));return sse_level;
}On Wed, 2009-08-19 at 12:37 +0200, Tim Goetze wrote:
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
LINUX® is a registered trademark of Linus Torvalds in the USA and other countries.
Linuxaudio.org logo copyright Thorsten Wilms © 2006.
Hosting provided by the Virginia Tech Department of Music and DISIS.