aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/ppc/cpu.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-05-10 04:15:59 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-05-31 12:07:11 +0200
commit7d07ee5a9bd170a06d26fd967cf8de5d3b1ce331 (patch)
tree9ae630ffc9ba2317ae88a9894efdf323d7442210 /libavutil/ppc/cpu.c
parentda60b99a8857d5ca236f32c1799a066e0135a866 (diff)
downloadffmpeg-7d07ee5a9bd170a06d26fd967cf8de5d3b1ce331.tar.gz
ppc: cpu: Add support for VSX and POWER8 extensions
Diffstat (limited to 'libavutil/ppc/cpu.c')
-rw-r--r--libavutil/ppc/cpu.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 27a2853854..298185684b 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -85,6 +85,14 @@ int ff_get_cpu_flags_ppc(void)
if (buf[i] == AT_HWCAP) {
if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC)
ret = AV_CPU_FLAG_ALTIVEC;
+#ifdef PPC_FEATURE_HAS_VSX
+ if (buf[i + 1] & PPC_FEATURE_HAS_VSX)
+ ret |= AV_CPU_FLAG_VSX;
+#endif
+#ifdef PPC_FEATURE_ARCH_2_07
+ if (buf[i + 1] & PPC_FEATURE_HAS_POWER8)
+ ret |= AV_CPU_FLAG_POWER8;
+#endif
goto out;
}
}
@@ -103,7 +111,7 @@ out:
#define PVR_POWER7 0x003F
#define PVR_POWER8 0x004B
#define PVR_CELL_PPU 0x0070
-
+ int ret = 0;
int proc_ver;
// Support of mfspr PVR emulation added in Linux 2.6.17.
__asm__ volatile("mfspr %0, 287" : "=r" (proc_ver));
@@ -118,8 +126,14 @@ out:
proc_ver == PVR_POWER7 ||
proc_ver == PVR_POWER8 ||
proc_ver == PVR_CELL_PPU)
- return AV_CPU_FLAG_ALTIVEC;
- return 0;
+ ret = AV_CPU_FLAG_ALTIVEC;
+ if (proc_ver == PVR_POWER7 ||
+ proc_ver == PVR_POWER8)
+ ret |= AV_CPU_FLAG_VSX;
+ if (proc_ver == PVR_POWER8)
+ ret |= AV_CPU_FLAG_POWER8;
+
+ return ret;
#else
// Since we were compiled for AltiVec, just assume we have it
// until someone comes up with a proper way (not involving signal hacks).