On 2013-06-26 19:43, Derek Buitenhuis wrote:
--- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -199,3 +199,50 @@ int ff_get_cpu_flags_x86(void) + +#if HAVE_MMX +#ifdef __INTEL_COMPILER +/* Agner's patch to Intel's CPU dispatcher from pages 131-132 of + * http://agner.org/optimize/optimizing_cpp.pdf (2011-01-30) + * adapted to Libav's cpu schema. Copied from x264 and adapted for Libav. */ + +/* Global variable indicating CPU */ +int __intel_cpu_indicator = 0;
Identifiers starting with __ are reserved for the system.
+/* CPU dispatcher function */ +void ff_intel_cpu_indicator_init(void)
This appears unused outside of the file, so it could be static. But that should trigger a -Werror warning, so I wonder if this code path has been tested...
+ unsigned int cpu = ff_get_cpu_flags_x86();
unrelated: Do we have a global preference between "unsigned" and "unsigned int"?
+ if (cpu & AV_CPU_FLAG_AVX) + __intel_cpu_indicator = 0x20000; + else if (cpu & AV_CPU_FLAG_SSE42) + __intel_cpu_indicator = 0x8000; + else if (cpu & AV_CPU_FLAG_SSE4) + __intel_cpu_indicator = 0x2000; + else if (cpu & AV_CPU_FLAG_SSSE3) + __intel_cpu_indicator = 0x1000; + else if (cpu & AV_CPU_FLAG_SSE3) + __intel_cpu_indicator = 0x800; + else if (cpu & AV_CPU_FLAG_SSE2 && !(cpu & AV_CPU_FLAG_SSE2SLOW)) + __intel_cpu_indicator = 0x200; + else if (cpu & AV_CPU_FLAG_SSE) + __intel_cpu_indicator = 0x80; + else if (cpu & AV_CPU_FLAG_MMXEXT) + __intel_cpu_indicator = 8; + else + __intel_cpu_indicator = 1;
No MMX?
+/* __intel_cpu_indicator_init appears to have a non-standard calling convention + * that assumes certain registers aren't preserved, so we'll route it through a + * function that backs up all the registers. */ +void __intel_cpu_indicator_init(void)
see above about __ Diego _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
