00001 /* 00002 * simple math operations 00003 * 00004 * Copyright (C) 2007 Marc Hoffman <mmhoffm@gmail.com> 00005 * 00006 * This file is part of FFmpeg. 00007 * 00008 * FFmpeg is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * FFmpeg is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with FFmpeg; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 #ifndef AVCODEC_BFIN_MATHOPS_H 00023 #define AVCODEC_BFIN_MATHOPS_H 00024 00025 #if CONFIG_MPEGAUDIO_HP 00026 #define MULH(X,Y) ({ int xxo; \ 00027 __asm__ ( \ 00028 "a1 = %2.L * %1.L (FU);\n\t" \ 00029 "a1 = a1 >> 16;\n\t" \ 00030 "a1 += %2.H * %1.L (IS,M);\n\t" \ 00031 "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\ 00032 "a1 = a1 >>> 16;\n\t" \ 00033 "%0 = (a0 += a1);\n\t" \ 00034 : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; }) 00035 #else 00036 #define MULH(X,Y) ({ int xxo; \ 00037 __asm__ ( \ 00038 "a1 = %2.H * %1.L (IS,M);\n\t" \ 00039 "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\ 00040 "a1 = a1 >>> 16;\n\t" \ 00041 "%0 = (a0 += a1);\n\t" \ 00042 : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; }) 00043 #endif 00044 00045 /* signed 16x16 -> 32 multiply */ 00046 #define MUL16(a, b) ({ int xxo; \ 00047 __asm__ ( \ 00048 "%0 = %1.l*%2.l (is);\n\t" \ 00049 : "=W" (xxo) : "d" (a), "d" (b) : "A1"); \ 00050 xxo; }) 00051 00052 #endif /* AVCODEC_BFIN_MATHOPS_H */