From 71e2487e8b9ec7f2cd06df9b5793e61735a52b60 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 25 Dec 2015 06:17:17 +0100 Subject: [PATCH] Implement RETRO_SIMD_MOVBE --- performance.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/performance.c b/performance.c index 1ef47a2742..86417c1017 100644 --- a/performance.c +++ b/performance.c @@ -430,6 +430,11 @@ unsigned retro_get_cpu_cores(void) #endif } +/* According to http://en.wikipedia.org/wiki/CPUID */ +#define VENDOR_INTEL_b 0x756e6547 +#define VENDOR_INTEL_c 0x6c65746e +#define VENDOR_INTEL_d 0x49656e69 + /** * retro_get_cpu_features: * @@ -446,6 +451,7 @@ uint64_t retro_get_cpu_features(void) uint64_t cpu = 0; unsigned max_flag = 0; #if defined(CPU_X86) + int vendor_is_intel = 0; const int avx_flags = (1 << 27) | (1 << 28); #endif @@ -470,6 +476,11 @@ uint64_t retro_get_cpu_features(void) RARCH_LOG("[CPUID]: Vendor: %s\n", vendor); + vendor_is_intel = ( + flags[1] == VENDOR_INTEL_b && + flags[2] == VENDOR_INTEL_c && + flags[3] == VENDOR_INTEL_d); + max_flag = flags[0]; if (max_flag < 1) /* Does CPUID not support func = 1? (unlikely ...) */ return 0; @@ -505,6 +516,9 @@ uint64_t retro_get_cpu_features(void) if ((flags[2] & (1 << 23))) cpu |= RETRO_SIMD_POPCNT; + if (vendor_is_intel && (flags[2] & (1 << 22))) + cpu |= RETRO_SIMD_MOVBE; + if (flags[2] & (1 << 25)) cpu |= RETRO_SIMD_AES;