annotate alpha/asm.h @ 504:4aa1ff2acc74 libavcodec

* Fixed constraints * Support ccc * Support gcc 3.2 builtins
author mellum
date Mon, 24 Jun 2002 22:21:30 +0000
parents 718a22dc121f
children 5e5a05077680
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
1 /*
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
2 * Alpha optimized DSP utils
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
4 *
429
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
5 * This library is free software; you can redistribute it and/or
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
7 * License as published by the Free Software Foundation; either
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
8 * version 2 of the License, or (at your option) any later version.
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
9 *
429
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
10 * This library is distributed in the hope that it will be useful,
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
13 * Lesser General Public License for more details.
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
14 *
429
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
16 * License along with this library; if not, write to the Free Software
718a22dc121f license/copyright change
glantau
parents: 214
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
18 */
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
19
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
20 #ifndef LIBAVCODEC_ALPHA_ASM_H
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
21 #define LIBAVCODEC_ALPHA_ASM_H
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
22
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
23 #include <inttypes.h>
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
24
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
25 #define AMASK_BWX (1 << 0)
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
26 #define AMASK_FIX (1 << 1)
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
27 #define AMASK_CIX (1 << 2)
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
28 #define AMASK_MVI (1 << 8)
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
29
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
30 inline static uint64_t BYTE_VEC(uint64_t x)
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
31 {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
32 x |= x << 8;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
33 x |= x << 16;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
34 x |= x << 32;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
35 return x;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
36 }
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
37 inline static uint64_t WORD_VEC(uint64_t x)
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
38 {
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
39 x |= x << 16;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
40 x |= x << 32;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
41 return x;
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
42 }
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
43
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
44 #define ldq(p) (*(const uint64_t *) (p))
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
45 #define ldl(p) (*(const int32_t *) (p))
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
46 #define stl(l, p) do { *(uint32_t *) (p) = (l); } while (0)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
47 #define stq(l, p) do { *(uint64_t *) (p) = (l); } while (0)
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
48
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
49 #ifdef __GNUC__
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
50 #define ASM_ACCEPT_MVI asm (".arch pca56")
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
51 struct unaligned_long { uint64_t l; } __attribute__((packed));
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
52 #define ldq_u(p) (*(const uint64_t *) (((uint64_t) (p)) & ~7ul))
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
53 #define uldq(a) (((const struct unaligned_long *) (a))->l)
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
54
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
55 #if __GNUC__ >= 3 && __GNUC_MINOR__ >= 2
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
56 #define cmpbge __builtin_alpha_cmpbge
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
57 /* Avoid warnings. */
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
58 #define extql(a, b) __builtin_alpha_extql(a, (uint64_t) (b))
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
59 #define extqh(a, b) __builtin_alpha_extqh(a, (uint64_t) (b))
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
60 #define zap __builtin_alpha_zap
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
61 #define zapnot __builtin_alpha_zapnot
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
62 #define amask __builtin_alpha_amask
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
63 #define implver __builtin_alpha_implver
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
64 #define rpcc __builtin_alpha_rpcc
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
65 #define minub8 __builtin_alpha_minub8
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
66 #define minsb8 __builtin_alpha_minsb8
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
67 #define minuw4 __builtin_alpha_minuw4
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
68 #define minsw4 __builtin_alpha_minsw4
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
69 #define maxub8 __builtin_alpha_maxub8
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
70 #define maxsb8 __builtin_alpha_maxsb8
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
71 #define maxuw4 __builtin_alpha_maxuw4
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
72 #define maxsw4 __builtin_alpha_maxsw4
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
73 #define perr __builtin_alpha_perr
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
74 #define pklb __builtin_alpha_pklb
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
75 #define pkwb __builtin_alpha_pkwb
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
76 #define unpkbl __builtin_alpha_unpkbl
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
77 #define unpkbw __builtin_alpha_unpkbw
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
78 #else
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
79 #define cmpbge(a, b) ({ uint64_t __r; asm ("cmpbge %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
80 #define extql(a, b) ({ uint64_t __r; asm ("extql %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
81 #define extqh(a, b) ({ uint64_t __r; asm ("extqh %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
82 #define zap(a, b) ({ uint64_t __r; asm ("zap %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
83 #define zapnot(a, b) ({ uint64_t __r; asm ("zapnot %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
84 #define amask(a) ({ uint64_t __r; asm ("amask %1,%0" : "=r" (__r) : "rI" (a)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
85 #define implver() ({ uint64_t __r; asm ("implver %0" : "=r" (__r)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
86 #define rpcc() ({ uint64_t __r; asm volatile ("rpcc %0" : "=r" (__r)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
87 #define minub8(a, b) ({ uint64_t __r; asm ("minub8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
88 #define minsb8(a, b) ({ uint64_t __r; asm ("minsb8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
89 #define minuw4(a, b) ({ uint64_t __r; asm ("minuw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
90 #define minsw4(a, b) ({ uint64_t __r; asm ("minsw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
91 #define maxub8(a, b) ({ uint64_t __r; asm ("maxub8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
92 #define maxsb8(a, b) ({ uint64_t __r; asm ("maxsb8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
93 #define maxuw4(a, b) ({ uint64_t __r; asm ("maxuw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
94 #define maxsw4(a, b) ({ uint64_t __r; asm ("maxsw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
95 #define perr(a, b) ({ uint64_t __r; asm ("perr %r1,%r2,%0" : "=r" (__r) : "%rJ" (a), "rJ" (b)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
96 #define pklb(a) ({ uint64_t __r; asm ("pklb %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
97 #define pkwb(a) ({ uint64_t __r; asm ("pkwb %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
98 #define unpkbl(a) ({ uint64_t __r; asm ("unpkbl %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
99 #define unpkbw(a) ({ uint64_t __r; asm ("unpkbw %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
100 #endif
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
101
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
102 #elif defined(__DECC) /* Digital/Compaq "ccc" compiler */
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
103
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
104 #include <c_asm.h>
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
105 #define ASM_ACCEPT_MVI
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
106 #define ldq_u(a) asm ("ldq_u %v0,0(%a0)", a)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
107 #define uldq(a) (*(const __unaligned uint64_t *) (a))
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
108 #define cmpbge(a, b) asm ("cmpbge %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
109 #define extql(a, b) asm ("extql %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
110 #define extqh(a, b) asm ("extqh %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
111 #define zap(a, b) asm ("zap %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
112 #define zapnot(a, b) asm ("zapnot %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
113 #define amask(a) asm ("amask %a0,%v0", a)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
114 #define implver() asm ("implver %v0")
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
115 #define rpcc() asm ("rpcc %v0")
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
116 #define minub8(a, b) asm ("minub8 %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
117 #define minsb8(a, b) asm ("minsb8 %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
118 #define minuw4(a, b) asm ("minuw4 %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
119 #define minsw4(a, b) asm ("minsw4 %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
120 #define maxub8(a, b) asm ("maxub8 %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
121 #define maxsb8(a, b) asm ("maxsb8 %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
122 #define maxuw4(a, b) asm ("maxuw4 %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
123 #define maxsw4(a, b) asm ("maxsw4 %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
124 #define perr(a, b) asm ("perr %a0,%a1,%v0", a, b)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
125 #define pklb(a) asm ("pklb %a0,%v0", a)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
126 #define pkwb(a) asm ("pkwb %a0,%v0", a)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
127 #define unpkbl(a) asm ("unpkbl %a0,%v0", a)
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
128 #define unpkbw(a) asm ("unpkbw %a0,%v0", a)
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
129
504
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
130 #else
4aa1ff2acc74 * Fixed constraints
mellum
parents: 429
diff changeset
131 #error "Unknown compiler!"
214
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
132 #endif
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
133
73df666cacc7 Alpha optimizations by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
nickols_k
parents:
diff changeset
134 #endif /* LIBAVCODEC_ALPHA_ASM_H */