[flac-dev] Q: test for CPUID instruction presence

lvqcl.mail lvqcl.mail at gmail.com
Mon Dec 5 16:49:52 UTC 2016


Erik de Castro Lopo wrote:

> lvqcl.mail wrote:
>
>> Currently libFLAC doesn't check the existence of CPUID instruction if
>> FLAC__HAS_X86INTRIN is set to 1.
>> It's not a real problem because x86 CPUs without CPUID are probably
>> extinct, but if libFLAC performs this check then it should do it
>> in all cases (when NASM is available or intrinsics are available).
>
> This code in cpu.c has been a mess for over a decade. Forunately the
> need for complexity is decreasing.
>
> I propose that we release FLAC with cpu.c as it is now and deal with
> the consequences as they arise.

Makes sense.

But still... IMHO it makes sense to change "if !FLAC__HAS_X86INTRIN"
to "if defined FLAC__HAS_NASM". It covers more cases, and it's logical:
FLAC__cpu_have_cpuid_asm_ia32() can be called if (and only if) NASM is  
available.
(the patch is attached just in case).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: have_cpuid.patch
Type: application/octet-stream
Size: 456 bytes
Desc: not available
URL: <http://lists.xiph.org/pipermail/flac-dev/attachments/20161205/b52dad2d/attachment.obj>


More information about the flac-dev mailing list