1 |
dpavlin |
1 |
/* |
2 |
|
|
* PearPC |
3 |
|
|
* ppc_vec.h |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2004 Daniel Foesch (dfoesch@cs.nmsu.edu) |
6 |
|
|
* |
7 |
|
|
* This program is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License version 2 as |
9 |
|
|
* published by the Free Software Foundation. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#ifndef __PPC_VEC_H__ |
22 |
|
|
#define __PPC_VEC_H__ |
23 |
|
|
|
24 |
|
|
#define PPC_OPC_VRc (1<<10) |
25 |
|
|
|
26 |
|
|
/* Rather than write each function to be endianless, we're writing these |
27 |
|
|
* defines to do an endianless access to elements of the vector. |
28 |
|
|
* |
29 |
|
|
* These are for ADDRESSED vector elements. Usually, most vector operations |
30 |
|
|
* can be performed in either direction without care, so most of the |
31 |
|
|
* for-loops should not use these, as it will introduce unneeded code |
32 |
|
|
* for little-endian systems. |
33 |
|
|
*/ |
34 |
|
|
#if HOST_ENDIANESS == HOST_ENDIANESS_LE |
35 |
|
|
|
36 |
|
|
#define VECT_B(reg, index) ((reg).b[15 - (index)]) |
37 |
|
|
#define VECT_SB(reg, index) ((reg).sb[15 - (index)]) |
38 |
|
|
#define VECT_H(reg, index) ((reg).h[7 - (index)]) |
39 |
|
|
#define VECT_SH(reg, index) ((reg).sh[7 - (index)]) |
40 |
|
|
#define VECT_W(reg, index) ((reg).w[3 - (index)]) |
41 |
|
|
#define VECT_SW(reg, index) ((reg).sw[3 - (index)]) |
42 |
|
|
#define VECT_D(reg, index) ((reg).d[1 - (index)]) |
43 |
|
|
#define VECT_SD(reg, index) ((reg).sd[1 - (index)]) |
44 |
|
|
|
45 |
|
|
#define VECT_EVEN(index) (((index) << 1) + 1) |
46 |
|
|
#define VECT_ODD(index) (((index) << 1) + 0) |
47 |
|
|
|
48 |
|
|
#elif HOST_ENDIANESS == HOST_ENDIANESS_BE |
49 |
|
|
|
50 |
|
|
#define VECT_B(reg, index) ((reg).b[(index)]) |
51 |
|
|
#define VECT_SB(reg, index) ((reg).sb[(index)]) |
52 |
|
|
#define VECT_H(reg, index) ((reg).h[(index)]) |
53 |
|
|
#define VECT_SH(reg, index) ((reg).sh[(index)]) |
54 |
|
|
#define VECT_W(reg, index) ((reg).w[(index)]) |
55 |
|
|
#define VECT_SW(reg, index) ((reg).sw[(index)]) |
56 |
|
|
#define VECT_D(reg, index) ((reg).d[(index)]) |
57 |
|
|
#define VECT_SD(reg, index) ((reg).sd[(index)]) |
58 |
|
|
|
59 |
|
|
#define VECT_EVEN(index) (((index) << 1) + 0) |
60 |
|
|
#define VECT_ODD(index) (((index) << 1) + 1) |
61 |
|
|
|
62 |
|
|
#else |
63 |
|
|
#error Endianess not supported! |
64 |
|
|
#endif |
65 |
|
|
|
66 |
|
|
//#define VECTOR_DEBUG fprintf(stderr, "[PPC/VEC] %s\n", __FUNCTION__) |
67 |
|
|
#define VECTOR_DEBUG |
68 |
|
|
|
69 |
|
|
//#define VECTOR_DEBUG_COMMON fprintf(stderr, "[PPC/VEC] %s\n", __FUNCTION__) |
70 |
|
|
#define VECTOR_DEBUG_COMMON |
71 |
|
|
|
72 |
|
|
/* Undefine this to turn of the MSR_VEC check for vector instructions. */ |
73 |
|
|
//#define __VEC_EXC_OFF__ |
74 |
|
|
|
75 |
|
|
#include "system/types.h" |
76 |
|
|
|
77 |
|
|
#include "tools/snprintf.h" |
78 |
|
|
|
79 |
|
|
void ppc_opc_vperm(); |
80 |
|
|
void ppc_opc_vsel(); |
81 |
|
|
void ppc_opc_vsrb(); |
82 |
|
|
void ppc_opc_vsrh(); |
83 |
|
|
void ppc_opc_vsrw(); |
84 |
|
|
void ppc_opc_vsrab(); |
85 |
|
|
void ppc_opc_vsrah(); |
86 |
|
|
void ppc_opc_vsraw(); |
87 |
|
|
void ppc_opc_vsr(); |
88 |
|
|
void ppc_opc_vsro(); |
89 |
|
|
void ppc_opc_vslb(); |
90 |
|
|
void ppc_opc_vslh(); |
91 |
|
|
void ppc_opc_vslw(); |
92 |
|
|
void ppc_opc_vsl(); |
93 |
|
|
void ppc_opc_vslo(); |
94 |
|
|
void ppc_opc_vsldoi(); |
95 |
|
|
void ppc_opc_vrlb(); |
96 |
|
|
void ppc_opc_vrlh(); |
97 |
|
|
void ppc_opc_vrlw(); |
98 |
|
|
void ppc_opc_vmrghb(); |
99 |
|
|
void ppc_opc_vmrghh(); |
100 |
|
|
void ppc_opc_vmrghw(); |
101 |
|
|
void ppc_opc_vmrglb(); |
102 |
|
|
void ppc_opc_vmrglh(); |
103 |
|
|
void ppc_opc_vmrglw(); |
104 |
|
|
void ppc_opc_vspltb(); |
105 |
|
|
void ppc_opc_vsplth(); |
106 |
|
|
void ppc_opc_vspltw(); |
107 |
|
|
void ppc_opc_vspltisb(); |
108 |
|
|
void ppc_opc_vspltish(); |
109 |
|
|
void ppc_opc_vspltisw(); |
110 |
|
|
void ppc_opc_mfvscr(); |
111 |
|
|
void ppc_opc_mtvscr(); |
112 |
|
|
void ppc_opc_vpkuhum(); |
113 |
|
|
void ppc_opc_vpkuwum(); |
114 |
|
|
void ppc_opc_vpkpx(); |
115 |
|
|
void ppc_opc_vpkuhus(); |
116 |
|
|
void ppc_opc_vpkshss(); |
117 |
|
|
void ppc_opc_vpkuwus(); |
118 |
|
|
void ppc_opc_vpkswss(); |
119 |
|
|
void ppc_opc_vpkuhus(); |
120 |
|
|
void ppc_opc_vpkshus(); |
121 |
|
|
void ppc_opc_vpkuwus(); |
122 |
|
|
void ppc_opc_vpkswus(); |
123 |
|
|
void ppc_opc_vupkhsb(); |
124 |
|
|
void ppc_opc_vupkhpx(); |
125 |
|
|
void ppc_opc_vupkhsh(); |
126 |
|
|
void ppc_opc_vupklsb(); |
127 |
|
|
void ppc_opc_vupklpx(); |
128 |
|
|
void ppc_opc_vupklsh(); |
129 |
|
|
void ppc_opc_vaddubm(); |
130 |
|
|
void ppc_opc_vadduhm(); |
131 |
|
|
void ppc_opc_vadduwm(); |
132 |
|
|
void ppc_opc_vaddfp(); |
133 |
|
|
void ppc_opc_vaddcuw(); |
134 |
|
|
void ppc_opc_vaddubs(); |
135 |
|
|
void ppc_opc_vaddsbs(); |
136 |
|
|
void ppc_opc_vadduhs(); |
137 |
|
|
void ppc_opc_vaddshs(); |
138 |
|
|
void ppc_opc_vadduws(); |
139 |
|
|
void ppc_opc_vaddsws(); |
140 |
|
|
void ppc_opc_vsububm(); |
141 |
|
|
void ppc_opc_vsubuhm(); |
142 |
|
|
void ppc_opc_vsubuwm(); |
143 |
|
|
void ppc_opc_vsubfp(); |
144 |
|
|
void ppc_opc_vsubcuw(); |
145 |
|
|
void ppc_opc_vsububs(); |
146 |
|
|
void ppc_opc_vsubsbs(); |
147 |
|
|
void ppc_opc_vsubuhs(); |
148 |
|
|
void ppc_opc_vsubshs(); |
149 |
|
|
void ppc_opc_vsubuws(); |
150 |
|
|
void ppc_opc_vsubsws(); |
151 |
|
|
void ppc_opc_vmuleub(); |
152 |
|
|
void ppc_opc_vmulesb(); |
153 |
|
|
void ppc_opc_vmuleuh(); |
154 |
|
|
void ppc_opc_vmulesh(); |
155 |
|
|
void ppc_opc_vmuloub(); |
156 |
|
|
void ppc_opc_vmulosb(); |
157 |
|
|
void ppc_opc_vmulouh(); |
158 |
|
|
void ppc_opc_vmulosh(); |
159 |
|
|
void ppc_opc_vmaddfp(); |
160 |
|
|
void ppc_opc_vmhaddshs(); |
161 |
|
|
void ppc_opc_vmladduhm(); |
162 |
|
|
void ppc_opc_vmhraddshs(); |
163 |
|
|
void ppc_opc_vmsumubm(); |
164 |
|
|
void ppc_opc_vmsumuhm(); |
165 |
|
|
void ppc_opc_vmsummbm(); |
166 |
|
|
void ppc_opc_vmsumshm(); |
167 |
|
|
void ppc_opc_vmsumuhs(); |
168 |
|
|
void ppc_opc_vmsumshs(); |
169 |
|
|
void ppc_opc_vsum4ubs(); |
170 |
|
|
void ppc_opc_vsum4sbs(); |
171 |
|
|
void ppc_opc_vsum4shs(); |
172 |
|
|
void ppc_opc_vsum2sws(); |
173 |
|
|
void ppc_opc_vsumsws(); |
174 |
|
|
void ppc_opc_vnmsubfp(); |
175 |
|
|
void ppc_opc_vavgub(); |
176 |
|
|
void ppc_opc_vavgsb(); |
177 |
|
|
void ppc_opc_vavguh(); |
178 |
|
|
void ppc_opc_vavgsh(); |
179 |
|
|
void ppc_opc_vavguw(); |
180 |
|
|
void ppc_opc_vavgsw(); |
181 |
|
|
void ppc_opc_vmaxub(); |
182 |
|
|
void ppc_opc_vmaxsb(); |
183 |
|
|
void ppc_opc_vmaxuh(); |
184 |
|
|
void ppc_opc_vmaxsh(); |
185 |
|
|
void ppc_opc_vmaxuw(); |
186 |
|
|
void ppc_opc_vmaxsw(); |
187 |
|
|
void ppc_opc_vmaxfp(); |
188 |
|
|
void ppc_opc_vminub(); |
189 |
|
|
void ppc_opc_vminsb(); |
190 |
|
|
void ppc_opc_vminuh(); |
191 |
|
|
void ppc_opc_vminsh(); |
192 |
|
|
void ppc_opc_vminuw(); |
193 |
|
|
void ppc_opc_vminsw(); |
194 |
|
|
void ppc_opc_vminfp(); |
195 |
|
|
void ppc_opc_vrfin(); |
196 |
|
|
void ppc_opc_vrfip(); |
197 |
|
|
void ppc_opc_vrfim(); |
198 |
|
|
void ppc_opc_vrfiz(); |
199 |
|
|
void ppc_opc_vrefp(); |
200 |
|
|
void ppc_opc_vrsqrtefp(); |
201 |
|
|
void ppc_opc_vlogefp(); |
202 |
|
|
void ppc_opc_vexptefp(); |
203 |
|
|
void ppc_opc_vcfux(); |
204 |
|
|
void ppc_opc_vcfsx(); |
205 |
|
|
void ppc_opc_vctsxs(); |
206 |
|
|
void ppc_opc_vctuxs(); |
207 |
|
|
void ppc_opc_vand(); |
208 |
|
|
void ppc_opc_vandc(); |
209 |
|
|
void ppc_opc_vor(); |
210 |
|
|
void ppc_opc_vnor(); |
211 |
|
|
void ppc_opc_vxor(); |
212 |
|
|
void ppc_opc_vcmpequbx(); |
213 |
|
|
void ppc_opc_vcmpequhx(); |
214 |
|
|
void ppc_opc_vcmpequwx(); |
215 |
|
|
void ppc_opc_vcmpeqfpx(); |
216 |
|
|
void ppc_opc_vcmpgtubx(); |
217 |
|
|
void ppc_opc_vcmpgtsbx(); |
218 |
|
|
void ppc_opc_vcmpgtuhx(); |
219 |
|
|
void ppc_opc_vcmpgtshx(); |
220 |
|
|
void ppc_opc_vcmpgtuwx(); |
221 |
|
|
void ppc_opc_vcmpgtswx(); |
222 |
|
|
void ppc_opc_vcmpgtfpx(); |
223 |
|
|
void ppc_opc_vcmpgefpx(); |
224 |
|
|
void ppc_opc_vcmpbfpx(); |
225 |
|
|
|
226 |
|
|
#endif |