# HG changeset patch # User reimar # Date 1200770859 0 # Node ID eb2e3c3b7f78571c1551f3f93f467328344fe09e # Parent 2f43560f5dba31104ccc557aa302a9c0f28a0826 Add mfspr-based AltiVec detection code. Currently not enabled in FFmpeg, because it crashes if the OS does not emulate mfspr. diff -r 2f43560f5dba -r eb2e3c3b7f78 ppc/check_altivec.c --- a/ppc/check_altivec.c Sat Jan 19 11:04:02 2008 +0000 +++ b/ppc/check_altivec.c Sat Jan 19 19:27:39 2008 +0000 @@ -54,6 +54,18 @@ if (err == 0) return (has_vu != 0); return 0; +#elif defined(RUNTIME_CPUDETECT) + int proc_ver; + // support of mfspr PVR emulation added in Linux 2.6.17 + asm volatile("mfspr %0, 287" : "=r" (proc_ver)); + proc_ver >>= 16; + if (proc_ver & 0x8000 || + proc_ver == 0x000c || + proc_ver == 0x0039 || proc_ver == 0x003c || + proc_ver == 0x0044 || proc_ver == 0x0045 || + proc_ver == 0x0070) + return 1; + return 0; #else // since we were compiled for altivec, just assume we have it // until someone comes up with a proper way (not involving signal hacks).