[flac-dev] FLAC__SSE_OS change

lvqcl lvqcl.mail at gmail.com
Sun Jun 26 12:13:17 UTC 2016

Erik de Castro Lopo wrote:

> lvqcl wrote:
>> No, MSVC 2015 is also affected. I renamed __cpuid() to __cpuid22(),
> I thought the original problem was with  `___cpuidex`, not `__cpuid`!

VC2005 generates code that uses __cpuid() because VC2005 has no __cpuidex().

VC2015 generates code that uses __cpuidex() and doesn't use __cpuid(),
although VC2015 has both __cpuid() and __cpuidex().

If you're only concerned about the following code

         __cpuidex(cpuinfo, level, 0); /* for AVX2 detection */
         __cpuid(cpuinfo, level); /* some old compilers don't support __cpuidex */

then MSVC 2015 can create debug builds because it has both __cpuid() and __cpuidex()

But I thought that you're more concerned about DCE issue in general.
So I changed existing __cpuid() into non-existing __cpuid22().
For VC2015, FLAC__AVX_SUPPORTED is defined as 1, so the code always
calls __cpuidex() and never calls (non-existing) __cpuid22().
Yet MSVC 2015 cannot create debug build.

So this proves that MSVC 2015 cannot discard unused references in debug builds.

More information about the flac-dev mailing list