mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-19 16:01:45 +00: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
|
@ -184,13 +184,18 @@ x86_init(struct impl *impl)
|
|||
static int x86_zero_denormals(void *object, bool enable)
|
||||
{
|
||||
#if defined(HAVE_SSE)
|
||||
unsigned int mxcsr;
|
||||
mxcsr = _mm_getcsr();
|
||||
if (enable)
|
||||
mxcsr |= 0x8040;
|
||||
else
|
||||
mxcsr &= ~0x8040;
|
||||
_mm_setcsr(mxcsr);
|
||||
struct impl *impl = object;
|
||||
if (impl->flags & SPA_CPU_FLAG_SSE) {
|
||||
unsigned int mxcsr;
|
||||
mxcsr = _mm_getcsr();
|
||||
if (enable)
|
||||
mxcsr |= 0x8040;
|
||||
else
|
||||
mxcsr &= ~0x8040;
|
||||
_mm_setcsr(mxcsr);
|
||||
spa_log_debug(impl->log, "%p: zero-denormals:%s",
|
||||
impl, enable ? "on" : "off");
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
return -ENOTSUP;
|
||||
|
|
Loading…
Reference in a new issue