comparison ppc/check_altivec.c @ 6159:eb2e3c3b7f78 libavcodec

Add mfspr-based AltiVec detection code. Currently not enabled in FFmpeg, because it crashes if the OS does not emulate mfspr.
author reimar
date Sat, 19 Jan 2008 19:27:39 +0000
parents ace63c809071
children c93570aeb3eb
comparison
equal deleted inserted replaced
6158:2f43560f5dba 6159:eb2e3c3b7f78
52 52
53 err = sysctl(sels, 2, &has_vu, &len, NULL, 0); 53 err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
54 54
55 if (err == 0) return (has_vu != 0); 55 if (err == 0) return (has_vu != 0);
56 return 0; 56 return 0;
57 #elif defined(RUNTIME_CPUDETECT)
58 int proc_ver;
59 // support of mfspr PVR emulation added in Linux 2.6.17
60 asm volatile("mfspr %0, 287" : "=r" (proc_ver));
61 proc_ver >>= 16;
62 if (proc_ver & 0x8000 ||
63 proc_ver == 0x000c ||
64 proc_ver == 0x0039 || proc_ver == 0x003c ||
65 proc_ver == 0x0044 || proc_ver == 0x0045 ||
66 proc_ver == 0x0070)
67 return 1;
68 return 0;
57 #else 69 #else
58 // since we were compiled for altivec, just assume we have it 70 // since we were compiled for altivec, just assume we have it
59 // until someone comes up with a proper way (not involving signal hacks). 71 // until someone comes up with a proper way (not involving signal hacks).
60 return 1; 72 return 1;
61 #endif /* __AMIGAOS4__ */ 73 #endif /* __AMIGAOS4__ */