[Mesa-dev] [PATCH] mesa: Permanently enable features supported by target CPU at compile time.

Siavash Eliasi siavashserver at gmail.com
Fri Nov 7 22:43:50 PST 2014


This will remove the need for unnecessary runtime checks for CPU features if
already supported by target CPU, resulting in smaller and less branchy code.
---
 src/mesa/x86/common_x86_features.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h
index 66f2cf6..9888c26 100644
--- a/src/mesa/x86/common_x86_features.h
+++ b/src/mesa/x86/common_x86_features.h
@@ -67,5 +67,30 @@
 #define cpu_has_3dnowext	(_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
 #define cpu_has_sse4_1		(_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
 
+/* Permanently enable features supported by target CPU at compile time */
+#ifdef __MMX__
+#define cpu_has_mmx		1
+#endif
+
+#ifdef __SSE__
+#define cpu_has_xmm		1
+#endif
+
+#ifdef __SSE2__
+#define cpu_has_xmm2		1
+#endif
+
+#ifdef __3dNOW__
+#define cpu_has_3dnow		1
+#endif
+
+#ifdef __SSSE3__
+#define cpu_has_ssse3		1
+#endif
+
+#ifdef __SSE4_1__
+#define cpu_has_sse4_1		1
+#endif
+
 #endif
 
-- 
2.1.3



More information about the mesa-dev mailing list