Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / util / u_math.c
index bf0c398eeec8424b98dd89f766438740786f1f2b..9a8a9ecbbdeeb824f859cd0e686ce9a1608d93c4 100644 (file)
 
 #include "pipe/p_config.h"
 #include "util/u_math.h"
 
 #include "pipe/p_config.h"
 #include "util/u_math.h"
-#include "x86/common_x86_features.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. */
 
 #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. */
+#ifndef _MM_DENORMALS_ZERO_MASK
 #define _MM_DENORMALS_ZERO_MASK        0x0040
 #endif
 #define _MM_DENORMALS_ZERO_MASK        0x0040
 #endif
+#endif
 
 
 /** 2^x, for x in [-1.0, 1.0) */
 
 
 /** 2^x, for x in [-1.0, 1.0) */
@@ -71,11 +73,11 @@ init_log2_table(void)
 void
 util_init_math(void)
 {
 void
 util_init_math(void)
 {
-   static boolean initialized = FALSE;
+   static bool initialized = false;
    if (!initialized) {
       init_pow2_table();
       init_log2_table();
    if (!initialized) {
       init_pow2_table();
       init_log2_table();
-      initialized = TRUE;
+      initialized = true;
    }
 }
 
    }
 }
 
@@ -90,7 +92,7 @@ util_fpstate_get(void)
    unsigned mxcsr = 0;
 
 #if defined(PIPE_ARCH_SSE)
    unsigned mxcsr = 0;
 
 #if defined(PIPE_ARCH_SSE)
-   if (cpu_has_xmm) {
+   if (util_cpu_caps.has_sse) {
       mxcsr = _mm_getcsr();
    }
 #endif
       mxcsr = _mm_getcsr();
    }
 #endif
@@ -98,31 +100,6 @@ util_fpstate_get(void)
    return mxcsr;
 }
 
    return mxcsr;
 }
 
-/* TODO: this was copied from u_cpu_detection. It's another case of duplication
- * between gallium and core mesa, and it would be nice to get rid of that
- * duplication as well.
- */
-#if defined(PIPE_ARCH_X86)
-PIPE_ALIGN_STACK static inline bool sse2_has_daz(void)
-{
-   struct {
-      uint32_t pad1[7];
-      uint32_t mxcsr_mask;
-      uint32_t pad2[128-8];
-   } PIPE_ALIGN_VAR(16) fxarea;
-
-   fxarea.mxcsr_mask = 0;
-#if defined(PIPE_CC_GCC)
-   __asm __volatile ("fxsave %0" : "+m" (fxarea));
-#elif defined(PIPE_CC_MSVC) || defined(PIPE_CC_ICL)
-   _fxsave(&fxarea);
-#else
-   fxarea.mxcsr_mask = 0;
-#endif
-   return !!(fxarea.mxcsr_mask & (1 << 6));
-}
-#endif
-
 /**
  * Make sure that the fp treats the denormalized floating
  * point numbers as zero.
 /**
  * Make sure that the fp treats the denormalized floating
  * point numbers as zero.
@@ -133,21 +110,13 @@ unsigned
 util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
 {
 #if defined(PIPE_ARCH_SSE)
 util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
 {
 #if defined(PIPE_ARCH_SSE)
-   if (cpu_has_xmm) {
+   if (util_cpu_caps.has_sse) {
       /* Enable flush to zero mode */
       current_mxcsr |= _MM_FLUSH_ZERO_MASK;
       /* Enable flush to zero mode */
       current_mxcsr |= _MM_FLUSH_ZERO_MASK;
-      /* x86_64 cpus always have daz, as do cpus with sse3 in fact, there's
-       * basically only a handful of very early pentium 4's that have sse2 but
-       * not daz.
-       */
-# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
-      if (sse2_has_daz()) {
-# endif
+      if (util_cpu_caps.has_daz) {
          /* Enable denormals are zero mode */
          current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
          /* Enable denormals are zero mode */
          current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
-# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
       }
       }
-#endif
       util_fpstate_set(current_mxcsr);
    }
 #endif
       util_fpstate_set(current_mxcsr);
    }
 #endif
@@ -163,7 +132,7 @@ void
 util_fpstate_set(unsigned mxcsr)
 {
 #if defined(PIPE_ARCH_SSE)
 util_fpstate_set(unsigned mxcsr)
 {
 #if defined(PIPE_ARCH_SSE)
-   if (cpu_has_xmm) {
+   if (util_cpu_caps.has_sse) {
       _mm_setcsr(mxcsr);
    }
 #endif
       _mm_setcsr(mxcsr);
    }
 #endif