Re: [LAD] is this a compiler issue??

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Tim Goetze <tim@...>
Cc: <linux-audio-dev@...>
Date: Wednesday, August 19, 2009 - 11:06 am

#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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] is this a compiler issue??, Conrad , (Wed Aug 19, 9:52 am)
Re: [LAD] is this a compiler issue??, Conrad , (Thu Aug 27, 2:23 pm)
Re: [LAD] is this a compiler issue??, Jens M Andreasen, (Thu Aug 27, 3:40 pm)
Re: [LAD] is this a compiler issue??, Fons Adriaensen, (Wed Aug 19, 12:36 pm)
Re: [LAD] is this a compiler issue??, Conrad , (Wed Aug 19, 4:34 pm)
Re: [LAD] is this a compiler issue??, Tim Goetze, (Wed Aug 19, 10:37 am)
Re: [LAD] is this a compiler issue??, Jens M Andreasen, (Wed Aug 19, 11:06 am)
Re: [LAD] is this a compiler issue??, Conrad , (Wed Aug 19, 10:56 am)
Re: [LAD] is this a compiler issue??, Tim Goetze, (Wed Aug 19, 1:49 pm)
Re: [LAD] is this a compiler issue??, Conrad , (Wed Aug 19, 3:42 pm)
Re: [LAD] is this a compiler issue??, Jens M Andreasen, (Wed Aug 19, 7:35 pm)
Re: [LAD] is this a compiler issue??, Chris Cannam, (Wed Aug 19, 3:46 pm)