Attached is a patch to fix the incorrect CPU feature detection:


On 2.1.2017 16.39, Janne Hyvärinen wrote:
Something seems to be wrong with cpu.c CPU detection code. When I compile things with MSVC all instructions except FMA is detected as missing, even though they are present in my CPU. That of course results in awful performance.


_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

diff --git a/src/libFLAC/cpu.c b/src/libFLAC/cpu.c
index b9df19a..808d55d 100644
--- a/src/libFLAC/cpu.c
+++ b/src/libFLAC/cpu.c
@@ -269,9 +269,9 @@ void FLAC__cpu_info_x86(FLAC__uint32 level, FLAC__uint32 
*eax, FLAC__uint32 *ebx
        __cpuid(cpuinfo, ext);
        if((unsigned)cpuinfo[0] >= level) {
 #if FLAC__AVX_SUPPORTED
-               __cpuidex(cpuinfo, ext, 0); /* for AVX2 detection */
+               __cpuidex(cpuinfo, level, 0); /* for AVX2 detection */
 #else
-               __cpuid(cpuinfo, ext); /* some old compilers don't support 
__cpuidex */
+               __cpuid(cpuinfo, level); /* some old compilers don't support 
__cpuidex */
 #endif
 
                *eax = cpuinfo[0]; *ebx = cpuinfo[1]; *ecx = cpuinfo[2]; *edx = 
cpuinfo[3];
_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to