Mercurial > libavcodec.hg
comparison armv4l/mathops.h @ 3733:d1b5acd0b680 libavcodec
New single instruction math operation header
author | lu_zero |
---|---|
date | Tue, 19 Sep 2006 22:22:29 +0000 |
parents | |
children | 2eddcfa87eda |
comparison
equal
deleted
inserted
replaced
3732:2c0b93338765 | 3733:d1b5acd0b680 |
---|---|
1 /* | |
2 * simple math operations | |
3 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al | |
4 * | |
5 * This library is free software; you can redistribute it and/or | |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
9 * | |
10 * This library is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Lesser General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Lesser General Public | |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 */ | |
19 | |
20 #ifdef FRAC_BITS | |
21 # define MULL(a, b) \ | |
22 ({ int lo, hi;\ | |
23 asm("smull %0, %1, %2, %3 \n\t"\ | |
24 "mov %0, %0, lsr %4\n\t"\ | |
25 "add %1, %0, %1, lsl %5\n\t"\ | |
26 : "=&r"(lo), "=&r"(hi)\ | |
27 : "r"(b), "r"(a), "i"(FRAC_BITS), "i"(32-FRAC_BITS));\ | |
28 hi; }) | |
29 #endif | |
30 | |
31 #define MULH(a, b) \ | |
32 ({ int lo, hi;\ | |
33 asm ("smull %0, %1, %2, %3" : "=&r"(lo), "=&r"(hi) : "r"(b), "r"(a));\ | |
34 hi; }) | |
35 | |
36 #if defined(HAVE_ARMV5TE) | |
37 | |
38 /* signed 16x16 -> 32 multiply add accumulate */ | |
39 # define MAC16(rt, ra, rb) \ | |
40 asm ("smlabb %0, %2, %3, %0" : "=r" (rt) : "0" (rt), "r" (ra), "r" (rb)); | |
41 /* signed 16x16 -> 32 multiply */ | |
42 # define MUL16(ra, rb) \ | |
43 ({ int __rt;\ | |
44 asm ("smulbb %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); | |
45 __rt; }) | |
46 | |
47 #endif |