Commit | Line | Data |
---|---|---|
d6fea803 AC |
1 | /* This file is part of the program psim. |
2 | ||
3 | Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> | |
4 | Copyright (C) 1997, Free Software Foundation, Inc. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 | ||
20 | */ | |
21 | ||
22 | ||
23 | #ifndef _SIM_ENDIAN_H_ | |
24 | #define _SIM_ENDIAN_H_ | |
25 | ||
26 | ||
27 | /* C byte conversion functions */ | |
28 | ||
29 | INLINE_SIM_ENDIAN(unsigned_1) endian_h2t_1(unsigned_1 x); | |
30 | INLINE_SIM_ENDIAN(unsigned_2) endian_h2t_2(unsigned_2 x); | |
31 | INLINE_SIM_ENDIAN(unsigned_4) endian_h2t_4(unsigned_4 x); | |
32 | INLINE_SIM_ENDIAN(unsigned_8) endian_h2t_8(unsigned_8 x); | |
f45dd42b | 33 | INLINE_SIM_ENDIAN(unsigned_16) endian_h2t_16(unsigned_16 x); |
d6fea803 AC |
34 | |
35 | INLINE_SIM_ENDIAN(unsigned_1) endian_t2h_1(unsigned_1 x); | |
36 | INLINE_SIM_ENDIAN(unsigned_2) endian_t2h_2(unsigned_2 x); | |
37 | INLINE_SIM_ENDIAN(unsigned_4) endian_t2h_4(unsigned_4 x); | |
38 | INLINE_SIM_ENDIAN(unsigned_8) endian_t2h_8(unsigned_8 x); | |
f45dd42b | 39 | INLINE_SIM_ENDIAN(unsigned_16) endian_t2h_16(unsigned_16 x); |
d6fea803 AC |
40 | |
41 | INLINE_SIM_ENDIAN(unsigned_1) swap_1(unsigned_1 x); | |
42 | INLINE_SIM_ENDIAN(unsigned_2) swap_2(unsigned_2 x); | |
43 | INLINE_SIM_ENDIAN(unsigned_4) swap_4(unsigned_4 x); | |
44 | INLINE_SIM_ENDIAN(unsigned_8) swap_8(unsigned_8 x); | |
f45dd42b | 45 | INLINE_SIM_ENDIAN(unsigned_16) swap_16(unsigned_16 x); |
d6fea803 AC |
46 | |
47 | INLINE_SIM_ENDIAN(unsigned_1) endian_h2be_1(unsigned_1 x); | |
48 | INLINE_SIM_ENDIAN(unsigned_2) endian_h2be_2(unsigned_2 x); | |
49 | INLINE_SIM_ENDIAN(unsigned_4) endian_h2be_4(unsigned_4 x); | |
50 | INLINE_SIM_ENDIAN(unsigned_8) endian_h2be_8(unsigned_8 x); | |
f45dd42b | 51 | INLINE_SIM_ENDIAN(unsigned_16) endian_h2be_16(unsigned_16 x); |
d6fea803 AC |
52 | |
53 | INLINE_SIM_ENDIAN(unsigned_1) endian_be2h_1(unsigned_1 x); | |
54 | INLINE_SIM_ENDIAN(unsigned_2) endian_be2h_2(unsigned_2 x); | |
55 | INLINE_SIM_ENDIAN(unsigned_4) endian_be2h_4(unsigned_4 x); | |
56 | INLINE_SIM_ENDIAN(unsigned_8) endian_be2h_8(unsigned_8 x); | |
f45dd42b | 57 | INLINE_SIM_ENDIAN(unsigned_16) endian_be2h_16(unsigned_16 x); |
d6fea803 AC |
58 | |
59 | INLINE_SIM_ENDIAN(unsigned_1) endian_h2le_1(unsigned_1 x); | |
60 | INLINE_SIM_ENDIAN(unsigned_2) endian_h2le_2(unsigned_2 x); | |
61 | INLINE_SIM_ENDIAN(unsigned_4) endian_h2le_4(unsigned_4 x); | |
62 | INLINE_SIM_ENDIAN(unsigned_8) endian_h2le_8(unsigned_8 x); | |
f45dd42b | 63 | INLINE_SIM_ENDIAN(unsigned_16) endian_h2le_16(unsigned_16 x); |
d6fea803 AC |
64 | |
65 | INLINE_SIM_ENDIAN(unsigned_1) endian_le2h_1(unsigned_1 x); | |
66 | INLINE_SIM_ENDIAN(unsigned_2) endian_le2h_2(unsigned_2 x); | |
67 | INLINE_SIM_ENDIAN(unsigned_4) endian_le2h_4(unsigned_4 x); | |
68 | INLINE_SIM_ENDIAN(unsigned_8) endian_le2h_8(unsigned_8 x); | |
f45dd42b | 69 | INLINE_SIM_ENDIAN(unsigned_16) endian_le2h_16(unsigned_16 x); |
d6fea803 | 70 | |
f45dd42b AC |
71 | INLINE_SIM_ENDIAN(void*) offset_1(unsigned_1 *x, unsigned ws, unsigned w); |
72 | INLINE_SIM_ENDIAN(void*) offset_2(unsigned_2 *x, unsigned ws, unsigned w); | |
73 | INLINE_SIM_ENDIAN(void*) offset_4(unsigned_4 *x, unsigned ws, unsigned w); | |
74 | INLINE_SIM_ENDIAN(void*) offset_8(unsigned_8 *x, unsigned ws, unsigned w); | |
75 | INLINE_SIM_ENDIAN(void*) offset_16(unsigned_16 *x, unsigned ws, unsigned w); | |
d6fea803 AC |
76 | |
77 | ||
78 | /* SWAP */ | |
79 | ||
80 | #define SWAP_1(X) swap_1(X) | |
81 | #define SWAP_2(X) swap_2(X) | |
82 | #define SWAP_4(X) swap_4(X) | |
83 | #define SWAP_8(X) swap_8(X) | |
f45dd42b | 84 | #define SWAP_16(X) swap_16(X) |
d6fea803 AC |
85 | |
86 | ||
87 | /* HOST to BE */ | |
88 | ||
89 | #define H2BE_1(X) endian_h2be_1(X) | |
90 | #define H2BE_2(X) endian_h2be_2(X) | |
91 | #define H2BE_4(X) endian_h2be_4(X) | |
92 | #define H2BE_8(X) endian_h2be_8(X) | |
f45dd42b | 93 | #define H2BE_16(X) endian_h2be_16(X) |
d6fea803 AC |
94 | #define BE2H_1(X) endian_be2h_1(X) |
95 | #define BE2H_2(X) endian_be2h_2(X) | |
96 | #define BE2H_4(X) endian_be2h_4(X) | |
97 | #define BE2H_8(X) endian_be2h_8(X) | |
f45dd42b | 98 | #define BE2H_16(X) endian_be2h_16(X) |
d6fea803 AC |
99 | |
100 | ||
101 | /* HOST to LE */ | |
102 | ||
103 | #define H2LE_1(X) endian_h2le_1(X) | |
104 | #define H2LE_2(X) endian_h2le_2(X) | |
105 | #define H2LE_4(X) endian_h2le_4(X) | |
106 | #define H2LE_8(X) endian_h2le_8(X) | |
f45dd42b | 107 | #define H2LE_16(X) endian_h2le_16(X) |
d6fea803 AC |
108 | #define LE2H_1(X) endian_le2h_1(X) |
109 | #define LE2H_2(X) endian_le2h_2(X) | |
110 | #define LE2H_4(X) endian_le2h_4(X) | |
111 | #define LE2H_8(X) endian_le2h_8(X) | |
f45dd42b | 112 | #define LE2H_16(X) endian_le2h_16(X) |
d6fea803 AC |
113 | |
114 | ||
115 | /* HOST to TARGET */ | |
116 | ||
117 | #define H2T_1(X) endian_h2t_1(X) | |
118 | #define H2T_2(X) endian_h2t_2(X) | |
119 | #define H2T_4(X) endian_h2t_4(X) | |
120 | #define H2T_8(X) endian_h2t_8(X) | |
f45dd42b | 121 | #define H2T_16(X) endian_h2t_16(X) |
d6fea803 AC |
122 | #define T2H_1(X) endian_t2h_1(X) |
123 | #define T2H_2(X) endian_t2h_2(X) | |
124 | #define T2H_4(X) endian_t2h_4(X) | |
125 | #define T2H_8(X) endian_t2h_8(X) | |
f45dd42b | 126 | #define T2H_16(X) endian_t2h_16(X) |
d6fea803 AC |
127 | |
128 | ||
129 | /* CONVERT IN PLACE | |
130 | ||
131 | These macros, given an argument of unknown size, swap its value in | |
132 | place if a host/target conversion is required. */ | |
133 | ||
134 | #define H2T(VARIABLE) \ | |
135 | do { \ | |
136 | switch (sizeof(VARIABLE)) { \ | |
137 | case 1: VARIABLE = H2T_1(VARIABLE); break; \ | |
138 | case 2: VARIABLE = H2T_2(VARIABLE); break; \ | |
139 | case 4: VARIABLE = H2T_4(VARIABLE); break; \ | |
140 | case 8: VARIABLE = H2T_8(VARIABLE); break; \ | |
c3e3e4ad | 141 | /*case 16: VARIABLE = H2T_16(VARIABLE); break;*/ \ |
d6fea803 AC |
142 | } \ |
143 | } while (0) | |
144 | ||
145 | #define T2H(VARIABLE) \ | |
146 | do { \ | |
147 | switch (sizeof(VARIABLE)) { \ | |
148 | case 1: VARIABLE = T2H_1(VARIABLE); break; \ | |
149 | case 2: VARIABLE = T2H_2(VARIABLE); break; \ | |
150 | case 4: VARIABLE = T2H_4(VARIABLE); break; \ | |
151 | case 8: VARIABLE = T2H_8(VARIABLE); break; \ | |
c3e3e4ad | 152 | /*case 16: VARIABLE = T2H_16(VARIABLE); break;*/ \ |
d6fea803 AC |
153 | } \ |
154 | } while (0) | |
155 | ||
156 | #define SWAP(VARIABLE) \ | |
157 | do { \ | |
158 | switch (sizeof(VARIABLE)) { \ | |
159 | case 1: VARIABLE = SWAP_1(VARIABLE); break; \ | |
160 | case 2: VARIABLE = SWAP_2(VARIABLE); break; \ | |
161 | case 4: VARIABLE = SWAP_4(VARIABLE); break; \ | |
162 | case 8: VARIABLE = SWAP_8(VARIABLE); break; \ | |
c3e3e4ad | 163 | /*case 16: VARIABLE = SWAP_16(VARIABLE); break;*/ \ |
d6fea803 AC |
164 | } \ |
165 | } while (0) | |
166 | ||
167 | #define H2BE(VARIABLE) \ | |
168 | do { \ | |
169 | switch (sizeof(VARIABLE)) { \ | |
170 | case 1: VARIABLE = H2BE_1(VARIABLE); break; \ | |
171 | case 2: VARIABLE = H2BE_2(VARIABLE); break; \ | |
172 | case 4: VARIABLE = H2BE_4(VARIABLE); break; \ | |
173 | case 8: VARIABLE = H2BE_8(VARIABLE); break; \ | |
c3e3e4ad | 174 | /*case 16: VARIABLE = H2BE_16(VARIABLE); break;*/ \ |
d6fea803 AC |
175 | } \ |
176 | } while (0) | |
177 | ||
178 | #define BE2H(VARIABLE) \ | |
179 | do { \ | |
180 | switch (sizeof(VARIABLE)) { \ | |
181 | case 1: VARIABLE = BE2H_1(VARIABLE); break; \ | |
182 | case 2: VARIABLE = BE2H_2(VARIABLE); break; \ | |
183 | case 4: VARIABLE = BE2H_4(VARIABLE); break; \ | |
184 | case 8: VARIABLE = BE2H_8(VARIABLE); break; \ | |
c3e3e4ad | 185 | /*case 16: VARIABLE = BE2H_16(VARIABLE); break;*/ \ |
d6fea803 AC |
186 | } \ |
187 | } while (0) | |
188 | ||
189 | #define H2LE(VARIABLE) \ | |
190 | do { \ | |
191 | switch (sizeof(VARIABLE)) { \ | |
192 | case 1: VARIABLE = H2LE_1(VARIABLE); break; \ | |
193 | case 2: VARIABLE = H2LE_2(VARIABLE); break; \ | |
194 | case 4: VARIABLE = H2LE_4(VARIABLE); break; \ | |
195 | case 8: VARIABLE = H2LE_8(VARIABLE); break; \ | |
c3e3e4ad | 196 | /*case 16: VARIABLE = H2LE_16(VARIABLE); break;*/ \ |
d6fea803 AC |
197 | } \ |
198 | } while (0) | |
199 | ||
200 | #define LE2H(VARIABLE) \ | |
201 | do { \ | |
202 | switch (sizeof(VARIABLE)) { \ | |
203 | case 1: VARIABLE = LE2H_1(VARIABLE); break; \ | |
204 | case 2: VARIABLE = LE2H_2(VARIABLE); break; \ | |
205 | case 4: VARIABLE = LE2H_4(VARIABLE); break; \ | |
206 | case 8: VARIABLE = LE2H_8(VARIABLE); break; \ | |
c3e3e4ad | 207 | /*case 16: VARIABLE = LE2H_16(VARIABLE); break;*/ \ |
d6fea803 AC |
208 | } \ |
209 | } while (0) | |
210 | ||
211 | ||
212 | ||
213 | /* TARGET WORD: | |
214 | ||
215 | Byte swap a quantity the size of the targets word */ | |
216 | ||
217 | #if (WITH_TARGET_WORD_BITSIZE == 64) | |
218 | #define H2T_word(X) H2T_8(X) | |
219 | #define T2H_word(X) T2H_8(X) | |
220 | #define H2BE_word(X) H2BE_8(X) | |
221 | #define BE2H_word(X) BE2H_8(X) | |
222 | #define H2LE_word(X) H2LE_8(X) | |
223 | #define LE2H_word(X) LE2H_8(X) | |
224 | #define SWAP_word(X) SWAP_8(X) | |
225 | #endif | |
226 | #if (WITH_TARGET_WORD_BITSIZE == 32) | |
227 | #define H2T_word(X) H2T_4(X) | |
228 | #define T2H_word(X) T2H_4(X) | |
229 | #define H2BE_word(X) H2BE_4(X) | |
230 | #define BE2H_word(X) BE2H_4(X) | |
231 | #define H2LE_word(X) H2LE_4(X) | |
232 | #define LE2H_word(X) LE2H_4(X) | |
233 | #define SWAP_word(X) SWAP_4(X) | |
234 | #endif | |
235 | ||
236 | ||
237 | ||
238 | /* TARGET CELL: | |
239 | ||
240 | Byte swap a quantity the size of the targets IEEE 1275 memory cell */ | |
241 | ||
242 | #define H2T_cell(X) H2T_4(X) | |
243 | #define T2H_cell(X) T2H_4(X) | |
244 | #define H2BE_cell(X) H2BE_4(X) | |
245 | #define BE2H_cell(X) BE2H_4(X) | |
246 | #define H2LE_cell(X) H2LE_4(X) | |
247 | #define LE2H_cell(X) LE2H_4(X) | |
248 | #define SWAP_cell(X) SWAP_4(X) | |
249 | ||
250 | ||
251 | ||
252 | /* HOST Offsets: | |
253 | ||
254 | Address of high/low sub-word within a host word quantity. | |
255 | ||
256 | Address of sub-word N within a host word quantity. NOTE: Numbering | |
257 | is BIG endian always. */ | |
258 | ||
259 | #define AH1_2(X) (unsigned_1*)offset_2((X), 1, 0) | |
260 | #define AL1_2(X) (unsigned_1*)offset_2((X), 1, 1) | |
261 | ||
262 | #define AH2_4(X) (unsigned_2*)offset_4((X), 2, 0) | |
263 | #define AL2_4(X) (unsigned_2*)offset_4((X), 2, 1) | |
264 | ||
265 | #define AH4_8(X) (unsigned_4*)offset_8((X), 4, 0) | |
266 | #define AL4_8(X) (unsigned_4*)offset_8((X), 4, 1) | |
267 | ||
f45dd42b AC |
268 | #define AH8_16(X) (unsigned_8*)offset_16((X), 8, 0) |
269 | #define AL8_16(X) (unsigned_8*)offset_16((X), 8, 1) | |
270 | ||
d6fea803 AC |
271 | #if (WITH_TARGET_WORD_BITSIZE == 64) |
272 | #define AH_word(X) AH4_8(X) | |
273 | #define AL_word(X) AL4_8(X) | |
274 | #endif | |
275 | #if (WITH_TARGET_WORD_BITSIZE == 32) | |
276 | #define AH_word(X) AH2_4(X) | |
277 | #define AL_word(X) AL2_4(X) | |
278 | #endif | |
279 | ||
280 | ||
281 | #define A1_2(X,N) (unsigned_1*)offset_2((X), 1, (N)) | |
282 | ||
283 | #define A1_4(X,N) (unsigned_1*)offset_4((X), 1, (N)) | |
284 | #define A2_4(X,N) (unsigned_2*)offset_4((X), 2, (N)) | |
285 | ||
286 | #define A1_8(X,N) (unsigned_1*)offset_8((X), 1, (N)) | |
287 | #define A2_8(X,N) (unsigned_2*)offset_8((X), 2, (N)) | |
288 | #define A4_8(X,N) (unsigned_4*)offset_8((X), 4, (N)) | |
289 | ||
f45dd42b AC |
290 | #define A1_16(X,N) (unsigned_1*)offset_16((X), 1, (N)) |
291 | #define A2_16(X,N) (unsigned_2*)offset_16((X), 2, (N)) | |
292 | #define A4_16(X,N) (unsigned_4*)offset_16((X), 4, (N)) | |
293 | #define A8_16(X,N) (unsigned_8*)offset_16((X), 8, (N)) | |
d6fea803 AC |
294 | |
295 | ||
296 | ||
297 | ||
298 | /* HOST Components: | |
299 | ||
300 | Value of sub-word within a host word quantity */ | |
301 | ||
302 | #define VH1_2(X) ((unsigned_1)((unsigned_2)(X) >> 8)) | |
303 | #define VL1_2(X) (unsigned_1)(X) | |
304 | ||
305 | #define VH2_4(X) ((unsigned_2)((unsigned_4)(X) >> 16)) | |
306 | #define VL2_4(X) ((unsigned_2)(X)) | |
307 | ||
308 | #define VH4_8(X) ((unsigned_4)((unsigned_8)(X) >> 32)) | |
309 | #define VL4_8(X) ((unsigned_4)(X)) | |
310 | ||
f45dd42b AC |
311 | #define VH8_16(X) ((unsigned_8)((unsigned_16)(X) >> 64)) |
312 | #define VL8_16(X) ((unsigned_8)(X)) | |
313 | ||
d6fea803 AC |
314 | #if (WITH_TARGET_WORD_BITSIZE == 64) |
315 | #define VH_word(X) VH4_8(X) | |
316 | #define VL_word(X) VL4_8(X) | |
317 | #endif | |
318 | #if (WITH_TARGET_WORD_BITSIZE == 32) | |
319 | #define VH_word(X) VH2_4(X) | |
320 | #define VL_word(X) VL2_4(X) | |
321 | #endif | |
322 | ||
323 | ||
324 | #define V1_2(X,N) ((unsigned_1)((unsigned_2)(X) >> ( 8 * (1 - (N))))) | |
d6fea803 | 325 | |
f45dd42b | 326 | #define V1_4(X,N) ((unsigned_1)((unsigned_4)(X) >> ( 8 * (3 - (N))))) |
d6fea803 | 327 | #define V2_4(X,N) ((unsigned_2)((unsigned_4)(X) >> (16 * (1 - (N))))) |
d6fea803 | 328 | |
f45dd42b AC |
329 | #define V1_8(X,N) ((unsigned_1)((unsigned_8)(X) >> ( 8 * (7 - (N))))) |
330 | #define V2_8(X,N) ((unsigned_2)((unsigned_8)(X) >> (16 * (3 - (N))))) | |
d6fea803 AC |
331 | #define V4_8(X,N) ((unsigned_4)((unsigned_8)(X) >> (32 * (1 - (N))))) |
332 | ||
f45dd42b AC |
333 | #define V1_16(X,N) (*A1_16 (&(X),N)) |
334 | #define V2_16(X,N) (*A2_16 (&(X),N)) | |
335 | #define V4_16(X,N) (*A4_16 (&(X),N)) | |
336 | #define V8_16(X,N) (*A8_16 (&(X),N)) | |
337 | ||
d6fea803 AC |
338 | |
339 | /* Reverse - insert sub-word into word quantity */ | |
340 | ||
341 | #define V2_H1(X) ((unsigned_2)(unsigned_1)(X) << 8) | |
342 | #define V2_L1(X) ((unsigned_2)(unsigned_1)(X)) | |
343 | ||
344 | #define V4_H2(X) ((unsigned_4)(unsigned_2)(X) << 16) | |
345 | #define V4_L2(X) ((unsigned_4)(unsigned_2)(X)) | |
346 | ||
347 | #define V8_H4(X) ((unsigned_8)(unsigned_4)(X) << 32) | |
348 | #define V8_L4(X) ((unsigned_8)(unsigned_4)(X)) | |
349 | ||
f45dd42b AC |
350 | #define V16_H8(X) ((unsigned_16)(unsigned_8)(X) << 64) |
351 | #define V16_L8(X) ((unsigned_16)(unsigned_8)(X)) | |
352 | ||
d6fea803 AC |
353 | |
354 | #define V2_1(X,N) ((unsigned_2)(unsigned_1)(X) << ( 8 * (1 - (N)))) | |
d6fea803 | 355 | |
f45dd42b | 356 | #define V4_1(X,N) ((unsigned_4)(unsigned_1)(X) << ( 8 * (3 - (N)))) |
d6fea803 | 357 | #define V4_2(X,N) ((unsigned_4)(unsigned_2)(X) << (16 * (1 - (N)))) |
d6fea803 | 358 | |
f45dd42b AC |
359 | #define V8_1(X,N) ((unsigned_8)(unsigned_1)(X) << ( 8 * (7 - (N)))) |
360 | #define V8_2(X,N) ((unsigned_8)(unsigned_2)(X) << (16 * (3 - (N)))) | |
d6fea803 AC |
361 | #define V8_4(X,N) ((unsigned_8)(unsigned_4)(X) << (32 * (1 - (N)))) |
362 | ||
f45dd42b AC |
363 | #define V16_1(X,N) ((unsigned_16)(unsigned_1)(X) << ( 8 * (15 - (N)))) |
364 | #define V16_2(X,N) ((unsigned_16)(unsigned_2)(X) << (16 * (7 - (N)))) | |
365 | #define V16_4(X,N) ((unsigned_16)(unsigned_4)(X) << (32 * (3 - (N)))) | |
366 | #define V16_8(X,N) ((unsigned_16)(unsigned_8)(X) << (64 * (1 - (N)))) | |
367 | ||
d6fea803 AC |
368 | |
369 | /* Reverse - insert N sub-words into single word quantity */ | |
370 | ||
371 | #define U2_1(I0,I1) (V2_1(I0,0) | V2_1(I1,1)) | |
372 | #define U4_1(I0,I1,I2,I3) (V4_1(I0,0) | V4_1(I1,1) | V4_1(I2,2) | V4_1(I3,3)) | |
373 | #define U8_1(I0,I1,I2,I3,I4,I5,I6,I7) \ | |
374 | (V8_1(I0,0) | V8_1(I1,1) | V8_1(I2,2) | V8_1(I3,3) \ | |
375 | | V8_1(I4,4) | V8_1(I5,5) | V8_1(I6,6) | V8_1(I7,7)) | |
f45dd42b AC |
376 | #define U16_1(I0,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15) \ |
377 | (V16_1(I0,0) | V16_1(I1,1) | V16_1(I2,2) | V16_1(I3,3) \ | |
378 | | V16_1(I4,4) | V16_1(I5,5) | V16_1(I6,6) | V16_1(I7,7) \ | |
379 | | V16_1(I8,8) | V16_1(I9,9) | V16_1(I10,10) | V16_1(I11,11) \ | |
380 | | V16_1(I12,12) | V16_1(I13,13) | V16_1(I14,14) | V16_1(I15,15)) | |
d6fea803 AC |
381 | |
382 | #define U4_2(I0,I1) (V4_2(I0,0) | V4_2(I1,1)) | |
383 | #define U8_2(I0,I1,I2,I3) (V8_2(I0,0) | V8_2(I1,1) | V8_2(I2,2) | V8_2(I3,3)) | |
f45dd42b AC |
384 | #define U16_2(I0,I1,I2,I3,I4,I5,I6,I7) \ |
385 | (V16_2(I0,0) | V16_2(I1,1) | V16_2(I2,2) | V16_2(I3,3) \ | |
386 | | V16_2(I4,4) | V16_2(I5,5) | V16_2(I6,6) | V16_2(I7,7) ) | |
d6fea803 AC |
387 | |
388 | #define U8_4(I0,I1) (V8_4(I0,0) | V8_4(I1,1)) | |
f45dd42b AC |
389 | #define U16_4(I0,I1,I2,I3) (V16_4(I0,0) | V16_4(I1,1) | V16_4(I2,2) | V16_4(I3,3)) |
390 | ||
391 | #define U16_8(I0,I1) (V16_8(I0,0) | V16_8(I1,1)) | |
d6fea803 AC |
392 | |
393 | ||
394 | #if (WITH_TARGET_WORD_BITSIZE == 64) | |
395 | #define Vword_H(X) V8_H4(X) | |
396 | #define Vword_L(X) V8_L4(X) | |
397 | #endif | |
398 | #if (WITH_TARGET_WORD_BITSIZE == 32) | |
399 | #define Vword_H(X) V4_H2(X) | |
400 | #define Vword_L(X) V4_L2(X) | |
401 | #endif | |
402 | ||
403 | ||
404 | ||
405 | ||
d6fea803 AC |
406 | #if (SIM_ENDIAN_INLINE & INCLUDE_MODULE) |
407 | # include "sim-endian.c" | |
408 | #endif | |
409 | ||
410 | #endif /* _SIM_ENDIAN_H_ */ |