From 8b130b38660be418759c6ca481a8e09217dc6931 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 25 Dec 2015 06:14:57 +0100 Subject: [PATCH] Add RETRO_SIMD_POPCNT and RETRO_SIMD_MOVBE --- frontend/drivers/platform_linux.c | 6 +++--- libretro.h | 2 ++ performance.c | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 321e793615..c2c6e78fe3 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -421,11 +421,11 @@ static void linux_cpu_init(void) regs[3] == VENDOR_INTEL_d); x86_cpuid(1, regs); - if ((regs[2] & (1 << 9)) != 0) + if ((regs[2] & (1 << 9))) g_cpuFeatures |= CPU_X86_FEATURE_SSSE3; - if ((regs[2] & (1 << 23)) != 0) + if ((regs[2] & (1 << 23))) g_cpuFeatures |= CPU_X86_FEATURE_POPCNT; - if (vendorIsIntel && (regs[2] & (1 << 22)) != 0) + if (vendorIsIntel && (regs[2] & (1 << 22))) g_cpuFeatures |= CPU_X86_FEATURE_MOVBE; #endif diff --git a/libretro.h b/libretro.h index 6a4041f569..ddf273de2a 100644 --- a/libretro.h +++ b/libretro.h @@ -1166,6 +1166,8 @@ struct retro_log_callback #define RETRO_SIMD_AES (1 << 15) #define RETRO_SIMD_VFPV3 (1 << 16) #define RETRO_SIMD_VFPV4 (1 << 17) +#define RETRO_SIMD_POPCNT (1 << 18) +#define RETRO_SIMD_MOVBE (1 << 19) typedef uint64_t retro_perf_tick_t; typedef int64_t retro_time_t; diff --git a/performance.c b/performance.c index ce7e2103c2..1ef47a2742 100644 --- a/performance.c +++ b/performance.c @@ -486,6 +486,7 @@ uint64_t retro_get_cpu_features(void) cpu |= RETRO_SIMD_MMXEXT; } + if (flags[3] & (1 << 26)) cpu |= RETRO_SIMD_SSE2; @@ -501,6 +502,9 @@ uint64_t retro_get_cpu_features(void) if (flags[2] & (1 << 20)) cpu |= RETRO_SIMD_SSE42; + if ((flags[2] & (1 << 23))) + cpu |= RETRO_SIMD_POPCNT; + if (flags[2] & (1 << 25)) cpu |= RETRO_SIMD_AES;