aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/x86
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-03-17 16:53:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-03-17 17:22:52 +0100
commit0fecf2642b9d909820683647c70031a954f5e58d (patch)
tree36ca02de9fa27a049829fb589517223d2d0ce5f5 /libavcodec/x86
parente309fdc7018a1027d187ec27fb1d69a41a4ee167 (diff)
parentf1f60f5252b0b448adcce0c1c52f3161ee69b9bf (diff)
downloadffmpeg-0fecf2642b9d909820683647c70031a954f5e58d.tar.gz
Merge remote-tracking branch 'newdev/master'
Conflicts: Changelog doc/APIchanges doc/optimization.txt libavformat/avio.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86')
-rw-r--r--libavcodec/x86/mathops.h53
1 files changed, 37 insertions, 16 deletions
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index 5949dfe3d4..33d9a6c8ff 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -26,24 +26,45 @@
#include "libavutil/common.h"
#if ARCH_X86_32
-#define MULL(ra, rb, shift) \
- ({ int rt, dummy; __asm__ (\
- "imull %3 \n\t"\
- "shrdl %4, %%edx, %%eax \n\t"\
- : "=a"(rt), "=d"(dummy)\
- : "a" ((int)(ra)), "rm" ((int)(rb)), "i"(shift));\
- rt; })
-#define MULH(ra, rb) \
- ({ int rt, dummy;\
- __asm__ ("imull %3\n\t" : "=d"(rt), "=a"(dummy): "a" ((int)(ra)), "rm" ((int)(rb)));\
- rt; })
+#define MULL MULL
+static av_always_inline av_const int MULL(int a, int b, unsigned shift)
+{
+ int rt, dummy;
+ __asm__ (
+ "imull %3 \n\t"
+ "shrdl %4, %%edx, %%eax \n\t"
+ :"=a"(rt), "=d"(dummy)
+ :"a"(a), "rm"(b), "ci"((uint8_t)shift)
+ );
+ return rt;
+}
-#define MUL64(ra, rb) \
- ({ int64_t rt;\
- __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)(ra)), "g" ((int)(rb)));\
- rt; })
-#endif
+#define MULH MULH
+static av_always_inline av_const int MULH(int a, int b)
+{
+ int rt, dummy;
+ __asm__ (
+ "imull %3"
+ :"=d"(rt), "=a"(dummy)
+ :"a"(a), "rm"(b)
+ );
+ return rt;
+}
+
+#define MUL64 MUL64
+static av_always_inline av_const int64_t MUL64(int a, int b)
+{
+ int64_t rt;
+ __asm__ (
+ "imull %2"
+ :"=A"(rt)
+ :"a"(a), "rm"(b)
+ );
+ return rt;
+}
+
+#endif /* ARCH_X86_32 */
#if HAVE_CMOV
/* median of 3 */