annotate mips/mathops.h @ 9729:8c680e33eeaa libavcodec

MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
author mru
date Thu, 28 May 2009 23:19:32 +0000
parents
children 5bf12cdf0cb6
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
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
24 #include "config.h"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
25
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
26 #if HAVE_LOONGSON
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
27
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
28 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
29 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
30 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
31 __asm__ ("dmult.g %1, %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
32 "daddu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
33 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
34 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
35 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
36 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
37
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
38 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
39 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
40 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
41 __asm__ ("dmult.g %1, %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
42 "dsubu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
43 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
44 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
45 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
46 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
47
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
48 #elif ARCH_MIPS64
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
49
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
50 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
51 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
52 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
53 __asm__ ("dmult %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
54 "mflo %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
55 "daddu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
56 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
57 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
58 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
59 #define MAC64(d, a, b) ((d) = MAC64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
60
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
61 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
62 {
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
63 int64_t m;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
64 __asm__ ("dmult %2, %3 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
65 "mflo %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
66 "dsubu %0, %0, %1 \n\t"
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
67 : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
68 return d;
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
69 }
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
70 #define MLS64(d, a, b) ((d) = MLS64(d, a, b))
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
71
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
72 #endif
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
73
8c680e33eeaa MIPS: add MIPS64 and Loongson asm for MAC64/MLS64
mru
parents:
diff changeset
74 #endif /* AVCODEC_MIPS_MATHOPS_H */