Merge remote branch 'origin/7.8'
[mesa.git] / src / gallium / auxiliary / rtasm / rtasm_cpu.c
index eb3359750b4ff57e4aa9e24019a5573eea94442f..2e15751e5086d80e5f3e36162f7176bd7edb610a 100644 (file)
  **************************************************************************/
 
 
+#include "util/u_debug.h"
 #include "rtasm_cpu.h"
 
 
+#if defined(PIPE_ARCH_X86)
+static boolean rtasm_sse_enabled(void)
+{
+   static boolean firsttime = 1;
+   static boolean enabled;
+   
+   /* This gets called quite often at the moment:
+    */
+   if (firsttime) {
+      enabled =  !debug_get_bool_option("GALLIUM_NOSSE", FALSE);
+      firsttime = FALSE;
+   }
+   return enabled;
+}
+#endif
+
 int rtasm_cpu_has_sse(void)
 {
    /* FIXME: actually detect this at run-time */
-#if defined(__i386__) || defined(__386__)
-   return 1;
+#if defined(PIPE_ARCH_X86)
+   return rtasm_sse_enabled();
 #else
    return 0;
 #endif
@@ -42,8 +59,8 @@ int rtasm_cpu_has_sse(void)
 int rtasm_cpu_has_sse2(void) 
 {
    /* FIXME: actually detect this at run-time */
-#if defined(__i386__) || defined(__386__)
-   return 1;
+#if defined(PIPE_ARCH_X86)
+   return rtasm_sse_enabled();
 #else
    return 0;
 #endif