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 #include "config.h" 00026 00027 #define MULH(X,Y) ({ int xxo; \ 00028 __asm__ ( \ 00029 "a1 = %2.L * %1.L (FU);\n\t" \ 00030 "a1 = a1 >> 16;\n\t" \ 00031 "a1 += %2.H * %1.L (IS,M);\n\t" \ 00032 "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\ 00033 "a1 = a1 >>> 16;\n\t" \ 00034 "%0 = (a0 += a1);\n\t" \ 00035 : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; }) 00036 00037 /* signed 16x16 -> 32 multiply */ 00038 #define MUL16(a, b) ({ int xxo; \ 00039 __asm__ ( \ 00040 "%0 = %1.l*%2.l (is);\n\t" \ 00041 : "=W" (xxo) : "d" (a), "d" (b) : "A1"); \ 00042 xxo; }) 00043 00044 #endif /* AVCODEC_BFIN_MATHOPS_H */