annotate mips/mathops.h @ 10077:5bf12cdf0cb6 libavcodec

Include required headers in {mips,ppc}/mathops.h
author mru
date Sun, 23 Aug 2009 11:02:41 +0000
parents 8c680e33eeaa
children 25136467a218
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9729
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
1 /*
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
2 * Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
3 *
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
4 * This file is part of FFmpeg.
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
5 *
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
10 *
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
14 * Lesser General Public License for more details.
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
15 *
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
19 */
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
20
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
21 #ifndef AVCODEC_MIPS_MATHOPS_H
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
22 #define AVCODEC_MIPS_MATHOPS_H
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
23
10077
5bf12cdf0cb6 Include required headers in {mips,ppc}/mathops.h
mru
parents: 9729
diff changeset
24 #include <stdint.h>
5bf12cdf0cb6 Include required headers in {mips,ppc}/mathops.h
mru
parents: 9729
diff changeset
25 #include "libavutil/common.h"
9729
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
26
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
27 #if HAVE_LOONGSON
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
28
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
29 static inline av_const int64_t MAC64(int64_t d, int a, int b)
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
30 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
31 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
32 __asm__ ("dmult.g %1, %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
33 "daddu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
34 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
35 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
36 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
37 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
38
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
39 static inline av_const int64_t MLS64(int64_t d, int a, int b)
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
40 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
41 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
42 __asm__ ("dmult.g %1, %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
43 "dsubu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
44 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
45 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
46 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
47 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
48
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
49 #elif ARCH_MIPS64
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
50
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
51 static inline av_const int64_t MAC64(int64_t d, int a, int b)
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
52 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
53 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
54 __asm__ ("dmult %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
55 "mflo %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
56 "daddu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
57 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
58 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
59 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
60 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
61
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
62 static inline av_const int64_t MLS64(int64_t d, int a, int b)
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
63 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
64 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
65 __asm__ ("dmult %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
66 "mflo %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
67 "dsubu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
68 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
69 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
70 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
71 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
72
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
73 #endif
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
74
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
75 #endif /* AVCODEC_MIPS_MATHOPS_H */