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 at xiph.org > http://lists.xiph.org/mailman/listinfo/flac-dev-------------- next part -------------- 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];
Janne Hyvärinen wrote:> Attached is a patch to fix the incorrect CPU feature detection:Patched applied, but the CPU detection code remains, horrible to read, difficult to reason about, work on and maintain. This fix probably warrants a new release, but I'll hold off for a week or so to make sure nothing else needs fixing. Thanks, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
lvqcl.mail
2017-Jan-02 18:11 UTC
[flac-dev] [PATCH] fix compile in MSVC if UNICODE is defined (SF bug 447)
Erik de Castro Lopo wrote:> This fix probably warrants a new release, but I'll hold off for a > week or so to make sure nothing else needs fixing.Speaking of which... the attched patch fixes building when UNICODE preprocessor macro is defined (it's explained here: <http://stackoverflow.com/questions/3298569/difference-between-mbcs-and-utf-8-on-windows>). It should fix this - <https://sourceforge.net/p/flac/bugs/447/> Not a big problem though. I'm not even sure that it's a bug. -------------- next part -------------- A non-text attachment was scrubbed... Name: ms_unicode.patch Type: application/octet-stream Size: 1150 bytes Desc: not available URL: <http://lists.xiph.org/pipermail/flac-dev/attachments/20170102/d20e1a44/attachment-0001.obj>