diff options
author | Chris Robinson <[email protected]> | 2013-05-22 16:59:20 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-22 17:04:37 -0700 |
commit | 38a9e642df2b7359cfc453bf47b2d584ed428cda (patch) | |
tree | 742df56d0f0ce23e6c662f3ebf493620b0269f31 /Alc | |
parent | b80efeb87d719fc87501e9042ff2bfe4bf38e739 (diff) |
Check for SSE2 and set the denormals-are-zero bit for mixing if available
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 4 | ||||
-rw-r--r-- | Alc/helpers.c | 17 |
2 files changed, 17 insertions, 4 deletions
@@ -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 diff --git a/Alc/helpers.c b/Alc/helpers.c index 9e347396..e16a907d 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -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 |