Skip to content
Snippets Groups Projects
Commit ad426355 authored by Lyndon Brown's avatar Lyndon Brown
Browse files

cpu: expand x86/x86_64 feature coverage

 - added detection for: FMA3, BMI1, BMI2, POPCNT, LZCNT, AVX512.
 - added missing detection on non-linux for: AVX, AVX2, FMA4, XOP, SSE4a.
   (with thanks to libx264 in combination with intel docs).
 - fixed broken detection of fma3 on linux - the string checked for needs
   to be "fma" not "fma3" at least on my system.

in the latter case, these were already detected on linux via the
alternative `/proc/cpuid` based cpuid detection, but were not handled by
the generic solution used on other platforms.

a xor operation is performed upon ecx to zero it before calling cpuid since
when calling cpuid with eax=7 to get extended features, we need to also
have ecx=0 to get the right data set for our needs, as detailed on
wikipedia ([1]).

the added AVX2 detection will enable my AVX2 chroma plugin to work on
non-linux systems as well as linux. the rest i have no plans for, but we
already have ones that are unused so why not expand coverage.

i removed the obsolete `i_` prefix from the integer variables to avoid
having to use them in all of the new code added.

the AVX512 detection looks for a specific subset of available AVX512 flags
(there are several). i've simply copied that used in libx264.

i don't expect `__AVX512__` will actually work, but it'll do for now.

[1]: https://en.wikipedia.org/wiki/CPUID
parent 04fad74a
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment