15#ifndef QMATH_HELPERS_H
16#define QMATH_HELPERS_H
18#if !(defined(__ARM_NEON) || defined(__aarch64__)) && __has_include(<xmmintrin.h>)
19 #include <xmmintrin.h>
20 #if __has_include(<pmmintrin.h>)
21 #include <pmmintrin.h>
23#elif __has_include(<cfenv>)
27static void disable_denormals()
29#if !(defined(__ARM_NEON) || defined(__aarch64__)) && __has_include(<xmmintrin.h>)
30 #if defined(_MM_FLUSH_ZERO_OFF) && defined(_MM_DENORMALS_ZERO_ON)
31 _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
32 _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
34 #ifndef _MM_FLUSH_ZERO_ON
35 #define _MM_FLUSH_ZERO_ON 0x8000
37 #ifndef _MM_DENORMALS_ZERO_ON
38 #define _MM_DENORMALS_ZERO_ON 0x0040
40 _mm_setcsr(_mm_getcsr() | (_MM_FLUSH_ZERO_ON | _MM_DENORMALS_ZERO_ON));
42#elif __has_include(<cfenv>) && defined(FE_DFL_DISABLE_SSE_DENORMS_ENV)
43 fesetenv(FE_DFL_DISABLE_SSE_DENORMS_ENV);