mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
cpu: only run SSE code when supported
Check if we can run SSE instructions before executing the denormals SSE code. Fixes #1775
This commit is contained in:
parent
7d9b49293c
commit
84ecebbd4e
1 changed files with 12 additions and 7 deletions
|
|
@ -184,6 +184,8 @@ x86_init(struct impl *impl)
|
||||||
static int x86_zero_denormals(void *object, bool enable)
|
static int x86_zero_denormals(void *object, bool enable)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_SSE)
|
#if defined(HAVE_SSE)
|
||||||
|
struct impl *impl = object;
|
||||||
|
if (impl->flags & SPA_CPU_FLAG_SSE) {
|
||||||
unsigned int mxcsr;
|
unsigned int mxcsr;
|
||||||
mxcsr = _mm_getcsr();
|
mxcsr = _mm_getcsr();
|
||||||
if (enable)
|
if (enable)
|
||||||
|
|
@ -191,6 +193,9 @@ static int x86_zero_denormals(void *object, bool enable)
|
||||||
else
|
else
|
||||||
mxcsr &= ~0x8040;
|
mxcsr &= ~0x8040;
|
||||||
_mm_setcsr(mxcsr);
|
_mm_setcsr(mxcsr);
|
||||||
|
spa_log_debug(impl->log, "%p: zero-denormals:%s",
|
||||||
|
impl, enable ? "on" : "off");
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue