Check for SSE2 and set the denormals-are-zero bit for mixing if available
This commit is contained in:
parent
b80efeb87d
commit
38a9e642df
@ -845,7 +845,7 @@ static void alc_initconfig(void)
|
||||
|
||||
capfilter = 0;
|
||||
#ifdef HAVE_SSE
|
||||
capfilter |= CPU_CAP_SSE;
|
||||
capfilter |= CPU_CAP_SSE | CPU_CAP_SSE2;
|
||||
#endif
|
||||
#ifdef HAVE_NEON
|
||||
capfilter |= CPU_CAP_NEON;
|
||||
@ -872,6 +872,8 @@ static void alc_initconfig(void)
|
||||
len = (next ? ((size_t)(next-str)) : strlen(str));
|
||||
if(strncasecmp(str, "sse", len) == 0)
|
||||
capfilter &= ~CPU_CAP_SSE;
|
||||
else if(strncasecmp(str, "sse2", len) == 0)
|
||||
capfilter &= ~CPU_CAP_SSE2;
|
||||
else if(strncasecmp(str, "neon", len) == 0)
|
||||
capfilter &= ~CPU_CAP_NEON;
|
||||
else
|
||||
|
@ -106,7 +106,11 @@ void FillCPUCaps(ALuint capfilter)
|
||||
{
|
||||
#ifdef bit_SSE
|
||||
if((cpuinf[0].regs[3]&bit_SSE))
|
||||
{
|
||||
caps |= CPU_CAP_SSE;
|
||||
if((cpuinf[0].regs[3]&bit_SSE2))
|
||||
caps |= CPU_CAP_SSE2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -119,7 +123,11 @@ void FillCPUCaps(ALuint capfilter)
|
||||
else
|
||||
{
|
||||
if(IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE))
|
||||
{
|
||||
caps |= CPU_CAP_SSE;
|
||||
if(IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE))
|
||||
caps |= CPU_CAP_SSE2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_NEON
|
||||
@ -127,9 +135,10 @@ void FillCPUCaps(ALuint capfilter)
|
||||
caps |= CPU_CAP_NEON;
|
||||
#endif
|
||||
|
||||
TRACE("Got caps:%s%s%s\n", ((caps&CPU_CAP_SSE)?((capfilter&CPU_CAP_SSE)?" SSE":" (SSE)"):""),
|
||||
((caps&CPU_CAP_NEON)?((capfilter&CPU_CAP_NEON)?" Neon":" (Neon)"):""),
|
||||
((!caps)?" -none-":""));
|
||||
TRACE("Got caps:%s%s%s%s\n", ((caps&CPU_CAP_SSE)?((capfilter&CPU_CAP_SSE)?" SSE":" (SSE)"):""),
|
||||
((caps&CPU_CAP_SSE)?((capfilter&CPU_CAP_SSE2)?" SSE2":" (SSE2)"):""),
|
||||
((caps&CPU_CAP_NEON)?((capfilter&CPU_CAP_NEON)?" Neon":" (Neon)"):""),
|
||||
((!caps)?" -none-":""));
|
||||
CPUCapFlags = caps & capfilter;
|
||||
}
|
||||
|
||||
@ -207,6 +216,8 @@ void SetMixerFPUMode(FPUCtl *ctl)
|
||||
ctl->sse_state = sseState;
|
||||
sseState |= 0x6000; /* set round-to-zero */
|
||||
sseState |= 0x8000; /* set flush-to-zero */
|
||||
if((CPUCapFlags&CPU_CAP_SSE2))
|
||||
sseState |= 0x0040; /* set denormals-are-zero */
|
||||
__asm__ __volatile__("ldmxcsr %0" : : "m" (*&sseState));
|
||||
}
|
||||
#endif
|
||||
|
@ -26,10 +26,10 @@ PROJECT(OpenAL C)
|
||||
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
|
||||
|
||||
|
||||
OPTION(ALSOFT_CPUEXT_SSE "Check for SSE CPU extensions" ON)
|
||||
OPTION(ALSOFT_CPUEXT_SSE "Check for SSE/SSE2 CPU extensions" ON)
|
||||
OPTION(ALSOFT_CPUEXT_NEON "Check for ARM Neon CPU extensions" ON)
|
||||
|
||||
OPTION(ALSOFT_REQUIRE_SSE "Require SSE CPU extensions" OFF)
|
||||
OPTION(ALSOFT_REQUIRE_SSE "Require SSE/SSE2 CPU extensions" OFF)
|
||||
OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon CPU extensions" OFF)
|
||||
|
||||
|
||||
|
@ -837,7 +837,8 @@ extern ALint RTPrioLevel;
|
||||
extern ALuint CPUCapFlags;
|
||||
enum {
|
||||
CPU_CAP_SSE = 1<<0,
|
||||
CPU_CAP_NEON = 1<<1,
|
||||
CPU_CAP_SSE2 = 1<<1,
|
||||
CPU_CAP_NEON = 1<<2,
|
||||
};
|
||||
|
||||
void FillCPUCaps(ALuint capfilter);
|
||||
|
@ -14,7 +14,7 @@
|
||||
## disable-cpu-exts:
|
||||
# Disables use of the listed CPU extensions. Certain methods may utilize CPU
|
||||
# extensions when detected, and this option is useful for preventing those
|
||||
# extensions from being used. The available extensions are: sse, neon.
|
||||
# extensions from being used. The available extensions are: sse, sse2, neon.
|
||||
# Specifying 'all' disables use of all extensions.
|
||||
#disable-cpu-exts =
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user