changeset 9596:182f35c8eaed libavcodec

PPC: implement MULH() in assembler Left to its own devices, gcc calculates the full 64-bit product only to discard the low 32 bits. This forces it to do the right thing. 20% faster MP3 decoding on G4.
author mru
date Mon, 04 May 2009 17:31:15 +0000
parents f9a7147cc9e6
children b60289b3e29a
files ppc/mathops.h
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ppc/mathops.h	Mon May 04 14:23:48 2009 +0000
+++ b/ppc/mathops.h	Mon May 04 17:31:15 2009 +0000
@@ -37,4 +37,11 @@
     __rt; })
 #endif
 
+#define MULH MULH
+static inline av_const int MULH(int a, int b){
+    int r;
+    __asm__ ("mulhw %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
+    return r;
+}
+
 #endif /* AVCODEC_PPC_MATHOPS_H */