ref: dca1dfb44be688da802604635a151d38235be993
parent: d5261b3b2f1cf6cad5b9b134322aa631de91f7a3
author: mmhoffm <mmhoffm>
date: Tue Sep 11 14:21:28 EDT 2007
blackfin fixed point multiplication optimization
--- a/libfaad/fixed.h
+++ b/libfaad/fixed.h
@@ -27,7 +27,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
-** $Id: fixed.h,v 1.28 2006/05/07 18:09:00 menno Exp $
+** $Id: fixed.h,v 1.29 2007/09/11 18:21:28 mmhoffm Exp $
**/
#ifndef __FIXED_H__
@@ -246,8 +246,26 @@
return _MulHigh(A,B) << (32-FRAC_BITS);
}
#else
+#ifdef __BFIN__
+#define _MulHigh(X,Y) ({ int xxo; \
+ asm ( \
+ "a1 = %2.H * %1.L (IS,M);\n\t" \
+ "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\
+ "a1 = a1 >>> 16;\n\t" \
+ "%0 = (a0 += a1);\n\t" \
+ : "=d" (xxo) : "d" (X), "d" (Y)); xxo; })
+
+#define MUL_F(X,Y) ({ int xxo; \
+ asm ( \
+ "a1 = %2.H * %1.L (M);\n\t" \
+ "a0 = %1.H * %2.H, a1+= %1.H * %2.L (M);\n\t" \
+ "a1 = a1 >>> 16;\n\t" \
+ "%0 = (a0 += a1);\n\t" \
+ : "=d" (xxo) : "d" (X), "d" (Y)); xxo; })
+#else
#define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
#define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
+#endif
#endif
#define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
#define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)