clang 20.0.0git
hexagon_types.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef HEXAGON_TYPES_H
10#define HEXAGON_TYPES_H
11
12#include <hexagon_protos.h>
13
14/* Hexagon names */
15#define HEXAGON_Vect HEXAGON_Vect64
16#define HEXAGON_V_GET_D HEXAGON_V64_GET_D
17#define HEXAGON_V_GET_UD HEXAGON_V64_GET_UD
18#define HEXAGON_V_GET_W0 HEXAGON_V64_GET_W0
19#define HEXAGON_V_GET_W1 HEXAGON_V64_GET_W1
20#define HEXAGON_V_GET_UW0 HEXAGON_V64_GET_UW0
21#define HEXAGON_V_GET_UW1 HEXAGON_V64_GET_UW1
22#define HEXAGON_V_GET_H0 HEXAGON_V64_GET_H0
23#define HEXAGON_V_GET_H1 HEXAGON_V64_GET_H1
24#define HEXAGON_V_GET_H2 HEXAGON_V64_GET_H2
25#define HEXAGON_V_GET_H3 HEXAGON_V64_GET_H3
26#define HEXAGON_V_GET_UH0 HEXAGON_V64_GET_UH0
27#define HEXAGON_V_GET_UH1 HEXAGON_V64_GET_UH1
28#define HEXAGON_V_GET_UH2 HEXAGON_V64_GET_UH2
29#define HEXAGON_V_GET_UH3 HEXAGON_V64_GET_UH3
30#define HEXAGON_V_GET_B0 HEXAGON_V64_GET_B0
31#define HEXAGON_V_GET_B1 HEXAGON_V64_GET_B1
32#define HEXAGON_V_GET_B2 HEXAGON_V64_GET_B2
33#define HEXAGON_V_GET_B3 HEXAGON_V64_GET_B3
34#define HEXAGON_V_GET_B4 HEXAGON_V64_GET_B4
35#define HEXAGON_V_GET_B5 HEXAGON_V64_GET_B5
36#define HEXAGON_V_GET_B6 HEXAGON_V64_GET_B6
37#define HEXAGON_V_GET_B7 HEXAGON_V64_GET_B7
38#define HEXAGON_V_GET_UB0 HEXAGON_V64_GET_UB0
39#define HEXAGON_V_GET_UB1 HEXAGON_V64_GET_UB1
40#define HEXAGON_V_GET_UB2 HEXAGON_V64_GET_UB2
41#define HEXAGON_V_GET_UB3 HEXAGON_V64_GET_UB3
42#define HEXAGON_V_GET_UB4 HEXAGON_V64_GET_UB4
43#define HEXAGON_V_GET_UB5 HEXAGON_V64_GET_UB5
44#define HEXAGON_V_GET_UB6 HEXAGON_V64_GET_UB6
45#define HEXAGON_V_GET_UB7 HEXAGON_V64_GET_UB7
46#define HEXAGON_V_PUT_D HEXAGON_V64_PUT_D
47#define HEXAGON_V_PUT_W0 HEXAGON_V64_PUT_W0
48#define HEXAGON_V_PUT_W1 HEXAGON_V64_PUT_W1
49#define HEXAGON_V_PUT_H0 HEXAGON_V64_PUT_H0
50#define HEXAGON_V_PUT_H1 HEXAGON_V64_PUT_H1
51#define HEXAGON_V_PUT_H2 HEXAGON_V64_PUT_H2
52#define HEXAGON_V_PUT_H3 HEXAGON_V64_PUT_H3
53#define HEXAGON_V_PUT_B0 HEXAGON_V64_PUT_B0
54#define HEXAGON_V_PUT_B1 HEXAGON_V64_PUT_B1
55#define HEXAGON_V_PUT_B2 HEXAGON_V64_PUT_B2
56#define HEXAGON_V_PUT_B3 HEXAGON_V64_PUT_B3
57#define HEXAGON_V_PUT_B4 HEXAGON_V64_PUT_B4
58#define HEXAGON_V_PUT_B5 HEXAGON_V64_PUT_B5
59#define HEXAGON_V_PUT_B6 HEXAGON_V64_PUT_B6
60#define HEXAGON_V_PUT_B7 HEXAGON_V64_PUT_B7
61#define HEXAGON_V_CREATE_D HEXAGON_V64_CREATE_D
62#define HEXAGON_V_CREATE_W HEXAGON_V64_CREATE_W
63#define HEXAGON_V_CREATE_H HEXAGON_V64_CREATE_H
64#define HEXAGON_V_CREATE_B HEXAGON_V64_CREATE_B
65
66#ifdef __cplusplus
67#define HEXAGON_VectC HEXAGON_Vect64C
68#endif /* __cplusplus */
69
70/* 64 Bit Vectors */
71
72typedef long long __attribute__((__may_alias__)) HEXAGON_Vect64;
73
74/* Extract doubleword macros */
75
76#define HEXAGON_V64_GET_D(v) (v)
77#define HEXAGON_V64_GET_UD(v) ((unsigned long long)(v))
78
79/* Extract word macros */
80
81#define HEXAGON_V64_GET_W0(v) \
82 __extension__({ \
83 union { \
84 long long d; \
85 int w[2]; \
86 } _HEXAGON_V64_internal_union; \
87 _HEXAGON_V64_internal_union.d = (v); \
88 _HEXAGON_V64_internal_union.w[0]; \
89 })
90#define HEXAGON_V64_GET_W1(v) \
91 __extension__({ \
92 union { \
93 long long d; \
94 int w[2]; \
95 } _HEXAGON_V64_internal_union; \
96 _HEXAGON_V64_internal_union.d = (v); \
97 _HEXAGON_V64_internal_union.w[1]; \
98 })
99#define HEXAGON_V64_GET_UW0(v) \
100 __extension__({ \
101 union { \
102 long long d; \
103 unsigned int uw[2]; \
104 } _HEXAGON_V64_internal_union; \
105 _HEXAGON_V64_internal_union.d = (v); \
106 _HEXAGON_V64_internal_union.uw[0]; \
107 })
108#define HEXAGON_V64_GET_UW1(v) \
109 __extension__({ \
110 union { \
111 long long d; \
112 unsigned int uw[2]; \
113 } _HEXAGON_V64_internal_union; \
114 _HEXAGON_V64_internal_union.d = (v); \
115 _HEXAGON_V64_internal_union.uw[1]; \
116 })
117
118/* Extract half word macros */
119
120#define HEXAGON_V64_GET_H0(v) \
121 __extension__({ \
122 union { \
123 long long d; \
124 short h[4]; \
125 } _HEXAGON_V64_internal_union; \
126 _HEXAGON_V64_internal_union.d = (v); \
127 _HEXAGON_V64_internal_union.h[0]; \
128 })
129#define HEXAGON_V64_GET_H1(v) \
130 __extension__({ \
131 union { \
132 long long d; \
133 short h[4]; \
134 } _HEXAGON_V64_internal_union; \
135 _HEXAGON_V64_internal_union.d = (v); \
136 _HEXAGON_V64_internal_union.h[1]; \
137 })
138#define HEXAGON_V64_GET_H2(v) \
139 __extension__({ \
140 union { \
141 long long d; \
142 short h[4]; \
143 } _HEXAGON_V64_internal_union; \
144 _HEXAGON_V64_internal_union.d = (v); \
145 _HEXAGON_V64_internal_union.h[2]; \
146 })
147#define HEXAGON_V64_GET_H3(v) \
148 __extension__({ \
149 union { \
150 long long d; \
151 short h[4]; \
152 } _HEXAGON_V64_internal_union; \
153 _HEXAGON_V64_internal_union.d = (v); \
154 _HEXAGON_V64_internal_union.h[3]; \
155 })
156#define HEXAGON_V64_GET_UH0(v) \
157 __extension__({ \
158 union { \
159 long long d; \
160 unsigned short uh[4]; \
161 } _HEXAGON_V64_internal_union; \
162 _HEXAGON_V64_internal_union.d = (v); \
163 _HEXAGON_V64_internal_union.uh[0]; \
164 })
165#define HEXAGON_V64_GET_UH1(v) \
166 __extension__({ \
167 union { \
168 long long d; \
169 unsigned short uh[4]; \
170 } _HEXAGON_V64_internal_union; \
171 _HEXAGON_V64_internal_union.d = (v); \
172 _HEXAGON_V64_internal_union.uh[1]; \
173 })
174#define HEXAGON_V64_GET_UH2(v) \
175 __extension__({ \
176 union { \
177 long long d; \
178 unsigned short uh[4]; \
179 } _HEXAGON_V64_internal_union; \
180 _HEXAGON_V64_internal_union.d = (v); \
181 _HEXAGON_V64_internal_union.uh[2]; \
182 })
183#define HEXAGON_V64_GET_UH3(v) \
184 __extension__({ \
185 union { \
186 long long d; \
187 unsigned short uh[4]; \
188 } _HEXAGON_V64_internal_union; \
189 _HEXAGON_V64_internal_union.d = (v); \
190 _HEXAGON_V64_internal_union.uh[3]; \
191 })
192
193/* Extract byte macros */
194
195#define HEXAGON_V64_GET_B0(v) \
196 __extension__({ \
197 union { \
198 long long d; \
199 signed char b[8]; \
200 } _HEXAGON_V64_internal_union; \
201 _HEXAGON_V64_internal_union.d = (v); \
202 _HEXAGON_V64_internal_union.b[0]; \
203 })
204#define HEXAGON_V64_GET_B1(v) \
205 __extension__({ \
206 union { \
207 long long d; \
208 signed char b[8]; \
209 } _HEXAGON_V64_internal_union; \
210 _HEXAGON_V64_internal_union.d = (v); \
211 _HEXAGON_V64_internal_union.b[1]; \
212 })
213#define HEXAGON_V64_GET_B2(v) \
214 __extension__({ \
215 union { \
216 long long d; \
217 signed char b[8]; \
218 } _HEXAGON_V64_internal_union; \
219 _HEXAGON_V64_internal_union.d = (v); \
220 _HEXAGON_V64_internal_union.b[2]; \
221 })
222#define HEXAGON_V64_GET_B3(v) \
223 __extension__({ \
224 union { \
225 long long d; \
226 signed char b[8]; \
227 } _HEXAGON_V64_internal_union; \
228 _HEXAGON_V64_internal_union.d = (v); \
229 _HEXAGON_V64_internal_union.b[3]; \
230 })
231#define HEXAGON_V64_GET_B4(v) \
232 __extension__({ \
233 union { \
234 long long d; \
235 signed char b[8]; \
236 } _HEXAGON_V64_internal_union; \
237 _HEXAGON_V64_internal_union.d = (v); \
238 _HEXAGON_V64_internal_union.b[4]; \
239 })
240#define HEXAGON_V64_GET_B5(v) \
241 __extension__({ \
242 union { \
243 long long d; \
244 signed char b[8]; \
245 } _HEXAGON_V64_internal_union; \
246 _HEXAGON_V64_internal_union.d = (v); \
247 _HEXAGON_V64_internal_union.b[5]; \
248 })
249#define HEXAGON_V64_GET_B6(v) \
250 __extension__({ \
251 union { \
252 long long d; \
253 signed char b[8]; \
254 } _HEXAGON_V64_internal_union; \
255 _HEXAGON_V64_internal_union.d = (v); \
256 _HEXAGON_V64_internal_union.b[6]; \
257 })
258#define HEXAGON_V64_GET_B7(v) \
259 __extension__({ \
260 union { \
261 long long d; \
262 signed char b[8]; \
263 } _HEXAGON_V64_internal_union; \
264 _HEXAGON_V64_internal_union.d = (v); \
265 _HEXAGON_V64_internal_union.b[7]; \
266 })
267#define HEXAGON_V64_GET_UB0(v) \
268 __extension__({ \
269 union { \
270 long long d; \
271 unsigned char ub[8]; \
272 } _HEXAGON_V64_internal_union; \
273 _HEXAGON_V64_internal_union.d = (v); \
274 _HEXAGON_V64_internal_union.ub[0]; \
275 })
276#define HEXAGON_V64_GET_UB1(v) \
277 __extension__({ \
278 union { \
279 long long d; \
280 unsigned char ub[8]; \
281 } _HEXAGON_V64_internal_union; \
282 _HEXAGON_V64_internal_union.d = (v); \
283 _HEXAGON_V64_internal_union.ub[1]; \
284 })
285#define HEXAGON_V64_GET_UB2(v) \
286 __extension__({ \
287 union { \
288 long long d; \
289 unsigned char ub[8]; \
290 } _HEXAGON_V64_internal_union; \
291 _HEXAGON_V64_internal_union.d = (v); \
292 _HEXAGON_V64_internal_union.ub[2]; \
293 })
294#define HEXAGON_V64_GET_UB3(v) \
295 __extension__({ \
296 union { \
297 long long d; \
298 unsigned char ub[8]; \
299 } _HEXAGON_V64_internal_union; \
300 _HEXAGON_V64_internal_union.d = (v); \
301 _HEXAGON_V64_internal_union.ub[3]; \
302 })
303#define HEXAGON_V64_GET_UB4(v) \
304 __extension__({ \
305 union { \
306 long long d; \
307 unsigned char ub[8]; \
308 } _HEXAGON_V64_internal_union; \
309 _HEXAGON_V64_internal_union.d = (v); \
310 _HEXAGON_V64_internal_union.ub[4]; \
311 })
312#define HEXAGON_V64_GET_UB5(v) \
313 __extension__({ \
314 union { \
315 long long d; \
316 unsigned char ub[8]; \
317 } _HEXAGON_V64_internal_union; \
318 _HEXAGON_V64_internal_union.d = (v); \
319 _HEXAGON_V64_internal_union.ub[5]; \
320 })
321#define HEXAGON_V64_GET_UB6(v) \
322 __extension__({ \
323 union { \
324 long long d; \
325 unsigned char ub[8]; \
326 } _HEXAGON_V64_internal_union; \
327 _HEXAGON_V64_internal_union.d = (v); \
328 _HEXAGON_V64_internal_union.ub[6]; \
329 })
330#define HEXAGON_V64_GET_UB7(v) \
331 __extension__({ \
332 union { \
333 long long d; \
334 unsigned char ub[8]; \
335 } _HEXAGON_V64_internal_union; \
336 _HEXAGON_V64_internal_union.d = (v); \
337 _HEXAGON_V64_internal_union.ub[7]; \
338 })
339
340/* NOTE: All set macros return a HEXAGON_Vect64 type */
341
342/* Set doubleword macro */
343
344#define HEXAGON_V64_PUT_D(v, new) (new)
345
346/* Set word macros */
347
348#ifdef __hexagon__
349
350#define HEXAGON_V64_PUT_W0(v, new) \
351 __extension__({ \
352 union { \
353 long long d; \
354 int w[2]; \
355 } _HEXAGON_V64_internal_union; \
356 _HEXAGON_V64_internal_union.d = (v); \
357 _HEXAGON_V64_internal_union.w[0] = (new); \
358 _HEXAGON_V64_internal_union.d; \
359 })
360#define HEXAGON_V64_PUT_W1(v, new) \
361 __extension__({ \
362 union { \
363 long long d; \
364 int w[2]; \
365 } _HEXAGON_V64_internal_union; \
366 _HEXAGON_V64_internal_union.d = (v); \
367 _HEXAGON_V64_internal_union.w[1] = (new); \
368 _HEXAGON_V64_internal_union.d; \
369 })
370
371#else /* !__hexagon__ */
372
373#define HEXAGON_V64_PUT_W0(v, new) \
374 (((v) & 0xffffffff00000000LL) | ((HEXAGON_Vect64)((unsigned int)(new))))
375#define HEXAGON_V64_PUT_W1(v, new) \
376 (((v) & 0x00000000ffffffffLL) | (((HEXAGON_Vect64)(new)) << 32LL))
377
378#endif /* !__hexagon__ */
379
380/* Set half word macros */
381
382#ifdef __hexagon__
383
384#define HEXAGON_V64_PUT_H0(v, new) \
385 __extension__({ \
386 union { \
387 long long d; \
388 short h[4]; \
389 } _HEXAGON_V64_internal_union; \
390 _HEXAGON_V64_internal_union.d = (v); \
391 _HEXAGON_V64_internal_union.h[0] = (new); \
392 _HEXAGON_V64_internal_union.d; \
393 })
394#define HEXAGON_V64_PUT_H1(v, new) \
395 __extension__({ \
396 union { \
397 long long d; \
398 short h[4]; \
399 } _HEXAGON_V64_internal_union; \
400 _HEXAGON_V64_internal_union.d = (v); \
401 _HEXAGON_V64_internal_union.h[1] = (new); \
402 _HEXAGON_V64_internal_union.d; \
403 })
404#define HEXAGON_V64_PUT_H2(v, new) \
405 __extension__({ \
406 union { \
407 long long d; \
408 short h[4]; \
409 } _HEXAGON_V64_internal_union; \
410 _HEXAGON_V64_internal_union.d = (v); \
411 _HEXAGON_V64_internal_union.h[2] = (new); \
412 _HEXAGON_V64_internal_union.d; \
413 })
414#define HEXAGON_V64_PUT_H3(v, new) \
415 __extension__({ \
416 union { \
417 long long d; \
418 short h[4]; \
419 } _HEXAGON_V64_internal_union; \
420 _HEXAGON_V64_internal_union.d = (v); \
421 _HEXAGON_V64_internal_union.h[3] = (new); \
422 _HEXAGON_V64_internal_union.d; \
423 })
424
425#else /* !__hexagon__ */
426
427#define HEXAGON_V64_PUT_H0(v, new) \
428 (((v) & 0xffffffffffff0000LL) | ((HEXAGON_Vect64)((unsigned short)(new))))
429#define HEXAGON_V64_PUT_H1(v, new) \
430 (((v) & 0xffffffff0000ffffLL) | (((HEXAGON_Vect64)((unsigned short)(new))) << 16LL))
431#define HEXAGON_V64_PUT_H2(v, new) \
432 (((v) & 0xffff0000ffffffffLL) | (((HEXAGON_Vect64)((unsigned short)(new))) << 32LL))
433#define HEXAGON_V64_PUT_H3(v, new) \
434 (((v) & 0x0000ffffffffffffLL) | (((HEXAGON_Vect64)(new)) << 48LL))
435
436#endif /* !__hexagon__ */
437
438/* Set byte macros */
439
440#ifdef __hexagon__
441
442#define HEXAGON_V64_PUT_B0(v, new) \
443 __extension__({ \
444 union { \
445 long long d; \
446 char b[8]; \
447 } _HEXAGON_V64_internal_union; \
448 _HEXAGON_V64_internal_union.d = (v); \
449 _HEXAGON_V64_internal_union.b[0] = (new); \
450 _HEXAGON_V64_internal_union.d; \
451 })
452#define HEXAGON_V64_PUT_B1(v, new) \
453 __extension__({ \
454 union { \
455 long long d; \
456 char b[8]; \
457 } _HEXAGON_V64_internal_union; \
458 _HEXAGON_V64_internal_union.d = (v); \
459 _HEXAGON_V64_internal_union.b[1] = (new); \
460 _HEXAGON_V64_internal_union.d; \
461 })
462#define HEXAGON_V64_PUT_B2(v, new) \
463 __extension__({ \
464 union { \
465 long long d; \
466 char b[8]; \
467 } _HEXAGON_V64_internal_union; \
468 _HEXAGON_V64_internal_union.d = (v); \
469 _HEXAGON_V64_internal_union.b[2] = (new); \
470 _HEXAGON_V64_internal_union.d; \
471 })
472#define HEXAGON_V64_PUT_B3(v, new) \
473 __extension__({ \
474 union { \
475 long long d; \
476 char b[8]; \
477 } _HEXAGON_V64_internal_union; \
478 _HEXAGON_V64_internal_union.d = (v); \
479 _HEXAGON_V64_internal_union.b[3] = (new); \
480 _HEXAGON_V64_internal_union.d; \
481 })
482#define HEXAGON_V64_PUT_B4(v, new) \
483 __extension__({ \
484 union { \
485 long long d; \
486 char b[8]; \
487 } _HEXAGON_V64_internal_union; \
488 _HEXAGON_V64_internal_union.d = (v); \
489 _HEXAGON_V64_internal_union.b[4] = (new); \
490 _HEXAGON_V64_internal_union.d; \
491 })
492#define HEXAGON_V64_PUT_B5(v, new) \
493 __extension__({ \
494 union { \
495 long long d; \
496 char b[8]; \
497 } _HEXAGON_V64_internal_union; \
498 _HEXAGON_V64_internal_union.d = (v); \
499 _HEXAGON_V64_internal_union.b[5] = (new); \
500 _HEXAGON_V64_internal_union.d; \
501 })
502#define HEXAGON_V64_PUT_B6(v, new) \
503 __extension__({ \
504 union { \
505 long long d; \
506 char b[8]; \
507 } _HEXAGON_V64_internal_union; \
508 _HEXAGON_V64_internal_union.d = (v); \
509 _HEXAGON_V64_internal_union.b[6] = (new); \
510 _HEXAGON_V64_internal_union.d; \
511 })
512#define HEXAGON_V64_PUT_B7(v, new) \
513 __extension__({ \
514 union { \
515 long long d; \
516 char b[8]; \
517 } _HEXAGON_V64_internal_union; \
518 _HEXAGON_V64_internal_union.d = (v); \
519 _HEXAGON_V64_internal_union.b[7] = (new); \
520 _HEXAGON_V64_internal_union.d; \
521 })
522
523#else /* !__hexagon__ */
524
525#define HEXAGON_V64_PUT_B0(v, new) \
526 (((v) & 0xffffffffffffff00LL) | ((HEXAGON_Vect64)((unsigned char)(new))))
527#define HEXAGON_V64_PUT_B1(v, new) \
528 (((v) & 0xffffffffffff00ffLL) | (((HEXAGON_Vect64)((unsigned char)(new))) << 8LL))
529#define HEXAGON_V64_PUT_B2(v, new) \
530 (((v) & 0xffffffffff00ffffLL) | (((HEXAGON_Vect64)((unsigned char)(new))) << 16LL))
531#define HEXAGON_V64_PUT_B3(v, new) \
532 (((v) & 0xffffffff00ffffffLL) | (((HEXAGON_Vect64)((unsigned char)(new))) << 24LL))
533#define HEXAGON_V64_PUT_B4(v, new) \
534 (((v) & 0xffffff00ffffffffLL) | (((HEXAGON_Vect64)((unsigned char)(new))) << 32LL))
535#define HEXAGON_V64_PUT_B5(v, new) \
536 (((v) & 0xffff00ffffffffffLL) | (((HEXAGON_Vect64)((unsigned char)(new))) << 40LL))
537#define HEXAGON_V64_PUT_B6(v, new) \
538 (((v) & 0xff00ffffffffffffLL) | (((HEXAGON_Vect64)((unsigned char)(new))) << 48LL))
539#define HEXAGON_V64_PUT_B7(v, new) \
540 (((v) & 0x00ffffffffffffffLL) | (((HEXAGON_Vect64)(new)) << 56LL))
541
542#endif /* !__hexagon__ */
543
544/* NOTE: All create macros return a HEXAGON_Vect64 type */
545
546/* Create from a doubleword */
547
548#define HEXAGON_V64_CREATE_D(d) (d)
549
550/* Create from words */
551
552#ifdef __hexagon__
553
554#define HEXAGON_V64_CREATE_W(w1, w0) \
555 __extension__({ \
556 union { \
557 long long d; \
558 int w[2]; \
559 } _HEXAGON_V64_internal_union; \
560 _HEXAGON_V64_internal_union.w[0] = (w0); \
561 _HEXAGON_V64_internal_union.w[1] = (w1); \
562 _HEXAGON_V64_internal_union.d; \
563 })
564
565#else /* !__hexagon__ */
566
567#define HEXAGON_V64_CREATE_W(w1, w0) \
568 ((((HEXAGON_Vect64)(w1)) << 32LL) | ((HEXAGON_Vect64)((w0) & 0xffffffff)))
569
570#endif /* !__hexagon__ */
571
572/* Create from half words */
573
574#ifdef __hexagon__
575
576#define HEXAGON_V64_CREATE_H(h3, h2, h1, h0) \
577 __extension__({ \
578 union { \
579 long long d; \
580 short h[4]; \
581 } _HEXAGON_V64_internal_union; \
582 _HEXAGON_V64_internal_union.h[0] = (h0); \
583 _HEXAGON_V64_internal_union.h[1] = (h1); \
584 _HEXAGON_V64_internal_union.h[2] = (h2); \
585 _HEXAGON_V64_internal_union.h[3] = (h3); \
586 _HEXAGON_V64_internal_union.d; \
587 })
588
589#else /* !__hexagon__ */
590
591#define HEXAGON_V64_CREATE_H(h3, h2, h1, h0) \
592 ((((HEXAGON_Vect64)(h3)) << 48LL) | (((HEXAGON_Vect64)((h2) & 0xffff)) << 32LL) | \
593 (((HEXAGON_Vect64)((h1) & 0xffff)) << 16LL) | ((HEXAGON_Vect64)((h0) & 0xffff)))
594
595#endif /* !__hexagon__ */
596
597/* Create from bytes */
598
599#ifdef __hexagon__
600
601#define HEXAGON_V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0) \
602 __extension__({ \
603 union { \
604 long long d; \
605 char b[8]; \
606 } _HEXAGON_V64_internal_union; \
607 _HEXAGON_V64_internal_union.b[0] = (b0); \
608 _HEXAGON_V64_internal_union.b[1] = (b1); \
609 _HEXAGON_V64_internal_union.b[2] = (b2); \
610 _HEXAGON_V64_internal_union.b[3] = (b3); \
611 _HEXAGON_V64_internal_union.b[4] = (b4); \
612 _HEXAGON_V64_internal_union.b[5] = (b5); \
613 _HEXAGON_V64_internal_union.b[6] = (b6); \
614 _HEXAGON_V64_internal_union.b[7] = (b7); \
615 _HEXAGON_V64_internal_union.d; \
616 })
617
618#else /* !__hexagon__ */
619
620#define HEXAGON_V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0) \
621 ((((HEXAGON_Vect64)(b7)) << 56LL) | (((HEXAGON_Vect64)((b6) & 0xff)) << 48LL) | \
622 (((HEXAGON_Vect64)((b5) & 0xff)) << 40LL) | (((HEXAGON_Vect64)((b4) & 0xff)) << 32LL) | \
623 (((HEXAGON_Vect64)((b3) & 0xff)) << 24LL) | (((HEXAGON_Vect64)((b2) & 0xff)) << 16LL) | \
624 (((HEXAGON_Vect64)((b1) & 0xff)) << 8LL) | ((HEXAGON_Vect64)((b0) & 0xff)))
625
626#endif /* !__hexagon__ */
627
628#ifdef __cplusplus
629
630class HEXAGON_Vect64C {
631public:
632 // Constructors
633 HEXAGON_Vect64C(long long d = 0) : data(d) {};
634 HEXAGON_Vect64C(int w1, int w0) : data(HEXAGON_V64_CREATE_W(w1, w0)) {};
635 HEXAGON_Vect64C(short h3, short h2, short h1, short h0)
636 : data(HEXAGON_V64_CREATE_H(h3, h2, h1, h0)) {};
637 HEXAGON_Vect64C(signed char b7, signed char b6, signed char b5, signed char b4,
638 signed char b3, signed char b2, signed char b1, signed char b0)
639 : data(HEXAGON_V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0)) {};
640 HEXAGON_Vect64C(const HEXAGON_Vect64C &v) : data(v.data) {};
641
642 HEXAGON_Vect64C &operator=(const HEXAGON_Vect64C &v) {
643 data = v.data;
644 return *this;
645 };
646
647 operator long long() {
648 return data;
649 };
650
651 // Extract doubleword methods
652 long long D(void) {
653 return HEXAGON_V64_GET_D(data);
654 };
655 unsigned long long UD(void) {
656 return HEXAGON_V64_GET_UD(data);
657 };
658
659 // Extract word methods
660 int W0(void) {
661 return HEXAGON_V64_GET_W0(data);
662 };
663 int W1(void) {
664 return HEXAGON_V64_GET_W1(data);
665 };
666 unsigned int UW0(void) {
667 return HEXAGON_V64_GET_UW0(data);
668 };
669 unsigned int UW1(void) {
670 return HEXAGON_V64_GET_UW1(data);
671 };
672
673 // Extract half word methods
674 short H0(void) {
675 return HEXAGON_V64_GET_H0(data);
676 };
677 short H1(void) {
678 return HEXAGON_V64_GET_H1(data);
679 };
680 short H2(void) {
681 return HEXAGON_V64_GET_H2(data);
682 };
683 short H3(void) {
684 return HEXAGON_V64_GET_H3(data);
685 };
686 unsigned short UH0(void) {
687 return HEXAGON_V64_GET_UH0(data);
688 };
689 unsigned short UH1(void) {
690 return HEXAGON_V64_GET_UH1(data);
691 };
692 unsigned short UH2(void) {
693 return HEXAGON_V64_GET_UH2(data);
694 };
695 unsigned short UH3(void) {
696 return HEXAGON_V64_GET_UH3(data);
697 };
698
699 // Extract byte methods
700 signed char B0(void) {
701 return HEXAGON_V64_GET_B0(data);
702 };
703 signed char B1(void) {
704 return HEXAGON_V64_GET_B1(data);
705 };
706 signed char B2(void) {
707 return HEXAGON_V64_GET_B2(data);
708 };
709 signed char B3(void) {
710 return HEXAGON_V64_GET_B3(data);
711 };
712 signed char B4(void) {
713 return HEXAGON_V64_GET_B4(data);
714 };
715 signed char B5(void) {
716 return HEXAGON_V64_GET_B5(data);
717 };
718 signed char B6(void) {
719 return HEXAGON_V64_GET_B6(data);
720 };
721 signed char B7(void) {
722 return HEXAGON_V64_GET_B7(data);
723 };
724 unsigned char UB0(void) {
725 return HEXAGON_V64_GET_UB0(data);
726 };
727 unsigned char UB1(void) {
728 return HEXAGON_V64_GET_UB1(data);
729 };
730 unsigned char UB2(void) {
731 return HEXAGON_V64_GET_UB2(data);
732 };
733 unsigned char UB3(void) {
734 return HEXAGON_V64_GET_UB3(data);
735 };
736 unsigned char UB4(void) {
737 return HEXAGON_V64_GET_UB4(data);
738 };
739 unsigned char UB5(void) {
740 return HEXAGON_V64_GET_UB5(data);
741 };
742 unsigned char UB6(void) {
743 return HEXAGON_V64_GET_UB6(data);
744 };
745 unsigned char UB7(void) {
746 return HEXAGON_V64_GET_UB7(data);
747 };
748
749 // NOTE: All set methods return a HEXAGON_Vect64C type
750
751 // Set doubleword method
752 HEXAGON_Vect64C D(long long d) {
753 return HEXAGON_Vect64C(HEXAGON_V64_PUT_D(data, d));
754 };
755
756 // Set word methods
757 HEXAGON_Vect64C W0(int w) {
758 return HEXAGON_Vect64C(HEXAGON_V64_PUT_W0(data, w));
759 };
760 HEXAGON_Vect64C W1(int w) {
761 return HEXAGON_Vect64C(HEXAGON_V64_PUT_W1(data, w));
762 };
763
764 // Set half word methods
765 HEXAGON_Vect64C H0(short h) {
766 return HEXAGON_Vect64C(HEXAGON_V64_PUT_H0(data, h));
767 };
768 HEXAGON_Vect64C H1(short h) {
769 return HEXAGON_Vect64C(HEXAGON_V64_PUT_H1(data, h));
770 };
771 HEXAGON_Vect64C H2(short h) {
772 return HEXAGON_Vect64C(HEXAGON_V64_PUT_H2(data, h));
773 };
774 HEXAGON_Vect64C H3(short h) {
775 return HEXAGON_Vect64C(HEXAGON_V64_PUT_H3(data, h));
776 };
777
778 // Set byte methods
779 HEXAGON_Vect64C B0(signed char b) {
780 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B0(data, b));
781 };
782 HEXAGON_Vect64C B1(signed char b) {
783 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B1(data, b));
784 };
785 HEXAGON_Vect64C B2(signed char b) {
786 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B2(data, b));
787 };
788 HEXAGON_Vect64C B3(signed char b) {
789 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B3(data, b));
790 };
791 HEXAGON_Vect64C B4(signed char b) {
792 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B4(data, b));
793 };
794 HEXAGON_Vect64C B5(signed char b) {
795 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B5(data, b));
796 };
797 HEXAGON_Vect64C B6(signed char b) {
798 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B6(data, b));
799 };
800 HEXAGON_Vect64C B7(signed char b) {
801 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B7(data, b));
802 };
803
804private:
805 long long data;
806};
807
808#endif /* __cplusplus */
809
810/* 32 Bit Vectors */
811
812typedef int HEXAGON_Vect32;
813
814/* Extract word macros */
815
816#define HEXAGON_V32_GET_W(v) (v)
817#define HEXAGON_V32_GET_UW(v) ((unsigned int)(v))
818
819/* Extract half word macros */
820
821#define HEXAGON_V32_GET_H0(v) \
822 __extension__({ \
823 union { \
824 int w; \
825 short h[2]; \
826 } _HEXAGON_V32_internal_union; \
827 _HEXAGON_V32_internal_union.w = (v); \
828 _HEXAGON_V32_internal_union.h[0]; \
829 })
830#define HEXAGON_V32_GET_H1(v) \
831 __extension__({ \
832 union { \
833 int w; \
834 short h[2]; \
835 } _HEXAGON_V32_internal_union; \
836 _HEXAGON_V32_internal_union.w = (v); \
837 _HEXAGON_V32_internal_union.h[1]; \
838 })
839#define HEXAGON_V32_GET_UH0(v) \
840 __extension__({ \
841 union { \
842 int w; \
843 unsigned short uh[2]; \
844 } _HEXAGON_V32_internal_union; \
845 _HEXAGON_V32_internal_union.w = (v); \
846 _HEXAGON_V32_internal_union.uh[0]; \
847 })
848#define HEXAGON_V32_GET_UH1(v) \
849 __extension__({ \
850 union { \
851 int w; \
852 unsigned short uh[2]; \
853 } _HEXAGON_V32_internal_union; \
854 _HEXAGON_V32_internal_union.w = (v); \
855 _HEXAGON_V32_internal_union.uh[1]; \
856 })
857
858/* Extract byte macros */
859
860#define HEXAGON_V32_GET_B0(v) \
861 __extension__({ \
862 union { \
863 int w; \
864 signed char b[4]; \
865 } _HEXAGON_V32_internal_union; \
866 _HEXAGON_V32_internal_union.w = (v); \
867 _HEXAGON_V32_internal_union.b[0]; \
868 })
869#define HEXAGON_V32_GET_B1(v) \
870 __extension__({ \
871 union { \
872 int w; \
873 signed char b[4]; \
874 } _HEXAGON_V32_internal_union; \
875 _HEXAGON_V32_internal_union.w = (v); \
876 _HEXAGON_V32_internal_union.b[1]; \
877 })
878#define HEXAGON_V32_GET_B2(v) \
879 __extension__({ \
880 union { \
881 int w; \
882 signed char b[4]; \
883 } _HEXAGON_V32_internal_union; \
884 _HEXAGON_V32_internal_union.w = (v); \
885 _HEXAGON_V32_internal_union.b[2]; \
886 })
887#define HEXAGON_V32_GET_B3(v) \
888 __extension__({ \
889 union { \
890 int w; \
891 signed char b[4]; \
892 } _HEXAGON_V32_internal_union; \
893 _HEXAGON_V32_internal_union.w = (v); \
894 _HEXAGON_V32_internal_union.b[3]; \
895 })
896#define HEXAGON_V32_GET_UB0(v) \
897 __extension__({ \
898 union { \
899 int w; \
900 unsigned char ub[4]; \
901 } _HEXAGON_V32_internal_union; \
902 _HEXAGON_V32_internal_union.w = (v); \
903 _HEXAGON_V32_internal_union.ub[0]; \
904 })
905#define HEXAGON_V32_GET_UB1(v) \
906 __extension__({ \
907 union { \
908 int w; \
909 unsigned char ub[4]; \
910 } _HEXAGON_V32_internal_union; \
911 _HEXAGON_V32_internal_union.w = (v); \
912 _HEXAGON_V32_internal_union.ub[1]; \
913 })
914#define HEXAGON_V32_GET_UB2(v) \
915 __extension__({ \
916 union { \
917 int w; \
918 unsigned char ub[4]; \
919 } _HEXAGON_V32_internal_union; \
920 _HEXAGON_V32_internal_union.w = (v); \
921 _HEXAGON_V32_internal_union.ub[2]; \
922 })
923#define HEXAGON_V32_GET_UB3(v) \
924 __extension__({ \
925 union { \
926 int w; \
927 unsigned char ub[4]; \
928 } _HEXAGON_V32_internal_union; \
929 _HEXAGON_V32_internal_union.w = (v); \
930 _HEXAGON_V32_internal_union.ub[3]; \
931 })
932
933/* NOTE: All set macros return a HEXAGON_Vect32 type */
934
935/* Set word macro */
936
937#define HEXAGON_V32_PUT_W(v, new) (new)
938
939/* Set half word macros */
940
941#ifdef __hexagon__
942
943#define HEXAGON_V32_PUT_H0(v, new) \
944 __extension__({ \
945 union { \
946 int w; \
947 short h[2]; \
948 } _HEXAGON_V32_internal_union; \
949 _HEXAGON_V32_internal_union.w = (v); \
950 _HEXAGON_V32_internal_union.h[0] = (new); \
951 _HEXAGON_V32_internal_union.w; \
952 })
953#define HEXAGON_V32_PUT_H1(v, new) \
954 __extension__({ \
955 union { \
956 int w; \
957 short h[2]; \
958 } _HEXAGON_V32_internal_union; \
959 _HEXAGON_V32_internal_union.w = (v); \
960 _HEXAGON_V32_internal_union.h[1] = (new); \
961 _HEXAGON_V32_internal_union.w; \
962 })
963
964#else /* !__hexagon__ */
965
966#define HEXAGON_V32_PUT_H0(v, new) \
967 (((v) & 0xffff0000) | ((HEXAGON_Vect32)((unsigned short)(new))))
968#define HEXAGON_V32_PUT_H1(v, new) (((v) & 0x0000ffff) | (((HEXAGON_Vect32)(new)) << 16))
969
970#endif /* !__hexagon__ */
971
972/* Set byte macros */
973
974#ifdef __hexagon__
975
976#define HEXAGON_V32_PUT_B0(v, new) \
977 __extension__({ \
978 union { \
979 int w; \
980 char b[4]; \
981 } _HEXAGON_V32_internal_union; \
982 _HEXAGON_V32_internal_union.w = (v); \
983 _HEXAGON_V32_internal_union.b[0] = (new); \
984 _HEXAGON_V32_internal_union.w; \
985 })
986#define HEXAGON_V32_PUT_B1(v, new) \
987 __extension__({ \
988 union { \
989 int w; \
990 char b[4]; \
991 } _HEXAGON_V32_internal_union; \
992 _HEXAGON_V32_internal_union.w = (v); \
993 _HEXAGON_V32_internal_union.b[1] = (new); \
994 _HEXAGON_V32_internal_union.w; \
995 })
996#define HEXAGON_V32_PUT_B2(v, new) \
997 __extension__({ \
998 union { \
999 int w; \
1000 char b[4]; \
1001 } _HEXAGON_V32_internal_union; \
1002 _HEXAGON_V32_internal_union.w = (v); \
1003 _HEXAGON_V32_internal_union.b[2] = (new); \
1004 _HEXAGON_V32_internal_union.w; \
1005 })
1006#define HEXAGON_V32_PUT_B3(v, new) \
1007 __extension__({ \
1008 union { \
1009 int w; \
1010 char b[4]; \
1011 } _HEXAGON_V32_internal_union; \
1012 _HEXAGON_V32_internal_union.w = (v); \
1013 _HEXAGON_V32_internal_union.b[3] = (new); \
1014 _HEXAGON_V32_internal_union.w; \
1015 })
1016
1017#else /* !__hexagon__ */
1018
1019#define HEXAGON_V32_PUT_B0(v, new) \
1020 (((v) & 0xffffff00) | ((HEXAGON_Vect32)((unsigned char)(new))))
1021#define HEXAGON_V32_PUT_B1(v, new) \
1022 (((v) & 0xffff00ff) | (((HEXAGON_Vect32)((unsigned char)(new))) << 8))
1023#define HEXAGON_V32_PUT_B2(v, new) \
1024 (((v) & 0xff00ffff) | (((HEXAGON_Vect32)((unsigned char)(new))) << 16))
1025#define HEXAGON_V32_PUT_B3(v, new) (((v) & 0x00ffffff) | (((HEXAGON_Vect32)(new)) << 24))
1026
1027#endif /* !__hexagon__ */
1028
1029/* NOTE: All create macros return a HEXAGON_Vect32 type */
1030
1031/* Create from a word */
1032
1033#define HEXAGON_V32_CREATE_W(w) (w)
1034
1035/* Create from half words */
1036
1037#ifdef __hexagon__
1038
1039#define HEXAGON_V32_CREATE_H(h1, h0) \
1040 __extension__({ \
1041 union { \
1042 long long d; \
1043 short h[2]; \
1044 } _HEXAGON_V32_internal_union; \
1045 _HEXAGON_V32_internal_union.h[0] = (h0); \
1046 _HEXAGON_V32_internal_union.h[1] = (h1); \
1047 _HEXAGON_V32_internal_union.d; \
1048 })
1049
1050#else /* !__hexagon__ */
1051
1052#define HEXAGON_V32_CREATE_H(h1, h0) \
1053 ((((HEXAGON_Vect32)(h1)) << 16) | ((HEXAGON_Vect32)((h0) & 0xffff)))
1054
1055#endif /* !__hexagon__ */
1056
1057/* Create from bytes */
1058#ifdef __hexagon__
1059
1060#define HEXAGON_V32_CREATE_B(b3, b2, b1, b0) \
1061 __extension__({ \
1062 union { \
1063 long long d; \
1064 char b[4]; \
1065 } _HEXAGON_V32_internal_union; \
1066 _HEXAGON_V32_internal_union.b[0] = (b0); \
1067 _HEXAGON_V32_internal_union.b[1] = (b1); \
1068 _HEXAGON_V32_internal_union.b[2] = (b2); \
1069 _HEXAGON_V32_internal_union.b[3] = (b3); \
1070 _HEXAGON_V32_internal_union.d; \
1071 })
1072
1073#else /* !__hexagon__ */
1074
1075#define HEXAGON_V32_CREATE_B(b3, b2, b1, b0) \
1076 ((((HEXAGON_Vect32)(b3)) << 24) | (((HEXAGON_Vect32)((b2) & 0xff)) << 16) | \
1077 (((HEXAGON_Vect32)((b1) & 0xff)) << 8) | ((HEXAGON_Vect32)((b0) & 0xff)))
1078
1079#endif /* !__hexagon__ */
1080
1081#ifdef __cplusplus
1082
1083class HEXAGON_Vect32C {
1084public:
1085 // Constructors
1086 HEXAGON_Vect32C(int w = 0) : data(w) {};
1087 HEXAGON_Vect32C(short h1, short h0) : data(HEXAGON_V32_CREATE_H(h1, h0)) {};
1088 HEXAGON_Vect32C(signed char b3, signed char b2, signed char b1, signed char b0)
1089 : data(HEXAGON_V32_CREATE_B(b3, b2, b1, b0)) {};
1090 HEXAGON_Vect32C(const HEXAGON_Vect32C &v) : data(v.data) {};
1091
1092 HEXAGON_Vect32C &operator=(const HEXAGON_Vect32C &v) {
1093 data = v.data;
1094 return *this;
1095 };
1096
1097 operator int() {
1098 return data;
1099 };
1100
1101 // Extract word methods
1102 int W(void) {
1103 return HEXAGON_V32_GET_W(data);
1104 };
1105 unsigned int UW(void) {
1106 return HEXAGON_V32_GET_UW(data);
1107 };
1108
1109 // Extract half word methods
1110 short H0(void) {
1111 return HEXAGON_V32_GET_H0(data);
1112 };
1113 short H1(void) {
1114 return HEXAGON_V32_GET_H1(data);
1115 };
1116 unsigned short UH0(void) {
1117 return HEXAGON_V32_GET_UH0(data);
1118 };
1119 unsigned short UH1(void) {
1120 return HEXAGON_V32_GET_UH1(data);
1121 };
1122
1123 // Extract byte methods
1124 signed char B0(void) {
1125 return HEXAGON_V32_GET_B0(data);
1126 };
1127 signed char B1(void) {
1128 return HEXAGON_V32_GET_B1(data);
1129 };
1130 signed char B2(void) {
1131 return HEXAGON_V32_GET_B2(data);
1132 };
1133 signed char B3(void) {
1134 return HEXAGON_V32_GET_B3(data);
1135 };
1136 unsigned char UB0(void) {
1137 return HEXAGON_V32_GET_UB0(data);
1138 };
1139 unsigned char UB1(void) {
1140 return HEXAGON_V32_GET_UB1(data);
1141 };
1142 unsigned char UB2(void) {
1143 return HEXAGON_V32_GET_UB2(data);
1144 };
1145 unsigned char UB3(void) {
1146 return HEXAGON_V32_GET_UB3(data);
1147 };
1148
1149 // NOTE: All set methods return a HEXAGON_Vect32C type
1150
1151 // Set word method
1152 HEXAGON_Vect32C W(int w) {
1153 return HEXAGON_Vect32C(HEXAGON_V32_PUT_W(data, w));
1154 };
1155
1156 // Set half word methods
1157 HEXAGON_Vect32C H0(short h) {
1158 return HEXAGON_Vect32C(HEXAGON_V32_PUT_H0(data, h));
1159 };
1160 HEXAGON_Vect32C H1(short h) {
1161 return HEXAGON_Vect32C(HEXAGON_V32_PUT_H1(data, h));
1162 };
1163
1164 // Set byte methods
1165 HEXAGON_Vect32C B0(signed char b) {
1166 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B0(data, b));
1167 };
1168 HEXAGON_Vect32C B1(signed char b) {
1169 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B1(data, b));
1170 };
1171 HEXAGON_Vect32C B2(signed char b) {
1172 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B2(data, b));
1173 };
1174 HEXAGON_Vect32C B3(signed char b) {
1175 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B3(data, b));
1176 };
1177
1178private:
1179 int data;
1180};
1181
1182#endif /* __cplusplus */
1183
1184// V65 Vector types
1185#if __HVX_ARCH__ >= 65
1186#if defined __HVX__ && (__HVX_LENGTH__ == 128)
1187 typedef long HEXAGON_VecPred128 __attribute__((__vector_size__(128)))
1188 __attribute__((aligned(128)));
1189
1190 typedef long HEXAGON_Vect1024 __attribute__((__vector_size__(128)))
1191 __attribute__((aligned(128)));
1192
1193 typedef long HEXAGON_Vect2048 __attribute__((__vector_size__(256)))
1194 __attribute__((aligned(256)));
1195
1196 typedef long HEXAGON_UVect1024 __attribute__((__vector_size__(128)))
1197 __attribute__((aligned(4)));
1198
1199 typedef long HEXAGON_UVect2048 __attribute__((__vector_size__(256)))
1200 __attribute__((aligned(4)));
1201
1202 #define HVX_VectorPred HEXAGON_VecPred128
1203 #define HVX_Vector HEXAGON_Vect1024
1204 #define HVX_VectorPair HEXAGON_Vect2048
1205 #define HVX_UVector HEXAGON_UVect1024
1206 #define HVX_UVectorPair HEXAGON_UVect2048
1207#else /* defined __HVX__ && (__HVX_LENGTH__ == 128) */
1208#if defined __HVX__ && (__HVX_LENGTH__ == 64)
1209 typedef long HEXAGON_VecPred64 __attribute__((__vector_size__(64)))
1210 __attribute__((aligned(64)));
1211
1212 typedef long HEXAGON_Vect512 __attribute__((__vector_size__(64)))
1213 __attribute__((aligned(64)));
1214
1215 typedef long HEXAGON_Vect1024 __attribute__((__vector_size__(128)))
1216 __attribute__((aligned(128)));
1217
1218 typedef long HEXAGON_UVect512 __attribute__((__vector_size__(64)))
1219 __attribute__((aligned(4)));
1220
1221 typedef long HEXAGON_UVect1024 __attribute__((__vector_size__(128)))
1222 __attribute__((aligned(4)));
1223
1224 #define HVX_VectorPred HEXAGON_VecPred64
1225 #define HVX_Vector HEXAGON_Vect512
1226 #define HVX_VectorPair HEXAGON_Vect1024
1227 #define HVX_UVector HEXAGON_UVect512
1228 #define HVX_UVectorPair HEXAGON_UVect1024
1229#endif /* defined __HVX__ && (__HVX_LENGTH__ == 64) */
1230#endif /* defined __HVX__ && (__HVX_LENGTH__ == 128) */
1231#endif /* __HVX_ARCH__ >= 65 */
1232
1233/* Predicates */
1234
1235typedef int HEXAGON_Pred;
1236
1237/***
1238 *** backward compatibility aliases
1239 ***/
1240
1241/* Old names */
1242#define Q6Vect Q6Vect64
1243#define Q6V_GET_D Q6V64_GET_D
1244#define Q6V_GET_UD Q6V64_GET_UD
1245#define Q6V_GET_W0 Q6V64_GET_W0
1246#define Q6V_GET_W1 Q6V64_GET_W1
1247#define Q6V_GET_UW0 Q6V64_GET_UW0
1248#define Q6V_GET_UW1 Q6V64_GET_UW1
1249#define Q6V_GET_H0 Q6V64_GET_H0
1250#define Q6V_GET_H1 Q6V64_GET_H1
1251#define Q6V_GET_H2 Q6V64_GET_H2
1252#define Q6V_GET_H3 Q6V64_GET_H3
1253#define Q6V_GET_UH0 Q6V64_GET_UH0
1254#define Q6V_GET_UH1 Q6V64_GET_UH1
1255#define Q6V_GET_UH2 Q6V64_GET_UH2
1256#define Q6V_GET_UH3 Q6V64_GET_UH3
1257#define Q6V_GET_B0 Q6V64_GET_B0
1258#define Q6V_GET_B1 Q6V64_GET_B1
1259#define Q6V_GET_B2 Q6V64_GET_B2
1260#define Q6V_GET_B3 Q6V64_GET_B3
1261#define Q6V_GET_B4 Q6V64_GET_B4
1262#define Q6V_GET_B5 Q6V64_GET_B5
1263#define Q6V_GET_B6 Q6V64_GET_B6
1264#define Q6V_GET_B7 Q6V64_GET_B7
1265#define Q6V_GET_UB0 Q6V64_GET_UB0
1266#define Q6V_GET_UB1 Q6V64_GET_UB1
1267#define Q6V_GET_UB2 Q6V64_GET_UB2
1268#define Q6V_GET_UB3 Q6V64_GET_UB3
1269#define Q6V_GET_UB4 Q6V64_GET_UB4
1270#define Q6V_GET_UB5 Q6V64_GET_UB5
1271#define Q6V_GET_UB6 Q6V64_GET_UB6
1272#define Q6V_GET_UB7 Q6V64_GET_UB7
1273#define Q6V_PUT_D Q6V64_PUT_D
1274#define Q6V_PUT_W0 Q6V64_PUT_W0
1275#define Q6V_PUT_W1 Q6V64_PUT_W1
1276#define Q6V_PUT_H0 Q6V64_PUT_H0
1277#define Q6V_PUT_H1 Q6V64_PUT_H1
1278#define Q6V_PUT_H2 Q6V64_PUT_H2
1279#define Q6V_PUT_H3 Q6V64_PUT_H3
1280#define Q6V_PUT_B0 Q6V64_PUT_B0
1281#define Q6V_PUT_B1 Q6V64_PUT_B1
1282#define Q6V_PUT_B2 Q6V64_PUT_B2
1283#define Q6V_PUT_B3 Q6V64_PUT_B3
1284#define Q6V_PUT_B4 Q6V64_PUT_B4
1285#define Q6V_PUT_B5 Q6V64_PUT_B5
1286#define Q6V_PUT_B6 Q6V64_PUT_B6
1287#define Q6V_PUT_B7 Q6V64_PUT_B7
1288#define Q6V_CREATE_D Q6V64_CREATE_D
1289#define Q6V_CREATE_W Q6V64_CREATE_W
1290#define Q6V_CREATE_H Q6V64_CREATE_H
1291#define Q6V_CREATE_B Q6V64_CREATE_B
1292
1293#ifdef __cplusplus
1294#define Q6VectC Q6Vect64C
1295#endif /* __cplusplus */
1296
1297/* 64 Bit Vectors */
1298
1299typedef long long __attribute__((__may_alias__)) Q6Vect64;
1300
1301/* Extract doubleword macros */
1302
1303#define Q6V64_GET_D(v) (v)
1304#define Q6V64_GET_UD(v) ((unsigned long long)(v))
1305
1306/* Extract word macros */
1307
1308#define Q6V64_GET_W0(v) \
1309 __extension__({ \
1310 union { \
1311 long long d; \
1312 int w[2]; \
1313 } _Q6V64_internal_union; \
1314 _Q6V64_internal_union.d = (v); \
1315 _Q6V64_internal_union.w[0]; \
1316 })
1317#define Q6V64_GET_W1(v) \
1318 __extension__({ \
1319 union { \
1320 long long d; \
1321 int w[2]; \
1322 } _Q6V64_internal_union; \
1323 _Q6V64_internal_union.d = (v); \
1324 _Q6V64_internal_union.w[1]; \
1325 })
1326#define Q6V64_GET_UW0(v) \
1327 __extension__({ \
1328 union { \
1329 long long d; \
1330 unsigned int uw[2]; \
1331 } _Q6V64_internal_union; \
1332 _Q6V64_internal_union.d = (v); \
1333 _Q6V64_internal_union.uw[0]; \
1334 })
1335#define Q6V64_GET_UW1(v) \
1336 __extension__({ \
1337 union { \
1338 long long d; \
1339 unsigned int uw[2]; \
1340 } _Q6V64_internal_union; \
1341 _Q6V64_internal_union.d = (v); \
1342 _Q6V64_internal_union.uw[1]; \
1343 })
1344
1345/* Extract half word macros */
1346
1347#define Q6V64_GET_H0(v) \
1348 __extension__({ \
1349 union { \
1350 long long d; \
1351 short h[4]; \
1352 } _Q6V64_internal_union; \
1353 _Q6V64_internal_union.d = (v); \
1354 _Q6V64_internal_union.h[0]; \
1355 })
1356#define Q6V64_GET_H1(v) \
1357 __extension__({ \
1358 union { \
1359 long long d; \
1360 short h[4]; \
1361 } _Q6V64_internal_union; \
1362 _Q6V64_internal_union.d = (v); \
1363 _Q6V64_internal_union.h[1]; \
1364 })
1365#define Q6V64_GET_H2(v) \
1366 __extension__({ \
1367 union { \
1368 long long d; \
1369 short h[4]; \
1370 } _Q6V64_internal_union; \
1371 _Q6V64_internal_union.d = (v); \
1372 _Q6V64_internal_union.h[2]; \
1373 })
1374#define Q6V64_GET_H3(v) \
1375 __extension__({ \
1376 union { \
1377 long long d; \
1378 short h[4]; \
1379 } _Q6V64_internal_union; \
1380 _Q6V64_internal_union.d = (v); \
1381 _Q6V64_internal_union.h[3]; \
1382 })
1383#define Q6V64_GET_UH0(v) \
1384 __extension__({ \
1385 union { \
1386 long long d; \
1387 unsigned short uh[4]; \
1388 } _Q6V64_internal_union; \
1389 _Q6V64_internal_union.d = (v); \
1390 _Q6V64_internal_union.uh[0]; \
1391 })
1392#define Q6V64_GET_UH1(v) \
1393 __extension__({ \
1394 union { \
1395 long long d; \
1396 unsigned short uh[4]; \
1397 } _Q6V64_internal_union; \
1398 _Q6V64_internal_union.d = (v); \
1399 _Q6V64_internal_union.uh[1]; \
1400 })
1401#define Q6V64_GET_UH2(v) \
1402 __extension__({ \
1403 union { \
1404 long long d; \
1405 unsigned short uh[4]; \
1406 } _Q6V64_internal_union; \
1407 _Q6V64_internal_union.d = (v); \
1408 _Q6V64_internal_union.uh[2]; \
1409 })
1410#define Q6V64_GET_UH3(v) \
1411 __extension__({ \
1412 union { \
1413 long long d; \
1414 unsigned short uh[4]; \
1415 } _Q6V64_internal_union; \
1416 _Q6V64_internal_union.d = (v); \
1417 _Q6V64_internal_union.uh[3]; \
1418 })
1419
1420/* Extract byte macros */
1421
1422#define Q6V64_GET_B0(v) \
1423 __extension__({ \
1424 union { \
1425 long long d; \
1426 signed char b[8]; \
1427 } _Q6V64_internal_union; \
1428 _Q6V64_internal_union.d = (v); \
1429 _Q6V64_internal_union.b[0]; \
1430 })
1431#define Q6V64_GET_B1(v) \
1432 __extension__({ \
1433 union { \
1434 long long d; \
1435 signed char b[8]; \
1436 } _Q6V64_internal_union; \
1437 _Q6V64_internal_union.d = (v); \
1438 _Q6V64_internal_union.b[1]; \
1439 })
1440#define Q6V64_GET_B2(v) \
1441 __extension__({ \
1442 union { \
1443 long long d; \
1444 signed char b[8]; \
1445 } _Q6V64_internal_union; \
1446 _Q6V64_internal_union.d = (v); \
1447 _Q6V64_internal_union.b[2]; \
1448 })
1449#define Q6V64_GET_B3(v) \
1450 __extension__({ \
1451 union { \
1452 long long d; \
1453 signed char b[8]; \
1454 } _Q6V64_internal_union; \
1455 _Q6V64_internal_union.d = (v); \
1456 _Q6V64_internal_union.b[3]; \
1457 })
1458#define Q6V64_GET_B4(v) \
1459 __extension__({ \
1460 union { \
1461 long long d; \
1462 signed char b[8]; \
1463 } _Q6V64_internal_union; \
1464 _Q6V64_internal_union.d = (v); \
1465 _Q6V64_internal_union.b[4]; \
1466 })
1467#define Q6V64_GET_B5(v) \
1468 __extension__({ \
1469 union { \
1470 long long d; \
1471 signed char b[8]; \
1472 } _Q6V64_internal_union; \
1473 _Q6V64_internal_union.d = (v); \
1474 _Q6V64_internal_union.b[5]; \
1475 })
1476#define Q6V64_GET_B6(v) \
1477 __extension__({ \
1478 union { \
1479 long long d; \
1480 signed char b[8]; \
1481 } _Q6V64_internal_union; \
1482 _Q6V64_internal_union.d = (v); \
1483 _Q6V64_internal_union.b[6]; \
1484 })
1485#define Q6V64_GET_B7(v) \
1486 __extension__({ \
1487 union { \
1488 long long d; \
1489 signed char b[8]; \
1490 } _Q6V64_internal_union; \
1491 _Q6V64_internal_union.d = (v); \
1492 _Q6V64_internal_union.b[7]; \
1493 })
1494#define Q6V64_GET_UB0(v) \
1495 __extension__({ \
1496 union { \
1497 long long d; \
1498 unsigned char ub[8]; \
1499 } _Q6V64_internal_union; \
1500 _Q6V64_internal_union.d = (v); \
1501 _Q6V64_internal_union.ub[0]; \
1502 })
1503#define Q6V64_GET_UB1(v) \
1504 __extension__({ \
1505 union { \
1506 long long d; \
1507 unsigned char ub[8]; \
1508 } _Q6V64_internal_union; \
1509 _Q6V64_internal_union.d = (v); \
1510 _Q6V64_internal_union.ub[1]; \
1511 })
1512#define Q6V64_GET_UB2(v) \
1513 __extension__({ \
1514 union { \
1515 long long d; \
1516 unsigned char ub[8]; \
1517 } _Q6V64_internal_union; \
1518 _Q6V64_internal_union.d = (v); \
1519 _Q6V64_internal_union.ub[2]; \
1520 })
1521#define Q6V64_GET_UB3(v) \
1522 __extension__({ \
1523 union { \
1524 long long d; \
1525 unsigned char ub[8]; \
1526 } _Q6V64_internal_union; \
1527 _Q6V64_internal_union.d = (v); \
1528 _Q6V64_internal_union.ub[3]; \
1529 })
1530#define Q6V64_GET_UB4(v) \
1531 __extension__({ \
1532 union { \
1533 long long d; \
1534 unsigned char ub[8]; \
1535 } _Q6V64_internal_union; \
1536 _Q6V64_internal_union.d = (v); \
1537 _Q6V64_internal_union.ub[4]; \
1538 })
1539#define Q6V64_GET_UB5(v) \
1540 __extension__({ \
1541 union { \
1542 long long d; \
1543 unsigned char ub[8]; \
1544 } _Q6V64_internal_union; \
1545 _Q6V64_internal_union.d = (v); \
1546 _Q6V64_internal_union.ub[5]; \
1547 })
1548#define Q6V64_GET_UB6(v) \
1549 __extension__({ \
1550 union { \
1551 long long d; \
1552 unsigned char ub[8]; \
1553 } _Q6V64_internal_union; \
1554 _Q6V64_internal_union.d = (v); \
1555 _Q6V64_internal_union.ub[6]; \
1556 })
1557#define Q6V64_GET_UB7(v) \
1558 __extension__({ \
1559 union { \
1560 long long d; \
1561 unsigned char ub[8]; \
1562 } _Q6V64_internal_union; \
1563 _Q6V64_internal_union.d = (v); \
1564 _Q6V64_internal_union.ub[7]; \
1565 })
1566
1567/* NOTE: All set macros return a Q6Vect64 type */
1568
1569/* Set doubleword macro */
1570
1571#define Q6V64_PUT_D(v, new) (new)
1572
1573/* Set word macros */
1574
1575#ifdef __qdsp6__
1576
1577#define Q6V64_PUT_W0(v, new) \
1578 __extension__({ \
1579 union { \
1580 long long d; \
1581 int w[2]; \
1582 } _Q6V64_internal_union; \
1583 _Q6V64_internal_union.d = (v); \
1584 _Q6V64_internal_union.w[0] = (new); \
1585 _Q6V64_internal_union.d; \
1586 })
1587#define Q6V64_PUT_W1(v, new) \
1588 __extension__({ \
1589 union { \
1590 long long d; \
1591 int w[2]; \
1592 } _Q6V64_internal_union; \
1593 _Q6V64_internal_union.d = (v); \
1594 _Q6V64_internal_union.w[1] = (new); \
1595 _Q6V64_internal_union.d; \
1596 })
1597
1598#else /* !__qdsp6__ */
1599
1600#define Q6V64_PUT_W0(v, new) \
1601 (((v) & 0xffffffff00000000LL) | ((Q6Vect64)((unsigned int)(new))))
1602#define Q6V64_PUT_W1(v, new) \
1603 (((v) & 0x00000000ffffffffLL) | (((Q6Vect64)(new)) << 32LL))
1604
1605#endif /* !__qdsp6__ */
1606
1607/* Set half word macros */
1608
1609#ifdef __qdsp6__
1610
1611#define Q6V64_PUT_H0(v, new) \
1612 __extension__({ \
1613 union { \
1614 long long d; \
1615 short h[4]; \
1616 } _Q6V64_internal_union; \
1617 _Q6V64_internal_union.d = (v); \
1618 _Q6V64_internal_union.h[0] = (new); \
1619 _Q6V64_internal_union.d; \
1620 })
1621#define Q6V64_PUT_H1(v, new) \
1622 __extension__({ \
1623 union { \
1624 long long d; \
1625 short h[4]; \
1626 } _Q6V64_internal_union; \
1627 _Q6V64_internal_union.d = (v); \
1628 _Q6V64_internal_union.h[1] = (new); \
1629 _Q6V64_internal_union.d; \
1630 })
1631#define Q6V64_PUT_H2(v, new) \
1632 __extension__({ \
1633 union { \
1634 long long d; \
1635 short h[4]; \
1636 } _Q6V64_internal_union; \
1637 _Q6V64_internal_union.d = (v); \
1638 _Q6V64_internal_union.h[2] = (new); \
1639 _Q6V64_internal_union.d; \
1640 })
1641#define Q6V64_PUT_H3(v, new) \
1642 __extension__({ \
1643 union { \
1644 long long d; \
1645 short h[4]; \
1646 } _Q6V64_internal_union; \
1647 _Q6V64_internal_union.d = (v); \
1648 _Q6V64_internal_union.h[3] = (new); \
1649 _Q6V64_internal_union.d; \
1650 })
1651
1652#else /* !__qdsp6__ */
1653
1654#define Q6V64_PUT_H0(v, new) \
1655 (((v) & 0xffffffffffff0000LL) | ((Q6Vect64)((unsigned short)(new))))
1656#define Q6V64_PUT_H1(v, new) \
1657 (((v) & 0xffffffff0000ffffLL) | (((Q6Vect64)((unsigned short)(new))) << 16LL))
1658#define Q6V64_PUT_H2(v, new) \
1659 (((v) & 0xffff0000ffffffffLL) | (((Q6Vect64)((unsigned short)(new))) << 32LL))
1660#define Q6V64_PUT_H3(v, new) \
1661 (((v) & 0x0000ffffffffffffLL) | (((Q6Vect64)(new)) << 48LL))
1662
1663#endif /* !__qdsp6__ */
1664
1665/* Set byte macros */
1666
1667#ifdef __qdsp6__
1668
1669#define Q6V64_PUT_B0(v, new) \
1670 __extension__({ \
1671 union { \
1672 long long d; \
1673 char b[8]; \
1674 } _Q6V64_internal_union; \
1675 _Q6V64_internal_union.d = (v); \
1676 _Q6V64_internal_union.b[0] = (new); \
1677 _Q6V64_internal_union.d; \
1678 })
1679#define Q6V64_PUT_B1(v, new) \
1680 __extension__({ \
1681 union { \
1682 long long d; \
1683 char b[8]; \
1684 } _Q6V64_internal_union; \
1685 _Q6V64_internal_union.d = (v); \
1686 _Q6V64_internal_union.b[1] = (new); \
1687 _Q6V64_internal_union.d; \
1688 })
1689#define Q6V64_PUT_B2(v, new) \
1690 __extension__({ \
1691 union { \
1692 long long d; \
1693 char b[8]; \
1694 } _Q6V64_internal_union; \
1695 _Q6V64_internal_union.d = (v); \
1696 _Q6V64_internal_union.b[2] = (new); \
1697 _Q6V64_internal_union.d; \
1698 })
1699#define Q6V64_PUT_B3(v, new) \
1700 __extension__({ \
1701 union { \
1702 long long d; \
1703 char b[8]; \
1704 } _Q6V64_internal_union; \
1705 _Q6V64_internal_union.d = (v); \
1706 _Q6V64_internal_union.b[3] = (new); \
1707 _Q6V64_internal_union.d; \
1708 })
1709#define Q6V64_PUT_B4(v, new) \
1710 __extension__({ \
1711 union { \
1712 long long d; \
1713 char b[8]; \
1714 } _Q6V64_internal_union; \
1715 _Q6V64_internal_union.d = (v); \
1716 _Q6V64_internal_union.b[4] = (new); \
1717 _Q6V64_internal_union.d; \
1718 })
1719#define Q6V64_PUT_B5(v, new) \
1720 __extension__({ \
1721 union { \
1722 long long d; \
1723 char b[8]; \
1724 } _Q6V64_internal_union; \
1725 _Q6V64_internal_union.d = (v); \
1726 _Q6V64_internal_union.b[5] = (new); \
1727 _Q6V64_internal_union.d; \
1728 })
1729#define Q6V64_PUT_B6(v, new) \
1730 __extension__({ \
1731 union { \
1732 long long d; \
1733 char b[8]; \
1734 } _Q6V64_internal_union; \
1735 _Q6V64_internal_union.d = (v); \
1736 _Q6V64_internal_union.b[6] = (new); \
1737 _Q6V64_internal_union.d; \
1738 })
1739#define Q6V64_PUT_B7(v, new) \
1740 __extension__({ \
1741 union { \
1742 long long d; \
1743 char b[8]; \
1744 } _Q6V64_internal_union; \
1745 _Q6V64_internal_union.d = (v); \
1746 _Q6V64_internal_union.b[7] = (new); \
1747 _Q6V64_internal_union.d; \
1748 })
1749
1750#else /* !__qdsp6__ */
1751
1752#define Q6V64_PUT_B0(v, new) \
1753 (((v) & 0xffffffffffffff00LL) | ((Q6Vect64)((unsigned char)(new))))
1754#define Q6V64_PUT_B1(v, new) \
1755 (((v) & 0xffffffffffff00ffLL) | (((Q6Vect64)((unsigned char)(new))) << 8LL))
1756#define Q6V64_PUT_B2(v, new) \
1757 (((v) & 0xffffffffff00ffffLL) | (((Q6Vect64)((unsigned char)(new))) << 16LL))
1758#define Q6V64_PUT_B3(v, new) \
1759 (((v) & 0xffffffff00ffffffLL) | (((Q6Vect64)((unsigned char)(new))) << 24LL))
1760#define Q6V64_PUT_B4(v, new) \
1761 (((v) & 0xffffff00ffffffffLL) | (((Q6Vect64)((unsigned char)(new))) << 32LL))
1762#define Q6V64_PUT_B5(v, new) \
1763 (((v) & 0xffff00ffffffffffLL) | (((Q6Vect64)((unsigned char)(new))) << 40LL))
1764#define Q6V64_PUT_B6(v, new) \
1765 (((v) & 0xff00ffffffffffffLL) | (((Q6Vect64)((unsigned char)(new))) << 48LL))
1766#define Q6V64_PUT_B7(v, new) \
1767 (((v) & 0x00ffffffffffffffLL) | (((Q6Vect64)(new)) << 56LL))
1768
1769#endif /* !__qdsp6__ */
1770
1771/* NOTE: All create macros return a Q6Vect64 type */
1772
1773/* Create from a doubleword */
1774
1775#define Q6V64_CREATE_D(d) (d)
1776
1777/* Create from words */
1778
1779#ifdef __qdsp6__
1780
1781#define Q6V64_CREATE_W(w1, w0) \
1782 __extension__({ \
1783 union { \
1784 long long d; \
1785 int w[2]; \
1786 } _Q6V64_internal_union; \
1787 _Q6V64_internal_union.w[0] = (w0); \
1788 _Q6V64_internal_union.w[1] = (w1); \
1789 _Q6V64_internal_union.d; \
1790 })
1791
1792#else /* !__qdsp6__ */
1793
1794#define Q6V64_CREATE_W(w1, w0) \
1795 ((((Q6Vect64)(w1)) << 32LL) | ((Q6Vect64)((w0) & 0xffffffff)))
1796
1797#endif /* !__qdsp6__ */
1798
1799/* Create from half words */
1800
1801#ifdef __qdsp6__
1802
1803#define Q6V64_CREATE_H(h3, h2, h1, h0) \
1804 __extension__({ \
1805 union { \
1806 long long d; \
1807 short h[4]; \
1808 } _Q6V64_internal_union; \
1809 _Q6V64_internal_union.h[0] = (h0); \
1810 _Q6V64_internal_union.h[1] = (h1); \
1811 _Q6V64_internal_union.h[2] = (h2); \
1812 _Q6V64_internal_union.h[3] = (h3); \
1813 _Q6V64_internal_union.d; \
1814 })
1815
1816#else /* !__qdsp6__ */
1817
1818#define Q6V64_CREATE_H(h3, h2, h1, h0) \
1819 ((((Q6Vect64)(h3)) << 48LL) | (((Q6Vect64)((h2) & 0xffff)) << 32LL) | \
1820 (((Q6Vect64)((h1) & 0xffff)) << 16LL) | ((Q6Vect64)((h0) & 0xffff)))
1821
1822#endif /* !__qdsp6__ */
1823
1824/* Create from bytes */
1825
1826#ifdef __qdsp6__
1827
1828#define Q6V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0) \
1829 __extension__({ \
1830 union { \
1831 long long d; \
1832 char b[8]; \
1833 } _Q6V64_internal_union; \
1834 _Q6V64_internal_union.b[0] = (b0); \
1835 _Q6V64_internal_union.b[1] = (b1); \
1836 _Q6V64_internal_union.b[2] = (b2); \
1837 _Q6V64_internal_union.b[3] = (b3); \
1838 _Q6V64_internal_union.b[4] = (b4); \
1839 _Q6V64_internal_union.b[5] = (b5); \
1840 _Q6V64_internal_union.b[6] = (b6); \
1841 _Q6V64_internal_union.b[7] = (b7); \
1842 _Q6V64_internal_union.d; \
1843 })
1844
1845#else /* !__qdsp6__ */
1846
1847#define Q6V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0) \
1848 ((((Q6Vect64)(b7)) << 56LL) | (((Q6Vect64)((b6) & 0xff)) << 48LL) | \
1849 (((Q6Vect64)((b5) & 0xff)) << 40LL) | (((Q6Vect64)((b4) & 0xff)) << 32LL) | \
1850 (((Q6Vect64)((b3) & 0xff)) << 24LL) | (((Q6Vect64)((b2) & 0xff)) << 16LL) | \
1851 (((Q6Vect64)((b1) & 0xff)) << 8LL) | ((Q6Vect64)((b0) & 0xff)))
1852
1853#endif /* !__qdsp6__ */
1854
1855#ifdef __cplusplus
1856
1857class Q6Vect64C {
1858public:
1859 // Constructors
1860 Q6Vect64C(long long d = 0) : data(d) {};
1861 Q6Vect64C(int w1, int w0) : data(Q6V64_CREATE_W(w1, w0)) {};
1862 Q6Vect64C(short h3, short h2, short h1, short h0)
1863 : data(Q6V64_CREATE_H(h3, h2, h1, h0)) {};
1864 Q6Vect64C(signed char b7, signed char b6, signed char b5, signed char b4,
1865 signed char b3, signed char b2, signed char b1, signed char b0)
1866 : data(Q6V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0)) {};
1867 Q6Vect64C(const Q6Vect64C &v) : data(v.data) {};
1868
1869 Q6Vect64C &operator=(const Q6Vect64C &v) {
1870 data = v.data;
1871 return *this;
1872 };
1873
1874 operator long long() {
1875 return data;
1876 };
1877
1878 // Extract doubleword methods
1879 long long D(void) {
1880 return Q6V64_GET_D(data);
1881 };
1882 unsigned long long UD(void) {
1883 return Q6V64_GET_UD(data);
1884 };
1885
1886 // Extract word methods
1887 int W0(void) {
1888 return Q6V64_GET_W0(data);
1889 };
1890 int W1(void) {
1891 return Q6V64_GET_W1(data);
1892 };
1893 unsigned int UW0(void) {
1894 return Q6V64_GET_UW0(data);
1895 };
1896 unsigned int UW1(void) {
1897 return Q6V64_GET_UW1(data);
1898 };
1899
1900 // Extract half word methods
1901 short H0(void) {
1902 return Q6V64_GET_H0(data);
1903 };
1904 short H1(void) {
1905 return Q6V64_GET_H1(data);
1906 };
1907 short H2(void) {
1908 return Q6V64_GET_H2(data);
1909 };
1910 short H3(void) {
1911 return Q6V64_GET_H3(data);
1912 };
1913 unsigned short UH0(void) {
1914 return Q6V64_GET_UH0(data);
1915 };
1916 unsigned short UH1(void) {
1917 return Q6V64_GET_UH1(data);
1918 };
1919 unsigned short UH2(void) {
1920 return Q6V64_GET_UH2(data);
1921 };
1922 unsigned short UH3(void) {
1923 return Q6V64_GET_UH3(data);
1924 };
1925
1926 // Extract byte methods
1927 signed char B0(void) {
1928 return Q6V64_GET_B0(data);
1929 };
1930 signed char B1(void) {
1931 return Q6V64_GET_B1(data);
1932 };
1933 signed char B2(void) {
1934 return Q6V64_GET_B2(data);
1935 };
1936 signed char B3(void) {
1937 return Q6V64_GET_B3(data);
1938 };
1939 signed char B4(void) {
1940 return Q6V64_GET_B4(data);
1941 };
1942 signed char B5(void) {
1943 return Q6V64_GET_B5(data);
1944 };
1945 signed char B6(void) {
1946 return Q6V64_GET_B6(data);
1947 };
1948 signed char B7(void) {
1949 return Q6V64_GET_B7(data);
1950 };
1951 unsigned char UB0(void) {
1952 return Q6V64_GET_UB0(data);
1953 };
1954 unsigned char UB1(void) {
1955 return Q6V64_GET_UB1(data);
1956 };
1957 unsigned char UB2(void) {
1958 return Q6V64_GET_UB2(data);
1959 };
1960 unsigned char UB3(void) {
1961 return Q6V64_GET_UB3(data);
1962 };
1963 unsigned char UB4(void) {
1964 return Q6V64_GET_UB4(data);
1965 };
1966 unsigned char UB5(void) {
1967 return Q6V64_GET_UB5(data);
1968 };
1969 unsigned char UB6(void) {
1970 return Q6V64_GET_UB6(data);
1971 };
1972 unsigned char UB7(void) {
1973 return Q6V64_GET_UB7(data);
1974 };
1975
1976 // NOTE: All set methods return a Q6Vect64C type
1977
1978 // Set doubleword method
1979 Q6Vect64C D(long long d) {
1980 return Q6Vect64C(Q6V64_PUT_D(data, d));
1981 };
1982
1983 // Set word methods
1984 Q6Vect64C W0(int w) {
1985 return Q6Vect64C(Q6V64_PUT_W0(data, w));
1986 };
1987 Q6Vect64C W1(int w) {
1988 return Q6Vect64C(Q6V64_PUT_W1(data, w));
1989 };
1990
1991 // Set half word methods
1992 Q6Vect64C H0(short h) {
1993 return Q6Vect64C(Q6V64_PUT_H0(data, h));
1994 };
1995 Q6Vect64C H1(short h) {
1996 return Q6Vect64C(Q6V64_PUT_H1(data, h));
1997 };
1998 Q6Vect64C H2(short h) {
1999 return Q6Vect64C(Q6V64_PUT_H2(data, h));
2000 };
2001 Q6Vect64C H3(short h) {
2002 return Q6Vect64C(Q6V64_PUT_H3(data, h));
2003 };
2004
2005 // Set byte methods
2006 Q6Vect64C B0(signed char b) {
2007 return Q6Vect64C(Q6V64_PUT_B0(data, b));
2008 };
2009 Q6Vect64C B1(signed char b) {
2010 return Q6Vect64C(Q6V64_PUT_B1(data, b));
2011 };
2012 Q6Vect64C B2(signed char b) {
2013 return Q6Vect64C(Q6V64_PUT_B2(data, b));
2014 };
2015 Q6Vect64C B3(signed char b) {
2016 return Q6Vect64C(Q6V64_PUT_B3(data, b));
2017 };
2018 Q6Vect64C B4(signed char b) {
2019 return Q6Vect64C(Q6V64_PUT_B4(data, b));
2020 };
2021 Q6Vect64C B5(signed char b) {
2022 return Q6Vect64C(Q6V64_PUT_B5(data, b));
2023 };
2024 Q6Vect64C B6(signed char b) {
2025 return Q6Vect64C(Q6V64_PUT_B6(data, b));
2026 };
2027 Q6Vect64C B7(signed char b) {
2028 return Q6Vect64C(Q6V64_PUT_B7(data, b));
2029 };
2030
2031private:
2032 long long data;
2033};
2034
2035#endif /* __cplusplus */
2036
2037/* 32 Bit Vectors */
2038
2039typedef int Q6Vect32;
2040
2041/* Extract word macros */
2042
2043#define Q6V32_GET_W(v) (v)
2044#define Q6V32_GET_UW(v) ((unsigned int)(v))
2045
2046/* Extract half word macros */
2047
2048#define Q6V32_GET_H0(v) \
2049 __extension__({ \
2050 union { \
2051 int w; \
2052 short h[2]; \
2053 } _Q6V32_internal_union; \
2054 _Q6V32_internal_union.w = (v); \
2055 _Q6V32_internal_union.h[0]; \
2056 })
2057#define Q6V32_GET_H1(v) \
2058 __extension__({ \
2059 union { \
2060 int w; \
2061 short h[2]; \
2062 } _Q6V32_internal_union; \
2063 _Q6V32_internal_union.w = (v); \
2064 _Q6V32_internal_union.h[1]; \
2065 })
2066#define Q6V32_GET_UH0(v) \
2067 __extension__({ \
2068 union { \
2069 int w; \
2070 unsigned short uh[2]; \
2071 } _Q6V32_internal_union; \
2072 _Q6V32_internal_union.w = (v); \
2073 _Q6V32_internal_union.uh[0]; \
2074 })
2075#define Q6V32_GET_UH1(v) \
2076 __extension__({ \
2077 union { \
2078 int w; \
2079 unsigned short uh[2]; \
2080 } _Q6V32_internal_union; \
2081 _Q6V32_internal_union.w = (v); \
2082 _Q6V32_internal_union.uh[1]; \
2083 })
2084
2085/* Extract byte macros */
2086
2087#define Q6V32_GET_B0(v) \
2088 __extension__({ \
2089 union { \
2090 int w; \
2091 signed char b[4]; \
2092 } _Q6V32_internal_union; \
2093 _Q6V32_internal_union.w = (v); \
2094 _Q6V32_internal_union.b[0]; \
2095 })
2096#define Q6V32_GET_B1(v) \
2097 __extension__({ \
2098 union { \
2099 int w; \
2100 signed char b[4]; \
2101 } _Q6V32_internal_union; \
2102 _Q6V32_internal_union.w = (v); \
2103 _Q6V32_internal_union.b[1]; \
2104 })
2105#define Q6V32_GET_B2(v) \
2106 __extension__({ \
2107 union { \
2108 int w; \
2109 signed char b[4]; \
2110 } _Q6V32_internal_union; \
2111 _Q6V32_internal_union.w = (v); \
2112 _Q6V32_internal_union.b[2]; \
2113 })
2114#define Q6V32_GET_B3(v) \
2115 __extension__({ \
2116 union { \
2117 int w; \
2118 signed char b[4]; \
2119 } _Q6V32_internal_union; \
2120 _Q6V32_internal_union.w = (v); \
2121 _Q6V32_internal_union.b[3]; \
2122 })
2123#define Q6V32_GET_UB0(v) \
2124 __extension__({ \
2125 union { \
2126 int w; \
2127 unsigned char ub[4]; \
2128 } _Q6V32_internal_union; \
2129 _Q6V32_internal_union.w = (v); \
2130 _Q6V32_internal_union.ub[0]; \
2131 })
2132#define Q6V32_GET_UB1(v) \
2133 __extension__({ \
2134 union { \
2135 int w; \
2136 unsigned char ub[4]; \
2137 } _Q6V32_internal_union; \
2138 _Q6V32_internal_union.w = (v); \
2139 _Q6V32_internal_union.ub[1]; \
2140 })
2141#define Q6V32_GET_UB2(v) \
2142 __extension__({ \
2143 union { \
2144 int w; \
2145 unsigned char ub[4]; \
2146 } _Q6V32_internal_union; \
2147 _Q6V32_internal_union.w = (v); \
2148 _Q6V32_internal_union.ub[2]; \
2149 })
2150#define Q6V32_GET_UB3(v) \
2151 __extension__({ \
2152 union { \
2153 int w; \
2154 unsigned char ub[4]; \
2155 } _Q6V32_internal_union; \
2156 _Q6V32_internal_union.w = (v); \
2157 _Q6V32_internal_union.ub[3]; \
2158 })
2159
2160/* NOTE: All set macros return a Q6Vect32 type */
2161
2162/* Set word macro */
2163
2164#define Q6V32_PUT_W(v, new) (new)
2165
2166/* Set half word macros */
2167
2168#ifdef __qdsp6__
2169
2170#define Q6V32_PUT_H0(v, new) \
2171 __extension__({ \
2172 union { \
2173 int w; \
2174 short h[2]; \
2175 } _Q6V32_internal_union; \
2176 _Q6V32_internal_union.w = (v); \
2177 _Q6V32_internal_union.h[0] = (new); \
2178 _Q6V32_internal_union.w; \
2179 })
2180#define Q6V32_PUT_H1(v, new) \
2181 __extension__({ \
2182 union { \
2183 int w; \
2184 short h[2]; \
2185 } _Q6V32_internal_union; \
2186 _Q6V32_internal_union.w = (v); \
2187 _Q6V32_internal_union.h[1] = (new); \
2188 _Q6V32_internal_union.w; \
2189 })
2190
2191#else /* !__qdsp6__ */
2192
2193#define Q6V32_PUT_H0(v, new) \
2194 (((v) & 0xffff0000) | ((Q6Vect32)((unsigned short)(new))))
2195#define Q6V32_PUT_H1(v, new) (((v) & 0x0000ffff) | (((Q6Vect32)(new)) << 16))
2196
2197#endif /* !__qdsp6__ */
2198
2199/* Set byte macros */
2200
2201#ifdef __qdsp6__
2202
2203#define Q6V32_PUT_B0(v, new) \
2204 __extension__({ \
2205 union { \
2206 int w; \
2207 char b[4]; \
2208 } _Q6V32_internal_union; \
2209 _Q6V32_internal_union.w = (v); \
2210 _Q6V32_internal_union.b[0] = (new); \
2211 _Q6V32_internal_union.w; \
2212 })
2213#define Q6V32_PUT_B1(v, new) \
2214 __extension__({ \
2215 union { \
2216 int w; \
2217 char b[4]; \
2218 } _Q6V32_internal_union; \
2219 _Q6V32_internal_union.w = (v); \
2220 _Q6V32_internal_union.b[1] = (new); \
2221 _Q6V32_internal_union.w; \
2222 })
2223#define Q6V32_PUT_B2(v, new) \
2224 __extension__({ \
2225 union { \
2226 int w; \
2227 char b[4]; \
2228 } _Q6V32_internal_union; \
2229 _Q6V32_internal_union.w = (v); \
2230 _Q6V32_internal_union.b[2] = (new); \
2231 _Q6V32_internal_union.w; \
2232 })
2233#define Q6V32_PUT_B3(v, new) \
2234 __extension__({ \
2235 union { \
2236 int w; \
2237 char b[4]; \
2238 } _Q6V32_internal_union; \
2239 _Q6V32_internal_union.w = (v); \
2240 _Q6V32_internal_union.b[3] = (new); \
2241 _Q6V32_internal_union.w; \
2242 })
2243
2244#else /* !__qdsp6__ */
2245
2246#define Q6V32_PUT_B0(v, new) \
2247 (((v) & 0xffffff00) | ((Q6Vect32)((unsigned char)(new))))
2248#define Q6V32_PUT_B1(v, new) \
2249 (((v) & 0xffff00ff) | (((Q6Vect32)((unsigned char)(new))) << 8))
2250#define Q6V32_PUT_B2(v, new) \
2251 (((v) & 0xff00ffff) | (((Q6Vect32)((unsigned char)(new))) << 16))
2252#define Q6V32_PUT_B3(v, new) (((v) & 0x00ffffff) | (((Q6Vect32)(new)) << 24))
2253
2254#endif /* !__qdsp6__ */
2255
2256/* NOTE: All create macros return a Q6Vect32 type */
2257
2258/* Create from a word */
2259
2260#define Q6V32_CREATE_W(w) (w)
2261
2262/* Create from half words */
2263
2264#ifdef __qdsp6__
2265
2266#define Q6V32_CREATE_H(h1, h0) \
2267 __extension__({ \
2268 union { \
2269 long long d; \
2270 short h[2]; \
2271 } _Q6V32_internal_union; \
2272 _Q6V32_internal_union.h[0] = (h0); \
2273 _Q6V32_internal_union.h[1] = (h1); \
2274 _Q6V32_internal_union.d; \
2275 })
2276
2277#else /* !__qdsp6__ */
2278
2279#define Q6V32_CREATE_H(h1, h0) \
2280 ((((Q6Vect32)(h1)) << 16) | ((Q6Vect32)((h0) & 0xffff)))
2281
2282#endif /* !__qdsp6__ */
2283
2284/* Create from bytes */
2285#ifdef __qdsp6__
2286
2287#define Q6V32_CREATE_B(b3, b2, b1, b0) \
2288 __extension__({ \
2289 union { \
2290 long long d; \
2291 char b[4]; \
2292 } _Q6V32_internal_union; \
2293 _Q6V32_internal_union.b[0] = (b0); \
2294 _Q6V32_internal_union.b[1] = (b1); \
2295 _Q6V32_internal_union.b[2] = (b2); \
2296 _Q6V32_internal_union.b[3] = (b3); \
2297 _Q6V32_internal_union.d; \
2298 })
2299
2300#else /* !__qdsp6__ */
2301
2302#define Q6V32_CREATE_B(b3, b2, b1, b0) \
2303 ((((Q6Vect32)(b3)) << 24) | (((Q6Vect32)((b2) & 0xff)) << 16) | \
2304 (((Q6Vect32)((b1) & 0xff)) << 8) | ((Q6Vect32)((b0) & 0xff)))
2305
2306#endif /* !__qdsp6__ */
2307
2308#ifdef __cplusplus
2309
2310class Q6Vect32C {
2311public:
2312 // Constructors
2313 Q6Vect32C(int w = 0) : data(w) {};
2314 Q6Vect32C(short h1, short h0) : data(Q6V32_CREATE_H(h1, h0)) {};
2315 Q6Vect32C(signed char b3, signed char b2, signed char b1, signed char b0)
2316 : data(Q6V32_CREATE_B(b3, b2, b1, b0)) {};
2317 Q6Vect32C(const Q6Vect32C &v) : data(v.data) {};
2318
2319 Q6Vect32C &operator=(const Q6Vect32C &v) {
2320 data = v.data;
2321 return *this;
2322 };
2323
2324 operator int() {
2325 return data;
2326 };
2327
2328 // Extract word methods
2329 int W(void) {
2330 return Q6V32_GET_W(data);
2331 };
2332 unsigned int UW(void) {
2333 return Q6V32_GET_UW(data);
2334 };
2335
2336 // Extract half word methods
2337 short H0(void) {
2338 return Q6V32_GET_H0(data);
2339 };
2340 short H1(void) {
2341 return Q6V32_GET_H1(data);
2342 };
2343 unsigned short UH0(void) {
2344 return Q6V32_GET_UH0(data);
2345 };
2346 unsigned short UH1(void) {
2347 return Q6V32_GET_UH1(data);
2348 };
2349
2350 // Extract byte methods
2351 signed char B0(void) {
2352 return Q6V32_GET_B0(data);
2353 };
2354 signed char B1(void) {
2355 return Q6V32_GET_B1(data);
2356 };
2357 signed char B2(void) {
2358 return Q6V32_GET_B2(data);
2359 };
2360 signed char B3(void) {
2361 return Q6V32_GET_B3(data);
2362 };
2363 unsigned char UB0(void) {
2364 return Q6V32_GET_UB0(data);
2365 };
2366 unsigned char UB1(void) {
2367 return Q6V32_GET_UB1(data);
2368 };
2369 unsigned char UB2(void) {
2370 return Q6V32_GET_UB2(data);
2371 };
2372 unsigned char UB3(void) {
2373 return Q6V32_GET_UB3(data);
2374 };
2375
2376 // NOTE: All set methods return a Q6Vect32C type
2377
2378 // Set word method
2379 Q6Vect32C W(int w) {
2380 return Q6Vect32C(Q6V32_PUT_W(data, w));
2381 };
2382
2383 // Set half word methods
2384 Q6Vect32C H0(short h) {
2385 return Q6Vect32C(Q6V32_PUT_H0(data, h));
2386 };
2387 Q6Vect32C H1(short h) {
2388 return Q6Vect32C(Q6V32_PUT_H1(data, h));
2389 };
2390
2391 // Set byte methods
2392 Q6Vect32C B0(signed char b) {
2393 return Q6Vect32C(Q6V32_PUT_B0(data, b));
2394 };
2395 Q6Vect32C B1(signed char b) {
2396 return Q6Vect32C(Q6V32_PUT_B1(data, b));
2397 };
2398 Q6Vect32C B2(signed char b) {
2399 return Q6Vect32C(Q6V32_PUT_B2(data, b));
2400 };
2401 Q6Vect32C B3(signed char b) {
2402 return Q6Vect32C(Q6V32_PUT_B3(data, b));
2403 };
2404
2405private:
2406 int data;
2407};
2408
2409#endif /* __cplusplus */
2410
2411// V65 Vector types
2412#if __HVX_ARCH__ >= 65
2413#if defined __HVX__ && (__HVX_LENGTH__ == 128)
2414typedef long Q6VecPred128 __attribute__((__vector_size__(128)))
2415 __attribute__((aligned(128)));
2416
2417typedef long Q6Vect1024 __attribute__((__vector_size__(128)))
2418 __attribute__((aligned(128)));
2419
2420typedef long Q6Vect2048 __attribute__((__vector_size__(256)))
2421 __attribute__((aligned(256)));
2422
2423#else /* defined __HVX__ && (__HVX_LENGTH__ == 128) */
2424#if defined __HVX__ && (__HVX_LENGTH__ == 64)
2425typedef long Q6VecPred64 __attribute__((__vector_size__(64)))
2426 __attribute__((aligned(64)));
2427
2428typedef long Q6Vect512 __attribute__((__vector_size__(64)))
2429 __attribute__((aligned(64)));
2430
2431typedef long Q6Vect1024 __attribute__((__vector_size__(128)))
2432 __attribute__((aligned(128)));
2433
2434#endif /* defined __HVX__ && (__HVX_LENGTH__ == 64) */
2435#endif /* defined __HVX__ && (__HVX_LENGTH__ == 128) */
2436#endif /* __HVX_ARCH__ >= 65 */
2437
2438/* Predicates */
2439
2440typedef int Q6Pred;
2441
2442
2443#ifdef __HVX__
2444
2445// Extract HVX VectorPair macro.
2446#define HEXAGON_HVX_GET_W(v) (v)
2447
2448// Extract HVX Vector macros.
2449#define HEXAGON_HVX_GET_V0(v) \
2450 __extension__({ \
2451 union { \
2452 HVX_VectorPair W; \
2453 HVX_Vector V[2]; \
2454 } _HEXAGON_HVX_internal_union; \
2455 _HEXAGON_HVX_internal_union.W = (v); \
2456 _HEXAGON_HVX_internal_union.V[0]; \
2457 })
2458#define HEXAGON_HVX_GET_V1(v) \
2459 __extension__({ \
2460 union { \
2461 HVX_VectorPair W; \
2462 HVX_Vector V[2]; \
2463 } _HEXAGON_HVX_internal_union; \
2464 _HEXAGON_HVX_internal_union.W = (v); \
2465 _HEXAGON_HVX_internal_union.V[1]; \
2466 })
2467#define HEXAGON_HVX_GET_P(v) \
2468 __extension__({ \
2469 union { \
2470 HVX_VectorPair W; \
2471 HVX_VectorPred P[2]; \
2472 } _HEXAGON_HVX_internal_union; \
2473 _HEXAGON_HVX_internal_union.W = (v); \
2474 _HEXAGON_HVX_internal_union.P[0]; \
2475 })
2476
2477// Set HVX VectorPair macro.
2478#define HEXAGON_HVX_PUT_W(v, new) (new)
2479
2480// Set HVX Vector macros.
2481#define HEXAGON_HVX_PUT_V0(v, new) \
2482 __extension__({ \
2483 union { \
2484 HVX_VectorPair W; \
2485 HVX_Vector V[2]; \
2486 } _HEXAGON_HVX_internal_union; \
2487 _HEXAGON_HVX_internal_union.W = (v); \
2488 _HEXAGON_HVX_internal_union.V[0] = (new); \
2489 _HEXAGON_HVX_internal_union.W; \
2490 })
2491
2492#define HEXAGON_HVX_PUT_V1(v, new) \
2493 __extension__({ \
2494 union { \
2495 HVX_VectorPair W; \
2496 HVX_Vector V[2]; \
2497 } _HEXAGON_HVX_internal_union; \
2498 _HEXAGON_HVX_internal_union.W = (v); \
2499 _HEXAGON_HVX_internal_union.V[1] = (new); \
2500 _HEXAGON_HVX_internal_union.W; \
2501 })
2502
2503#define HEXAGON_HVX_PUT_P(v, new) \
2504 __extension__({ \
2505 union { \
2506 HVX_VectorPair W; \
2507 HVX_VectorPred P[2]; \
2508 } _HEXAGON_HVX_internal_union; \
2509 _HEXAGON_HVX_internal_union.W = (v); \
2510 _HEXAGON_HVX_internal_union.P[0] = (new); \
2511 _HEXAGON_HVX_internal_union.W; \
2512 })
2513
2514
2515#define HEXAGON_HVX_CREATE_W(v1, v0) \
2516 __extension__({ \
2517 union { \
2518 HVX_VectorPair W; \
2519 HVX_Vector V[2]; \
2520 } _HEXAGON_HVX_internal_union; \
2521 _HEXAGON_HVX_internal_union.V[0] = (v0); \
2522 _HEXAGON_HVX_internal_union.V[1] = (v1); \
2523 _HEXAGON_HVX_internal_union.W; \
2524 })
2525
2526#ifdef __cplusplus
2527
2528class HVX_Vect {
2529public:
2530 // Constructors.
2531 // Default.
2532 HVX_Vect() : data(Q6_W_vcombine_VV(Q6_V_vzero(), Q6_V_vzero())){};
2533
2534 // Custom constructors.
2535 HVX_Vect(HVX_VectorPair W) : data(W){};
2536 HVX_Vect(HVX_Vector v1, HVX_Vector v0) : data(HEXAGON_HVX_CREATE_W(v1, v0)){};
2537
2538 // Copy constructor.
2539 HVX_Vect(const HVX_Vect &W) = default;
2540
2541 // Move constructor.
2542 HVX_Vect(HVX_Vect &&W) = default;
2543
2544 // Assignment operator.
2545 HVX_Vect &operator=(const HVX_Vect &W) = default;
2546
2547 operator HVX_VectorPair() { return data; };
2548
2549 // Extract VectorPair method.
2550 HVX_VectorPair W(void) { return HEXAGON_HVX_GET_W(data); };
2551
2552 // Extract Vector methods.
2553 HVX_Vector V0(void) { return HEXAGON_HVX_GET_V0(data); };
2554 HVX_Vector V1(void) { return HEXAGON_HVX_GET_V1(data); };
2555 HVX_VectorPred P(void) { return HEXAGON_HVX_GET_P(data); };
2556
2557 // NOTE: All set methods return a HVX_Vect type.
2558 // Set HVX VectorPair method.
2559 HVX_Vect W(HVX_VectorPair w) { return HVX_Vect(HEXAGON_HVX_PUT_W(data, w)); };
2560
2561 // Set HVX Vector methods.
2562 HVX_Vect V0(HVX_Vector v) { return HVX_Vect(HEXAGON_HVX_PUT_V0(data, v)); };
2563 HVX_Vect V1(HVX_Vector v) { return HVX_Vect(HEXAGON_HVX_PUT_V1(data, v)); };
2564 HVX_Vect P(HVX_VectorPred p) { return HVX_Vect(HEXAGON_HVX_PUT_P(data, p)); };
2565
2566private:
2567 HVX_VectorPair data;
2568};
2569
2570#endif /* __cplusplus */
2571#endif /* __HVX__ */
2572
2573#define HEXAGON_UDMA_DM0_STATUS_IDLE 0x00000000
2574#define HEXAGON_UDMA_DM0_STATUS_RUN 0x00000001
2575#define HEXAGON_UDMA_DM0_STATUS_ERROR 0x00000002
2576#define HEXAGON_UDMA_DESC_DSTATE_INCOMPLETE 0
2577#define HEXAGON_UDMA_DESC_DSTATE_COMPLETE 1
2578#define HEXAGON_UDMA_DESC_ORDER_NOORDER 0
2579#define HEXAGON_UDMA_DESC_ORDER_ORDER 1
2580#define HEXAGON_UDMA_DESC_BYPASS_OFF 0
2581#define HEXAGON_UDMA_DESC_BYPASS_ON 1
2582#define HEXAGON_UDMA_DESC_COMP_NONE 0
2583#define HEXAGON_UDMA_DESC_COMP_DLBC 1
2584#define HEXAGON_UDMA_DESC_DESCTYPE_TYPE0 0
2585#define HEXAGON_UDMA_DESC_DESCTYPE_TYPE1 1
2586
2588{
2589 void *next;
2590 unsigned int length:24;
2591 unsigned int desctype:2;
2592 unsigned int dstcomp:1;
2593 unsigned int srccomp:1;
2594 unsigned int dstbypass:1;
2595 unsigned int srcbypass:1;
2596 unsigned int order:1;
2597 unsigned int dstate:1;
2598 void *src;
2599 void *dst;
2601
2603{
2604 void *next;
2605 unsigned int length:24;
2606 unsigned int desctype:2;
2607 unsigned int dstcomp:1;
2608 unsigned int srccomp:1;
2609 unsigned int dstbypass:1;
2610 unsigned int srcbypass:1;
2611 unsigned int order:1;
2612 unsigned int dstate:1;
2613 void *src;
2614 void *dst;
2615 unsigned int allocation:28;
2616 unsigned int padding:4;
2617 unsigned int roiwidth:16;
2618 unsigned int roiheight:16;
2619 unsigned int srcstride:16;
2620 unsigned int dststride:16;
2621 unsigned int srcwidthoffset:16;
2622 unsigned int dstwidthoffset:16;
2624
2625#endif /* !HEXAGON_TYPES_H */
StringRef P
const Decl * D
__device__ __2f16 b
__device__ int
do v
Definition: arm_acle.h:91
#define HEXAGON_V64_PUT_H0(v, new)
#define HEXAGON_V32_GET_UH0(v)
#define Q6V64_GET_H1(v)
#define Q6V64_GET_UB2(v)
#define Q6V64_PUT_H0(v, new)
#define Q6V64_GET_W1(v)
#define Q6V64_PUT_W1(v, new)
#define HEXAGON_V64_GET_UB6(v)
#define HEXAGON_V32_GET_UW(v)
#define HEXAGON_V64_GET_UH3(v)
#define HEXAGON_V64_PUT_B0(v, new)
#define HEXAGON_V64_GET_B6(v)
#define Q6V64_PUT_B0(v, new)
#define Q6V32_GET_UB2(v)
#define Q6V64_GET_B6(v)
#define HEXAGON_V32_GET_B2(v)
#define HEXAGON_V32_PUT_H1(v, new)
#define HEXAGON_V32_GET_B1(v)
#define Q6V32_PUT_H1(v, new)
#define Q6V32_GET_UB0(v)
#define HEXAGON_V64_PUT_B1(v, new)
#define Q6V64_GET_UB0(v)
#define Q6V64_GET_B3(v)
#define Q6V32_GET_UH1(v)
#define HEXAGON_V32_PUT_B2(v, new)
int HEXAGON_Vect32
#define HEXAGON_V64_PUT_B7(v, new)
#define HEXAGON_V32_PUT_B3(v, new)
#define HEXAGON_V32_GET_H0(v)
#define HEXAGON_V64_GET_B0(v)
#define Q6V32_GET_B0(v)
#define Q6V64_GET_UB5(v)
#define Q6V64_GET_UB3(v)
#define Q6V32_GET_UH0(v)
#define Q6V64_GET_UH0(v)
#define Q6V64_GET_B1(v)
#define Q6V64_GET_UW1(v)
#define Q6V64_PUT_B3(v, new)
#define Q6V64_GET_UB4(v)
#define HEXAGON_V64_GET_B5(v)
#define Q6V64_GET_B2(v)
#define HEXAGON_V64_GET_UB7(v)
#define HEXAGON_V64_GET_UB5(v)
#define Q6V64_CREATE_H(h3, h2, h1, h0)
#define HEXAGON_V64_CREATE_W(w1, w0)
#define HEXAGON_V64_PUT_H2(v, new)
#define HEXAGON_V32_GET_H1(v)
#define HEXAGON_V32_GET_UB2(v)
#define HEXAGON_V32_PUT_B1(v, new)
int Q6Pred
#define HEXAGON_V64_GET_UB2(v)
#define Q6V64_GET_UB6(v)
#define Q6V32_PUT_W(v, new)
#define Q6V32_GET_UW(v)
#define Q6V32_CREATE_H(h1, h0)
#define HEXAGON_V64_GET_B3(v)
#define HEXAGON_V64_GET_B2(v)
#define HEXAGON_V64_CREATE_H(h3, h2, h1, h0)
#define HEXAGON_V64_GET_UB1(v)
#define HEXAGON_V64_PUT_D(v, new)
#define Q6V64_GET_B0(v)
#define Q6V64_PUT_H2(v, new)
#define HEXAGON_V64_GET_D(v)
Definition: hexagon_types.h:76
#define Q6V64_GET_B4(v)
#define Q6V64_CREATE_W(w1, w0)
#define Q6V32_GET_B3(v)
long long __attribute__((__may_alias__)) HEXAGON_Vect64
Definition: hexagon_types.h:72
#define Q6V64_GET_H0(v)
#define HEXAGON_V64_GET_W1(v)
Definition: hexagon_types.h:90
#define HEXAGON_V64_GET_B7(v)
#define HEXAGON_V64_GET_UW1(v)
#define HEXAGON_V64_PUT_B6(v, new)
#define Q6V64_PUT_H1(v, new)
#define Q6V64_GET_UD(v)
#define Q6V64_PUT_W0(v, new)
#define Q6V64_GET_D(v)
#define HEXAGON_V32_PUT_H0(v, new)
#define Q6V64_GET_UH2(v)
#define HEXAGON_V64_GET_B4(v)
#define HEXAGON_V32_GET_UB1(v)
#define Q6V64_GET_W0(v)
#define Q6V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0)
#define Q6V32_PUT_B1(v, new)
#define Q6V32_GET_UB3(v)
#define Q6V32_GET_W(v)
#define Q6V64_GET_UW0(v)
#define Q6V64_PUT_B2(v, new)
#define HEXAGON_V32_GET_W(v)
struct hexagon_udma_descriptor_type0_s hexagon_udma_descriptor_type0_t
#define HEXAGON_V64_PUT_B3(v, new)
#define HEXAGON_V64_PUT_B2(v, new)
#define HEXAGON_V64_GET_UH0(v)
#define HEXAGON_V64_GET_W0(v)
Definition: hexagon_types.h:81
#define Q6V64_GET_UB7(v)
#define Q6V64_GET_UH3(v)
#define Q6V64_GET_B7(v)
#define HEXAGON_V32_GET_B0(v)
#define HEXAGON_V32_PUT_W(v, new)
#define HEXAGON_V64_GET_H3(v)
#define HEXAGON_V64_GET_H2(v)
#define Q6V32_GET_UB1(v)
#define HEXAGON_V32_GET_UH1(v)
#define Q6V64_GET_UH1(v)
#define Q6V32_CREATE_B(b3, b2, b1, b0)
#define Q6V64_PUT_B1(v, new)
#define HEXAGON_V32_GET_UB3(v)
#define HEXAGON_V32_CREATE_B(b3, b2, b1, b0)
#define Q6V32_GET_H1(v)
#define HEXAGON_V64_GET_UB4(v)
#define Q6V64_GET_H2(v)
#define HEXAGON_V64_PUT_H3(v, new)
#define Q6V32_GET_B2(v)
#define Q6V32_GET_H0(v)
#define HEXAGON_V64_GET_H1(v)
#define HEXAGON_V32_GET_B3(v)
#define Q6V64_PUT_H3(v, new)
#define Q6V64_PUT_D(v, new)
#define HEXAGON_V32_GET_UB0(v)
#define Q6V32_PUT_B0(v, new)
#define Q6V64_GET_B5(v)
#define Q6V64_PUT_B4(v, new)
#define HEXAGON_V64_GET_UW0(v)
Definition: hexagon_types.h:99
#define Q6V64_GET_UB1(v)
#define HEXAGON_V64_PUT_H1(v, new)
#define Q6V64_GET_H3(v)
#define HEXAGON_V64_GET_UH2(v)
#define Q6V32_PUT_H0(v, new)
#define Q6V32_PUT_B2(v, new)
#define Q6V64_PUT_B5(v, new)
#define HEXAGON_V64_PUT_W0(v, new)
#define HEXAGON_V64_PUT_B4(v, new)
#define Q6V32_GET_B1(v)
struct hexagon_udma_descriptor_type1_s hexagon_udma_descriptor_type1_t
#define Q6V64_PUT_B7(v, new)
#define HEXAGON_V64_GET_UB0(v)
#define HEXAGON_V32_CREATE_H(h1, h0)
#define HEXAGON_V64_GET_UB3(v)
int Q6Vect32
#define HEXAGON_V64_GET_H0(v)
#define HEXAGON_V64_GET_UD(v)
Definition: hexagon_types.h:77
#define HEXAGON_V64_PUT_B5(v, new)
#define HEXAGON_V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0)
#define HEXAGON_V32_PUT_B0(v, new)
#define HEXAGON_V64_PUT_W1(v, new)
int HEXAGON_Pred
#define Q6V64_PUT_B6(v, new)
#define Q6V32_PUT_B3(v, new)
#define HEXAGON_V64_GET_UH1(v)
#define HEXAGON_V64_GET_B1(v)