Просмотр исходного кода

Common: Move SSE detection ifdefs to platform.h

Yuri Kunde Schlesner 11 лет назад
Родитель
Сommit
ae963d75f8
3 измененных файлов с 21 добавлено и 16 удалено
  1. 0 16
      src/common/common.h
  2. 2 0
      src/common/hash.cpp
  3. 19 0
      src/common/platform.h

+ 0 - 16
src/common/common.h

@@ -39,20 +39,4 @@
     #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
     #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
 #endif
 #endif
 
 
-#if defined _M_GENERIC
-#  define _M_SSE 0x0
-#elif defined __GNUC__
-# if defined __SSE4_2__
-#  define _M_SSE 0x402
-# elif defined __SSE4_1__
-#  define _M_SSE 0x401
-# elif defined __SSSE3__
-#  define _M_SSE 0x301
-# elif defined __SSE3__
-#  define _M_SSE 0x300
-# endif
-#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008
-#  define _M_SSE 0x402
-#endif
-
 #include "swap.h"
 #include "swap.h"

+ 2 - 0
src/common/hash.cpp

@@ -5,6 +5,8 @@
 #include <algorithm>
 #include <algorithm>
 
 
 #include "common/hash.h"
 #include "common/hash.h"
+#include "common/platform.h"
+
 #if _M_SSE >= 0x402
 #if _M_SSE >= 0x402
 #include "common/cpu_detect.h"
 #include "common/cpu_detect.h"
 #include <nmmintrin.h>
 #include <nmmintrin.h>

+ 19 - 0
src/common/platform.h

@@ -63,6 +63,25 @@
 #define EMU_ARCHITECTURE_X86
 #define EMU_ARCHITECTURE_X86
 #endif
 #endif
 
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Feature detection
+
+#if defined _M_GENERIC
+#  define _M_SSE 0x0
+#elif defined __GNUC__
+# if defined __SSE4_2__
+#  define _M_SSE 0x402
+# elif defined __SSE4_1__
+#  define _M_SSE 0x401
+# elif defined __SSSE3__
+#  define _M_SSE 0x301
+# elif defined __SSE3__
+#  define _M_SSE 0x300
+# endif
+#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008
+#  define _M_SSE 0x402
+#endif
+
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 // Compiler-Specific Definitions
 // Compiler-Specific Definitions