+#include "pipe/p_config.h"
#include "util/u_math.h"
#include "util/u_cpu_detect.h"
+#if defined(PIPE_ARCH_SSE)
+#include <xmmintrin.h>
+/* This is defined in pmmintrin.h, but it can only be included when -msse3 is
+ * used, so just define it here to avoid further. */
+#define _MM_DENORMALS_ZERO_MASK 0x0040
+#endif
+
/** 2^x, for x in [-1.0, 1.0) */
float pow2_table[POW2_TABLE_SIZE];
{
unsigned mxcsr = 0;
-#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
+#if defined(PIPE_ARCH_SSE)
if (util_cpu_caps.has_sse) {
- mxcsr = __builtin_ia32_stmxcsr();
+ mxcsr = _mm_getcsr();
}
#endif
unsigned
util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
{
-#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
-#define MXCSR_DAZ (1 << 6) /* Enable denormals are zero mode */
-#define MXCSR_FTZ (1 << 15) /* Enable flush to zero mode */
+#if defined(PIPE_ARCH_SSE)
if (util_cpu_caps.has_sse) {
- current_mxcsr |= MXCSR_FTZ;
+ /* Enable flush to zero mode */
+ current_mxcsr |= _MM_FLUSH_ZERO_MASK;
if (util_cpu_caps.has_sse3) {
- current_mxcsr |= MXCSR_DAZ;
+ /* Enable denormals are zero mode */
+ current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
}
util_fpstate_set(current_mxcsr);
}
void
util_fpstate_set(unsigned mxcsr)
{
-#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
+#if defined(PIPE_ARCH_SSE)
if (util_cpu_caps.has_sse) {
- __builtin_ia32_ldmxcsr(mxcsr);
+ _mm_setcsr(mxcsr);
}
#endif
}