mesa: Permanently enable features supported by target CPU at compile time.
authorSiavash Eliasi <siavashserver@gmail.com>
Sat, 8 Nov 2014 08:35:05 +0000 (12:05 +0330)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 26 Nov 2014 20:08:38 +0000 (20:08 +0000)
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.

V2:
- Removed the SSSE3 related part for the not yet merged patch.
- Avoiding redefinition of macros.

Tested-by: David Heidelberg <david@ixit.cz>
src/mesa/x86/common_x86_features.h

index 66f2cf651c2d85b8a2e85d9a81d3e09780bc0cd3..65634aa5dff906d16e32d0a42bb7eeb941a64eb3 100644 (file)
 #define X86_CPUEXT_3DNOW_EXT   (1<<30)
 #define X86_CPUEXT_3DNOW       (1<<31)
 
+#ifdef __MMX__
+#define cpu_has_mmx            1
+#else
 #define cpu_has_mmx            (_mesa_x86_cpu_features & X86_FEATURE_MMX)
+#endif
+
 #define cpu_has_mmxext         (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT)
+
+#ifdef __SSE__
+#define cpu_has_xmm            1
+#else
 #define cpu_has_xmm            (_mesa_x86_cpu_features & X86_FEATURE_XMM)
+#endif
+
+#ifdef __SSE2__
+#define cpu_has_xmm2           1
+#else
 #define cpu_has_xmm2           (_mesa_x86_cpu_features & X86_FEATURE_XMM2)
+#endif
+
+#ifdef __3dNOW__
+#define cpu_has_3dnow          1
+#else
 #define cpu_has_3dnow          (_mesa_x86_cpu_features & X86_FEATURE_3DNOW)
+#endif
+
 #define cpu_has_3dnowext       (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
+
+#ifdef __SSE4_1__
+#define cpu_has_sse4_1         1
+#else
 #define cpu_has_sse4_1         (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
+#endif
 
 #endif