2007-08-30 17:15:48 +02:00
|
|
|
/*
|
2009-02-09 12:17:54 +01:00
|
|
|
* simple math operations
|
2007-08-30 17:15:48 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Marc Hoffman <mmhoffm@gmail.com>
|
|
|
|
*
|
2011-03-18 18:35:10 +01:00
|
|
|
* This file is part of Libav.
|
2007-08-30 17:15:48 +02:00
|
|
|
*
|
2011-03-18 18:35:10 +01:00
|
|
|
* Libav is free software; you can redistribute it and/or
|
2007-08-30 17:15:48 +02: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 18:35:10 +01:00
|
|
|
* Libav is distributed in the hope that it will be useful,
|
2007-08-30 17:15:48 +02: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 18:35:10 +01:00
|
|
|
* License along with Libav; if not, write to the Free Software
|
2007-08-30 17:15:48 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2008-08-31 09:39:47 +02:00
|
|
|
#ifndef AVCODEC_BFIN_MATHOPS_H
|
|
|
|
#define AVCODEC_BFIN_MATHOPS_H
|
2007-08-30 17:15:48 +02:00
|
|
|
|
2009-08-24 12:59:14 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
2007-08-30 17:15:48 +02:00
|
|
|
#define MULH(X,Y) ({ int xxo; \
|
2008-10-16 15:34:09 +02:00
|
|
|
__asm__ ( \
|
2007-08-30 17:15:48 +02: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 15:17:50 +02:00
|
|
|
: "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
|
2007-08-30 17:15:48 +02:00
|
|
|
|
|
|
|
/* signed 16x16 -> 32 multiply */
|
|
|
|
#define MUL16(a, b) ({ int xxo; \
|
2008-10-16 15:34:09 +02:00
|
|
|
__asm__ ( \
|
2007-08-30 17:15:48 +02:00
|
|
|
"%0 = %1.l*%2.l (is);\n\t" \
|
2007-09-17 15:17:50 +02:00
|
|
|
: "=W" (xxo) : "d" (a), "d" (b) : "A1"); \
|
2007-08-30 17:15:48 +02:00
|
|
|
xxo; })
|
|
|
|
|
2008-08-31 09:39:47 +02:00
|
|
|
#endif /* AVCODEC_BFIN_MATHOPS_H */
|