00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AVCODEC_X86_MATHOPS_H
00023 #define AVCODEC_X86_MATHOPS_H
00024
00025 #include "config.h"
00026 #include "libavutil/common.h"
00027
00028 #if ARCH_X86_32
00029 #define MULL(ra, rb, shift) \
00030 ({ int rt, dummy; __asm__ (\
00031 "imull %3 \n\t"\
00032 "shrdl %4, %%edx, %%eax \n\t"\
00033 : "=a"(rt), "=d"(dummy)\
00034 : "a" ((int)ra), "rm" ((int)rb), "i"(shift));\
00035 rt; })
00036
00037 #define MULH(ra, rb) \
00038 ({ int rt, dummy;\
00039 __asm__ ("imull %3\n\t" : "=d"(rt), "=a"(dummy): "a" ((int)ra), "rm" ((int)rb));\
00040 rt; })
00041
00042 #define MUL64(ra, rb) \
00043 ({ int64_t rt;\
00044 __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)ra), "g" ((int)rb));\
00045 rt; })
00046 #endif
00047
00048 #if HAVE_CMOV
00049
00050 #define mid_pred mid_pred
00051 static inline av_const int mid_pred(int a, int b, int c)
00052 {
00053 int i=b;
00054 __asm__ volatile(
00055 "cmp %2, %1 \n\t"
00056 "cmovg %1, %0 \n\t"
00057 "cmovg %2, %1 \n\t"
00058 "cmp %3, %1 \n\t"
00059 "cmovl %3, %1 \n\t"
00060 "cmp %1, %0 \n\t"
00061 "cmovg %1, %0 \n\t"
00062 :"+&r"(i), "+&r"(a)
00063 :"r"(b), "r"(c)
00064 );
00065 return i;
00066 }
00067 #endif
00068
00069 #endif