2007-08-30 15:15:48 +00:00
|
|
|
/*
|
2009-02-09 11:17:54 +00:00
|
|
|
* simple math operations
|
2007-08-30 15:15:48 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Marc Hoffman <mmhoffm@gmail.com>
|
|
|
|
*
|
2011-03-18 17:35:10 +00:00
|
|
|
* This file is part of Libav.
|
2007-08-30 15:15:48 +00:00
|
|
|
*
|
2011-03-18 17:35:10 +00:00
|
|
|
* Libav is free software; you can redistribute it and/or
|
2007-08-30 15:15:48 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2011-03-18 17:35:10 +00:00
|
|
|
* Libav is distributed in the hope that it will be useful,
|
2007-08-30 15:15:48 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2011-03-18 17:35:10 +00:00
|
|
|
* License along with Libav; if not, write to the Free Software
|
2007-08-30 15:15:48 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2008-08-31 07:39:47 +00:00
|
|
|
#ifndef AVCODEC_BFIN_MATHOPS_H
|
|
|
|
#define AVCODEC_BFIN_MATHOPS_H
|
2007-08-30 15:15:48 +00:00
|
|
|
|
2009-08-24 10:59:14 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-01-13 23:44:16 +00:00
|
|
|
#if CONFIG_MPEGAUDIO_HP
|
2007-08-30 15:15:48 +00:00
|
|
|
#define MULH(X,Y) ({ int xxo; \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ ( \
|
2007-08-30 15:15:48 +00:00
|
|
|
"a1 = %2.L * %1.L (FU);\n\t" \
|
|
|
|
"a1 = a1 >> 16;\n\t" \
|
|
|
|
"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" \
|
2007-09-17 13:17:50 +00:00
|
|
|
: "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
|
2007-08-30 15:15:48 +00:00
|
|
|
#else
|
|
|
|
#define MULH(X,Y) ({ int xxo; \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ ( \
|
2007-08-30 15:15:48 +00:00
|
|
|
"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" \
|
2007-09-17 13:17:50 +00:00
|
|
|
: "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
|
2007-08-30 15:15:48 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* signed 16x16 -> 32 multiply */
|
|
|
|
#define MUL16(a, b) ({ int xxo; \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ ( \
|
2007-08-30 15:15:48 +00:00
|
|
|
"%0 = %1.l*%2.l (is);\n\t" \
|
2007-09-17 13:17:50 +00:00
|
|
|
: "=W" (xxo) : "d" (a), "d" (b) : "A1"); \
|
2007-08-30 15:15:48 +00:00
|
|
|
xxo; })
|
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#endif /* AVCODEC_BFIN_MATHOPS_H */
|