1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef HEXAGON_TYPES_H
10 #define HEXAGON_TYPES_H
12 #include <hexagon_protos.h>
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
67 #define HEXAGON_VectC HEXAGON_Vect64C
68 #endif /* __cplusplus */
72 typedef long long __attribute__((__may_alias__
)) HEXAGON_Vect64
;
74 /* Extract doubleword macros */
76 #define HEXAGON_V64_GET_D(v) (v)
77 #define HEXAGON_V64_GET_UD(v) ((unsigned long long)(v))
79 /* Extract word macros */
81 #define HEXAGON_V64_GET_W0(v) \
86 } _HEXAGON_V64_internal_union; \
87 _HEXAGON_V64_internal_union.d = (v); \
88 _HEXAGON_V64_internal_union.w[0]; \
90 #define HEXAGON_V64_GET_W1(v) \
95 } _HEXAGON_V64_internal_union; \
96 _HEXAGON_V64_internal_union.d = (v); \
97 _HEXAGON_V64_internal_union.w[1]; \
99 #define HEXAGON_V64_GET_UW0(v) \
103 unsigned int uw[2]; \
104 } _HEXAGON_V64_internal_union; \
105 _HEXAGON_V64_internal_union.d = (v); \
106 _HEXAGON_V64_internal_union.uw[0]; \
108 #define HEXAGON_V64_GET_UW1(v) \
112 unsigned int uw[2]; \
113 } _HEXAGON_V64_internal_union; \
114 _HEXAGON_V64_internal_union.d = (v); \
115 _HEXAGON_V64_internal_union.uw[1]; \
118 /* Extract half word macros */
120 #define HEXAGON_V64_GET_H0(v) \
125 } _HEXAGON_V64_internal_union; \
126 _HEXAGON_V64_internal_union.d = (v); \
127 _HEXAGON_V64_internal_union.h[0]; \
129 #define HEXAGON_V64_GET_H1(v) \
134 } _HEXAGON_V64_internal_union; \
135 _HEXAGON_V64_internal_union.d = (v); \
136 _HEXAGON_V64_internal_union.h[1]; \
138 #define HEXAGON_V64_GET_H2(v) \
143 } _HEXAGON_V64_internal_union; \
144 _HEXAGON_V64_internal_union.d = (v); \
145 _HEXAGON_V64_internal_union.h[2]; \
147 #define HEXAGON_V64_GET_H3(v) \
152 } _HEXAGON_V64_internal_union; \
153 _HEXAGON_V64_internal_union.d = (v); \
154 _HEXAGON_V64_internal_union.h[3]; \
156 #define HEXAGON_V64_GET_UH0(v) \
160 unsigned short uh[4]; \
161 } _HEXAGON_V64_internal_union; \
162 _HEXAGON_V64_internal_union.d = (v); \
163 _HEXAGON_V64_internal_union.uh[0]; \
165 #define HEXAGON_V64_GET_UH1(v) \
169 unsigned short uh[4]; \
170 } _HEXAGON_V64_internal_union; \
171 _HEXAGON_V64_internal_union.d = (v); \
172 _HEXAGON_V64_internal_union.uh[1]; \
174 #define HEXAGON_V64_GET_UH2(v) \
178 unsigned short uh[4]; \
179 } _HEXAGON_V64_internal_union; \
180 _HEXAGON_V64_internal_union.d = (v); \
181 _HEXAGON_V64_internal_union.uh[2]; \
183 #define HEXAGON_V64_GET_UH3(v) \
187 unsigned short uh[4]; \
188 } _HEXAGON_V64_internal_union; \
189 _HEXAGON_V64_internal_union.d = (v); \
190 _HEXAGON_V64_internal_union.uh[3]; \
193 /* Extract byte macros */
195 #define HEXAGON_V64_GET_B0(v) \
200 } _HEXAGON_V64_internal_union; \
201 _HEXAGON_V64_internal_union.d = (v); \
202 _HEXAGON_V64_internal_union.b[0]; \
204 #define HEXAGON_V64_GET_B1(v) \
209 } _HEXAGON_V64_internal_union; \
210 _HEXAGON_V64_internal_union.d = (v); \
211 _HEXAGON_V64_internal_union.b[1]; \
213 #define HEXAGON_V64_GET_B2(v) \
218 } _HEXAGON_V64_internal_union; \
219 _HEXAGON_V64_internal_union.d = (v); \
220 _HEXAGON_V64_internal_union.b[2]; \
222 #define HEXAGON_V64_GET_B3(v) \
227 } _HEXAGON_V64_internal_union; \
228 _HEXAGON_V64_internal_union.d = (v); \
229 _HEXAGON_V64_internal_union.b[3]; \
231 #define HEXAGON_V64_GET_B4(v) \
236 } _HEXAGON_V64_internal_union; \
237 _HEXAGON_V64_internal_union.d = (v); \
238 _HEXAGON_V64_internal_union.b[4]; \
240 #define HEXAGON_V64_GET_B5(v) \
245 } _HEXAGON_V64_internal_union; \
246 _HEXAGON_V64_internal_union.d = (v); \
247 _HEXAGON_V64_internal_union.b[5]; \
249 #define HEXAGON_V64_GET_B6(v) \
254 } _HEXAGON_V64_internal_union; \
255 _HEXAGON_V64_internal_union.d = (v); \
256 _HEXAGON_V64_internal_union.b[6]; \
258 #define HEXAGON_V64_GET_B7(v) \
263 } _HEXAGON_V64_internal_union; \
264 _HEXAGON_V64_internal_union.d = (v); \
265 _HEXAGON_V64_internal_union.b[7]; \
267 #define HEXAGON_V64_GET_UB0(v) \
271 unsigned char ub[8]; \
272 } _HEXAGON_V64_internal_union; \
273 _HEXAGON_V64_internal_union.d = (v); \
274 _HEXAGON_V64_internal_union.ub[0]; \
276 #define HEXAGON_V64_GET_UB1(v) \
280 unsigned char ub[8]; \
281 } _HEXAGON_V64_internal_union; \
282 _HEXAGON_V64_internal_union.d = (v); \
283 _HEXAGON_V64_internal_union.ub[1]; \
285 #define HEXAGON_V64_GET_UB2(v) \
289 unsigned char ub[8]; \
290 } _HEXAGON_V64_internal_union; \
291 _HEXAGON_V64_internal_union.d = (v); \
292 _HEXAGON_V64_internal_union.ub[2]; \
294 #define HEXAGON_V64_GET_UB3(v) \
298 unsigned char ub[8]; \
299 } _HEXAGON_V64_internal_union; \
300 _HEXAGON_V64_internal_union.d = (v); \
301 _HEXAGON_V64_internal_union.ub[3]; \
303 #define HEXAGON_V64_GET_UB4(v) \
307 unsigned char ub[8]; \
308 } _HEXAGON_V64_internal_union; \
309 _HEXAGON_V64_internal_union.d = (v); \
310 _HEXAGON_V64_internal_union.ub[4]; \
312 #define HEXAGON_V64_GET_UB5(v) \
316 unsigned char ub[8]; \
317 } _HEXAGON_V64_internal_union; \
318 _HEXAGON_V64_internal_union.d = (v); \
319 _HEXAGON_V64_internal_union.ub[5]; \
321 #define HEXAGON_V64_GET_UB6(v) \
325 unsigned char ub[8]; \
326 } _HEXAGON_V64_internal_union; \
327 _HEXAGON_V64_internal_union.d = (v); \
328 _HEXAGON_V64_internal_union.ub[6]; \
330 #define HEXAGON_V64_GET_UB7(v) \
334 unsigned char ub[8]; \
335 } _HEXAGON_V64_internal_union; \
336 _HEXAGON_V64_internal_union.d = (v); \
337 _HEXAGON_V64_internal_union.ub[7]; \
340 /* NOTE: All set macros return a HEXAGON_Vect64 type */
342 /* Set doubleword macro */
344 #define HEXAGON_V64_PUT_D(v, new) (new)
346 /* Set word macros */
350 #define HEXAGON_V64_PUT_W0(v, new) \
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; \
360 #define HEXAGON_V64_PUT_W1(v, new) \
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; \
371 #else /* !__hexagon__ */
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))
378 #endif /* !__hexagon__ */
380 /* Set half word macros */
384 #define HEXAGON_V64_PUT_H0(v, new) \
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; \
394 #define HEXAGON_V64_PUT_H1(v, new) \
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; \
404 #define HEXAGON_V64_PUT_H2(v, new) \
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; \
414 #define HEXAGON_V64_PUT_H3(v, new) \
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; \
425 #else /* !__hexagon__ */
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))
436 #endif /* !__hexagon__ */
438 /* Set byte macros */
442 #define HEXAGON_V64_PUT_B0(v, new) \
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; \
452 #define HEXAGON_V64_PUT_B1(v, new) \
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; \
462 #define HEXAGON_V64_PUT_B2(v, new) \
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; \
472 #define HEXAGON_V64_PUT_B3(v, new) \
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; \
482 #define HEXAGON_V64_PUT_B4(v, new) \
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; \
492 #define HEXAGON_V64_PUT_B5(v, new) \
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; \
502 #define HEXAGON_V64_PUT_B6(v, new) \
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; \
512 #define HEXAGON_V64_PUT_B7(v, new) \
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; \
523 #else /* !__hexagon__ */
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))
542 #endif /* !__hexagon__ */
544 /* NOTE: All create macros return a HEXAGON_Vect64 type */
546 /* Create from a doubleword */
548 #define HEXAGON_V64_CREATE_D(d) (d)
550 /* Create from words */
554 #define HEXAGON_V64_CREATE_W(w1, w0) \
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; \
565 #else /* !__hexagon__ */
567 #define HEXAGON_V64_CREATE_W(w1, w0) \
568 ((((HEXAGON_Vect64)(w1)) << 32LL) | ((HEXAGON_Vect64)((w0) & 0xffffffff)))
570 #endif /* !__hexagon__ */
572 /* Create from half words */
576 #define HEXAGON_V64_CREATE_H(h3, h2, h1, h0) \
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; \
589 #else /* !__hexagon__ */
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)))
595 #endif /* !__hexagon__ */
597 /* Create from bytes */
601 #define HEXAGON_V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0) \
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; \
618 #else /* !__hexagon__ */
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)))
626 #endif /* !__hexagon__ */
630 class HEXAGON_Vect64C
{
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
) {};
642 HEXAGON_Vect64C
&operator=(const HEXAGON_Vect64C
&v
) {
647 operator long long() {
651 // Extract doubleword methods
653 return HEXAGON_V64_GET_D(data
);
655 unsigned long long UD(void) {
656 return HEXAGON_V64_GET_UD(data
);
659 // Extract word methods
661 return HEXAGON_V64_GET_W0(data
);
664 return HEXAGON_V64_GET_W1(data
);
666 unsigned int UW0(void) {
667 return HEXAGON_V64_GET_UW0(data
);
669 unsigned int UW1(void) {
670 return HEXAGON_V64_GET_UW1(data
);
673 // Extract half word methods
675 return HEXAGON_V64_GET_H0(data
);
678 return HEXAGON_V64_GET_H1(data
);
681 return HEXAGON_V64_GET_H2(data
);
684 return HEXAGON_V64_GET_H3(data
);
686 unsigned short UH0(void) {
687 return HEXAGON_V64_GET_UH0(data
);
689 unsigned short UH1(void) {
690 return HEXAGON_V64_GET_UH1(data
);
692 unsigned short UH2(void) {
693 return HEXAGON_V64_GET_UH2(data
);
695 unsigned short UH3(void) {
696 return HEXAGON_V64_GET_UH3(data
);
699 // Extract byte methods
700 signed char B0(void) {
701 return HEXAGON_V64_GET_B0(data
);
703 signed char B1(void) {
704 return HEXAGON_V64_GET_B1(data
);
706 signed char B2(void) {
707 return HEXAGON_V64_GET_B2(data
);
709 signed char B3(void) {
710 return HEXAGON_V64_GET_B3(data
);
712 signed char B4(void) {
713 return HEXAGON_V64_GET_B4(data
);
715 signed char B5(void) {
716 return HEXAGON_V64_GET_B5(data
);
718 signed char B6(void) {
719 return HEXAGON_V64_GET_B6(data
);
721 signed char B7(void) {
722 return HEXAGON_V64_GET_B7(data
);
724 unsigned char UB0(void) {
725 return HEXAGON_V64_GET_UB0(data
);
727 unsigned char UB1(void) {
728 return HEXAGON_V64_GET_UB1(data
);
730 unsigned char UB2(void) {
731 return HEXAGON_V64_GET_UB2(data
);
733 unsigned char UB3(void) {
734 return HEXAGON_V64_GET_UB3(data
);
736 unsigned char UB4(void) {
737 return HEXAGON_V64_GET_UB4(data
);
739 unsigned char UB5(void) {
740 return HEXAGON_V64_GET_UB5(data
);
742 unsigned char UB6(void) {
743 return HEXAGON_V64_GET_UB6(data
);
745 unsigned char UB7(void) {
746 return HEXAGON_V64_GET_UB7(data
);
749 // NOTE: All set methods return a HEXAGON_Vect64C type
751 // Set doubleword method
752 HEXAGON_Vect64C
D(long long d
) {
753 return HEXAGON_Vect64C(HEXAGON_V64_PUT_D(data
, d
));
757 HEXAGON_Vect64C
W0(int w
) {
758 return HEXAGON_Vect64C(HEXAGON_V64_PUT_W0(data
, w
));
760 HEXAGON_Vect64C
W1(int w
) {
761 return HEXAGON_Vect64C(HEXAGON_V64_PUT_W1(data
, w
));
764 // Set half word methods
765 HEXAGON_Vect64C
H0(short h
) {
766 return HEXAGON_Vect64C(HEXAGON_V64_PUT_H0(data
, h
));
768 HEXAGON_Vect64C
H1(short h
) {
769 return HEXAGON_Vect64C(HEXAGON_V64_PUT_H1(data
, h
));
771 HEXAGON_Vect64C
H2(short h
) {
772 return HEXAGON_Vect64C(HEXAGON_V64_PUT_H2(data
, h
));
774 HEXAGON_Vect64C
H3(short h
) {
775 return HEXAGON_Vect64C(HEXAGON_V64_PUT_H3(data
, h
));
779 HEXAGON_Vect64C
B0(signed char b
) {
780 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B0(data
, b
));
782 HEXAGON_Vect64C
B1(signed char b
) {
783 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B1(data
, b
));
785 HEXAGON_Vect64C
B2(signed char b
) {
786 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B2(data
, b
));
788 HEXAGON_Vect64C
B3(signed char b
) {
789 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B3(data
, b
));
791 HEXAGON_Vect64C
B4(signed char b
) {
792 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B4(data
, b
));
794 HEXAGON_Vect64C
B5(signed char b
) {
795 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B5(data
, b
));
797 HEXAGON_Vect64C
B6(signed char b
) {
798 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B6(data
, b
));
800 HEXAGON_Vect64C
B7(signed char b
) {
801 return HEXAGON_Vect64C(HEXAGON_V64_PUT_B7(data
, b
));
808 #endif /* __cplusplus */
812 typedef int HEXAGON_Vect32
;
814 /* Extract word macros */
816 #define HEXAGON_V32_GET_W(v) (v)
817 #define HEXAGON_V32_GET_UW(v) ((unsigned int)(v))
819 /* Extract half word macros */
821 #define HEXAGON_V32_GET_H0(v) \
826 } _HEXAGON_V32_internal_union; \
827 _HEXAGON_V32_internal_union.w = (v); \
828 _HEXAGON_V32_internal_union.h[0]; \
830 #define HEXAGON_V32_GET_H1(v) \
835 } _HEXAGON_V32_internal_union; \
836 _HEXAGON_V32_internal_union.w = (v); \
837 _HEXAGON_V32_internal_union.h[1]; \
839 #define HEXAGON_V32_GET_UH0(v) \
843 unsigned short uh[2]; \
844 } _HEXAGON_V32_internal_union; \
845 _HEXAGON_V32_internal_union.w = (v); \
846 _HEXAGON_V32_internal_union.uh[0]; \
848 #define HEXAGON_V32_GET_UH1(v) \
852 unsigned short uh[2]; \
853 } _HEXAGON_V32_internal_union; \
854 _HEXAGON_V32_internal_union.w = (v); \
855 _HEXAGON_V32_internal_union.uh[1]; \
858 /* Extract byte macros */
860 #define HEXAGON_V32_GET_B0(v) \
865 } _HEXAGON_V32_internal_union; \
866 _HEXAGON_V32_internal_union.w = (v); \
867 _HEXAGON_V32_internal_union.b[0]; \
869 #define HEXAGON_V32_GET_B1(v) \
874 } _HEXAGON_V32_internal_union; \
875 _HEXAGON_V32_internal_union.w = (v); \
876 _HEXAGON_V32_internal_union.b[1]; \
878 #define HEXAGON_V32_GET_B2(v) \
883 } _HEXAGON_V32_internal_union; \
884 _HEXAGON_V32_internal_union.w = (v); \
885 _HEXAGON_V32_internal_union.b[2]; \
887 #define HEXAGON_V32_GET_B3(v) \
892 } _HEXAGON_V32_internal_union; \
893 _HEXAGON_V32_internal_union.w = (v); \
894 _HEXAGON_V32_internal_union.b[3]; \
896 #define HEXAGON_V32_GET_UB0(v) \
900 unsigned char ub[4]; \
901 } _HEXAGON_V32_internal_union; \
902 _HEXAGON_V32_internal_union.w = (v); \
903 _HEXAGON_V32_internal_union.ub[0]; \
905 #define HEXAGON_V32_GET_UB1(v) \
909 unsigned char ub[4]; \
910 } _HEXAGON_V32_internal_union; \
911 _HEXAGON_V32_internal_union.w = (v); \
912 _HEXAGON_V32_internal_union.ub[1]; \
914 #define HEXAGON_V32_GET_UB2(v) \
918 unsigned char ub[4]; \
919 } _HEXAGON_V32_internal_union; \
920 _HEXAGON_V32_internal_union.w = (v); \
921 _HEXAGON_V32_internal_union.ub[2]; \
923 #define HEXAGON_V32_GET_UB3(v) \
927 unsigned char ub[4]; \
928 } _HEXAGON_V32_internal_union; \
929 _HEXAGON_V32_internal_union.w = (v); \
930 _HEXAGON_V32_internal_union.ub[3]; \
933 /* NOTE: All set macros return a HEXAGON_Vect32 type */
937 #define HEXAGON_V32_PUT_W(v, new) (new)
939 /* Set half word macros */
943 #define HEXAGON_V32_PUT_H0(v, new) \
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; \
953 #define HEXAGON_V32_PUT_H1(v, new) \
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; \
964 #else /* !__hexagon__ */
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))
970 #endif /* !__hexagon__ */
972 /* Set byte macros */
976 #define HEXAGON_V32_PUT_B0(v, new) \
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; \
986 #define HEXAGON_V32_PUT_B1(v, new) \
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; \
996 #define HEXAGON_V32_PUT_B2(v, new) \
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; \
1006 #define HEXAGON_V32_PUT_B3(v, new) \
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; \
1017 #else /* !__hexagon__ */
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))
1027 #endif /* !__hexagon__ */
1029 /* NOTE: All create macros return a HEXAGON_Vect32 type */
1031 /* Create from a word */
1033 #define HEXAGON_V32_CREATE_W(w) (w)
1035 /* Create from half words */
1039 #define HEXAGON_V32_CREATE_H(h1, h0) \
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; \
1050 #else /* !__hexagon__ */
1052 #define HEXAGON_V32_CREATE_H(h1, h0) \
1053 ((((HEXAGON_Vect32)(h1)) << 16) | ((HEXAGON_Vect32)((h0) & 0xffff)))
1055 #endif /* !__hexagon__ */
1057 /* Create from bytes */
1060 #define HEXAGON_V32_CREATE_B(b3, b2, b1, b0) \
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; \
1073 #else /* !__hexagon__ */
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)))
1079 #endif /* !__hexagon__ */
1083 class HEXAGON_Vect32C
{
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
) {};
1092 HEXAGON_Vect32C
&operator=(const HEXAGON_Vect32C
&v
) {
1101 // Extract word methods
1103 return HEXAGON_V32_GET_W(data
);
1105 unsigned int UW(void) {
1106 return HEXAGON_V32_GET_UW(data
);
1109 // Extract half word methods
1111 return HEXAGON_V32_GET_H0(data
);
1114 return HEXAGON_V32_GET_H1(data
);
1116 unsigned short UH0(void) {
1117 return HEXAGON_V32_GET_UH0(data
);
1119 unsigned short UH1(void) {
1120 return HEXAGON_V32_GET_UH1(data
);
1123 // Extract byte methods
1124 signed char B0(void) {
1125 return HEXAGON_V32_GET_B0(data
);
1127 signed char B1(void) {
1128 return HEXAGON_V32_GET_B1(data
);
1130 signed char B2(void) {
1131 return HEXAGON_V32_GET_B2(data
);
1133 signed char B3(void) {
1134 return HEXAGON_V32_GET_B3(data
);
1136 unsigned char UB0(void) {
1137 return HEXAGON_V32_GET_UB0(data
);
1139 unsigned char UB1(void) {
1140 return HEXAGON_V32_GET_UB1(data
);
1142 unsigned char UB2(void) {
1143 return HEXAGON_V32_GET_UB2(data
);
1145 unsigned char UB3(void) {
1146 return HEXAGON_V32_GET_UB3(data
);
1149 // NOTE: All set methods return a HEXAGON_Vect32C type
1152 HEXAGON_Vect32C
W(int w
) {
1153 return HEXAGON_Vect32C(HEXAGON_V32_PUT_W(data
, w
));
1156 // Set half word methods
1157 HEXAGON_Vect32C
H0(short h
) {
1158 return HEXAGON_Vect32C(HEXAGON_V32_PUT_H0(data
, h
));
1160 HEXAGON_Vect32C
H1(short h
) {
1161 return HEXAGON_Vect32C(HEXAGON_V32_PUT_H1(data
, h
));
1165 HEXAGON_Vect32C
B0(signed char b
) {
1166 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B0(data
, b
));
1168 HEXAGON_Vect32C
B1(signed char b
) {
1169 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B1(data
, b
));
1171 HEXAGON_Vect32C
B2(signed char b
) {
1172 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B2(data
, b
));
1174 HEXAGON_Vect32C
B3(signed char b
) {
1175 return HEXAGON_Vect32C(HEXAGON_V32_PUT_B3(data
, b
));
1182 #endif /* __cplusplus */
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)));
1190 typedef long HEXAGON_Vect1024
__attribute__((__vector_size__(128)))
1191 __attribute__((aligned(128)));
1193 typedef long HEXAGON_Vect2048
__attribute__((__vector_size__(256)))
1194 __attribute__((aligned(256)));
1196 typedef long HEXAGON_UVect1024
__attribute__((__vector_size__(128)))
1197 __attribute__((aligned(4)));
1199 typedef long HEXAGON_UVect2048
__attribute__((__vector_size__(256)))
1200 __attribute__((aligned(4)));
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)));
1212 typedef long HEXAGON_Vect512
__attribute__((__vector_size__(64)))
1213 __attribute__((aligned(64)));
1215 typedef long HEXAGON_Vect1024
__attribute__((__vector_size__(128)))
1216 __attribute__((aligned(128)));
1218 typedef long HEXAGON_UVect512
__attribute__((__vector_size__(64)))
1219 __attribute__((aligned(4)));
1221 typedef long HEXAGON_UVect1024
__attribute__((__vector_size__(128)))
1222 __attribute__((aligned(4)));
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 */
1235 typedef int HEXAGON_Pred
;
1238 *** backward compatibility aliases
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
1294 #define Q6VectC Q6Vect64C
1295 #endif /* __cplusplus */
1297 /* 64 Bit Vectors */
1299 typedef long long __attribute__((__may_alias__
)) Q6Vect64
;
1301 /* Extract doubleword macros */
1303 #define Q6V64_GET_D(v) (v)
1304 #define Q6V64_GET_UD(v) ((unsigned long long)(v))
1306 /* Extract word macros */
1308 #define Q6V64_GET_W0(v) \
1313 } _Q6V64_internal_union; \
1314 _Q6V64_internal_union.d = (v); \
1315 _Q6V64_internal_union.w[0]; \
1317 #define Q6V64_GET_W1(v) \
1322 } _Q6V64_internal_union; \
1323 _Q6V64_internal_union.d = (v); \
1324 _Q6V64_internal_union.w[1]; \
1326 #define Q6V64_GET_UW0(v) \
1330 unsigned int uw[2]; \
1331 } _Q6V64_internal_union; \
1332 _Q6V64_internal_union.d = (v); \
1333 _Q6V64_internal_union.uw[0]; \
1335 #define Q6V64_GET_UW1(v) \
1339 unsigned int uw[2]; \
1340 } _Q6V64_internal_union; \
1341 _Q6V64_internal_union.d = (v); \
1342 _Q6V64_internal_union.uw[1]; \
1345 /* Extract half word macros */
1347 #define Q6V64_GET_H0(v) \
1352 } _Q6V64_internal_union; \
1353 _Q6V64_internal_union.d = (v); \
1354 _Q6V64_internal_union.h[0]; \
1356 #define Q6V64_GET_H1(v) \
1361 } _Q6V64_internal_union; \
1362 _Q6V64_internal_union.d = (v); \
1363 _Q6V64_internal_union.h[1]; \
1365 #define Q6V64_GET_H2(v) \
1370 } _Q6V64_internal_union; \
1371 _Q6V64_internal_union.d = (v); \
1372 _Q6V64_internal_union.h[2]; \
1374 #define Q6V64_GET_H3(v) \
1379 } _Q6V64_internal_union; \
1380 _Q6V64_internal_union.d = (v); \
1381 _Q6V64_internal_union.h[3]; \
1383 #define Q6V64_GET_UH0(v) \
1387 unsigned short uh[4]; \
1388 } _Q6V64_internal_union; \
1389 _Q6V64_internal_union.d = (v); \
1390 _Q6V64_internal_union.uh[0]; \
1392 #define Q6V64_GET_UH1(v) \
1396 unsigned short uh[4]; \
1397 } _Q6V64_internal_union; \
1398 _Q6V64_internal_union.d = (v); \
1399 _Q6V64_internal_union.uh[1]; \
1401 #define Q6V64_GET_UH2(v) \
1405 unsigned short uh[4]; \
1406 } _Q6V64_internal_union; \
1407 _Q6V64_internal_union.d = (v); \
1408 _Q6V64_internal_union.uh[2]; \
1410 #define Q6V64_GET_UH3(v) \
1414 unsigned short uh[4]; \
1415 } _Q6V64_internal_union; \
1416 _Q6V64_internal_union.d = (v); \
1417 _Q6V64_internal_union.uh[3]; \
1420 /* Extract byte macros */
1422 #define Q6V64_GET_B0(v) \
1427 } _Q6V64_internal_union; \
1428 _Q6V64_internal_union.d = (v); \
1429 _Q6V64_internal_union.b[0]; \
1431 #define Q6V64_GET_B1(v) \
1436 } _Q6V64_internal_union; \
1437 _Q6V64_internal_union.d = (v); \
1438 _Q6V64_internal_union.b[1]; \
1440 #define Q6V64_GET_B2(v) \
1445 } _Q6V64_internal_union; \
1446 _Q6V64_internal_union.d = (v); \
1447 _Q6V64_internal_union.b[2]; \
1449 #define Q6V64_GET_B3(v) \
1454 } _Q6V64_internal_union; \
1455 _Q6V64_internal_union.d = (v); \
1456 _Q6V64_internal_union.b[3]; \
1458 #define Q6V64_GET_B4(v) \
1463 } _Q6V64_internal_union; \
1464 _Q6V64_internal_union.d = (v); \
1465 _Q6V64_internal_union.b[4]; \
1467 #define Q6V64_GET_B5(v) \
1472 } _Q6V64_internal_union; \
1473 _Q6V64_internal_union.d = (v); \
1474 _Q6V64_internal_union.b[5]; \
1476 #define Q6V64_GET_B6(v) \
1481 } _Q6V64_internal_union; \
1482 _Q6V64_internal_union.d = (v); \
1483 _Q6V64_internal_union.b[6]; \
1485 #define Q6V64_GET_B7(v) \
1490 } _Q6V64_internal_union; \
1491 _Q6V64_internal_union.d = (v); \
1492 _Q6V64_internal_union.b[7]; \
1494 #define Q6V64_GET_UB0(v) \
1498 unsigned char ub[8]; \
1499 } _Q6V64_internal_union; \
1500 _Q6V64_internal_union.d = (v); \
1501 _Q6V64_internal_union.ub[0]; \
1503 #define Q6V64_GET_UB1(v) \
1507 unsigned char ub[8]; \
1508 } _Q6V64_internal_union; \
1509 _Q6V64_internal_union.d = (v); \
1510 _Q6V64_internal_union.ub[1]; \
1512 #define Q6V64_GET_UB2(v) \
1516 unsigned char ub[8]; \
1517 } _Q6V64_internal_union; \
1518 _Q6V64_internal_union.d = (v); \
1519 _Q6V64_internal_union.ub[2]; \
1521 #define Q6V64_GET_UB3(v) \
1525 unsigned char ub[8]; \
1526 } _Q6V64_internal_union; \
1527 _Q6V64_internal_union.d = (v); \
1528 _Q6V64_internal_union.ub[3]; \
1530 #define Q6V64_GET_UB4(v) \
1534 unsigned char ub[8]; \
1535 } _Q6V64_internal_union; \
1536 _Q6V64_internal_union.d = (v); \
1537 _Q6V64_internal_union.ub[4]; \
1539 #define Q6V64_GET_UB5(v) \
1543 unsigned char ub[8]; \
1544 } _Q6V64_internal_union; \
1545 _Q6V64_internal_union.d = (v); \
1546 _Q6V64_internal_union.ub[5]; \
1548 #define Q6V64_GET_UB6(v) \
1552 unsigned char ub[8]; \
1553 } _Q6V64_internal_union; \
1554 _Q6V64_internal_union.d = (v); \
1555 _Q6V64_internal_union.ub[6]; \
1557 #define Q6V64_GET_UB7(v) \
1561 unsigned char ub[8]; \
1562 } _Q6V64_internal_union; \
1563 _Q6V64_internal_union.d = (v); \
1564 _Q6V64_internal_union.ub[7]; \
1567 /* NOTE: All set macros return a Q6Vect64 type */
1569 /* Set doubleword macro */
1571 #define Q6V64_PUT_D(v, new) (new)
1573 /* Set word macros */
1577 #define Q6V64_PUT_W0(v, new) \
1582 } _Q6V64_internal_union; \
1583 _Q6V64_internal_union.d = (v); \
1584 _Q6V64_internal_union.w[0] = (new); \
1585 _Q6V64_internal_union.d; \
1587 #define Q6V64_PUT_W1(v, new) \
1592 } _Q6V64_internal_union; \
1593 _Q6V64_internal_union.d = (v); \
1594 _Q6V64_internal_union.w[1] = (new); \
1595 _Q6V64_internal_union.d; \
1598 #else /* !__qdsp6__ */
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))
1605 #endif /* !__qdsp6__ */
1607 /* Set half word macros */
1611 #define Q6V64_PUT_H0(v, new) \
1616 } _Q6V64_internal_union; \
1617 _Q6V64_internal_union.d = (v); \
1618 _Q6V64_internal_union.h[0] = (new); \
1619 _Q6V64_internal_union.d; \
1621 #define Q6V64_PUT_H1(v, new) \
1626 } _Q6V64_internal_union; \
1627 _Q6V64_internal_union.d = (v); \
1628 _Q6V64_internal_union.h[1] = (new); \
1629 _Q6V64_internal_union.d; \
1631 #define Q6V64_PUT_H2(v, new) \
1636 } _Q6V64_internal_union; \
1637 _Q6V64_internal_union.d = (v); \
1638 _Q6V64_internal_union.h[2] = (new); \
1639 _Q6V64_internal_union.d; \
1641 #define Q6V64_PUT_H3(v, new) \
1646 } _Q6V64_internal_union; \
1647 _Q6V64_internal_union.d = (v); \
1648 _Q6V64_internal_union.h[3] = (new); \
1649 _Q6V64_internal_union.d; \
1652 #else /* !__qdsp6__ */
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))
1663 #endif /* !__qdsp6__ */
1665 /* Set byte macros */
1669 #define Q6V64_PUT_B0(v, new) \
1674 } _Q6V64_internal_union; \
1675 _Q6V64_internal_union.d = (v); \
1676 _Q6V64_internal_union.b[0] = (new); \
1677 _Q6V64_internal_union.d; \
1679 #define Q6V64_PUT_B1(v, new) \
1684 } _Q6V64_internal_union; \
1685 _Q6V64_internal_union.d = (v); \
1686 _Q6V64_internal_union.b[1] = (new); \
1687 _Q6V64_internal_union.d; \
1689 #define Q6V64_PUT_B2(v, new) \
1694 } _Q6V64_internal_union; \
1695 _Q6V64_internal_union.d = (v); \
1696 _Q6V64_internal_union.b[2] = (new); \
1697 _Q6V64_internal_union.d; \
1699 #define Q6V64_PUT_B3(v, new) \
1704 } _Q6V64_internal_union; \
1705 _Q6V64_internal_union.d = (v); \
1706 _Q6V64_internal_union.b[3] = (new); \
1707 _Q6V64_internal_union.d; \
1709 #define Q6V64_PUT_B4(v, new) \
1714 } _Q6V64_internal_union; \
1715 _Q6V64_internal_union.d = (v); \
1716 _Q6V64_internal_union.b[4] = (new); \
1717 _Q6V64_internal_union.d; \
1719 #define Q6V64_PUT_B5(v, new) \
1724 } _Q6V64_internal_union; \
1725 _Q6V64_internal_union.d = (v); \
1726 _Q6V64_internal_union.b[5] = (new); \
1727 _Q6V64_internal_union.d; \
1729 #define Q6V64_PUT_B6(v, new) \
1734 } _Q6V64_internal_union; \
1735 _Q6V64_internal_union.d = (v); \
1736 _Q6V64_internal_union.b[6] = (new); \
1737 _Q6V64_internal_union.d; \
1739 #define Q6V64_PUT_B7(v, new) \
1744 } _Q6V64_internal_union; \
1745 _Q6V64_internal_union.d = (v); \
1746 _Q6V64_internal_union.b[7] = (new); \
1747 _Q6V64_internal_union.d; \
1750 #else /* !__qdsp6__ */
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))
1769 #endif /* !__qdsp6__ */
1771 /* NOTE: All create macros return a Q6Vect64 type */
1773 /* Create from a doubleword */
1775 #define Q6V64_CREATE_D(d) (d)
1777 /* Create from words */
1781 #define Q6V64_CREATE_W(w1, w0) \
1786 } _Q6V64_internal_union; \
1787 _Q6V64_internal_union.w[0] = (w0); \
1788 _Q6V64_internal_union.w[1] = (w1); \
1789 _Q6V64_internal_union.d; \
1792 #else /* !__qdsp6__ */
1794 #define Q6V64_CREATE_W(w1, w0) \
1795 ((((Q6Vect64)(w1)) << 32LL) | ((Q6Vect64)((w0) & 0xffffffff)))
1797 #endif /* !__qdsp6__ */
1799 /* Create from half words */
1803 #define Q6V64_CREATE_H(h3, h2, h1, h0) \
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; \
1816 #else /* !__qdsp6__ */
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)))
1822 #endif /* !__qdsp6__ */
1824 /* Create from bytes */
1828 #define Q6V64_CREATE_B(b7, b6, b5, b4, b3, b2, b1, b0) \
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; \
1845 #else /* !__qdsp6__ */
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)))
1853 #endif /* !__qdsp6__ */
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
) {};
1869 Q6Vect64C
&operator=(const Q6Vect64C
&v
) {
1874 operator long long() {
1878 // Extract doubleword methods
1880 return Q6V64_GET_D(data
);
1882 unsigned long long UD(void) {
1883 return Q6V64_GET_UD(data
);
1886 // Extract word methods
1888 return Q6V64_GET_W0(data
);
1891 return Q6V64_GET_W1(data
);
1893 unsigned int UW0(void) {
1894 return Q6V64_GET_UW0(data
);
1896 unsigned int UW1(void) {
1897 return Q6V64_GET_UW1(data
);
1900 // Extract half word methods
1902 return Q6V64_GET_H0(data
);
1905 return Q6V64_GET_H1(data
);
1908 return Q6V64_GET_H2(data
);
1911 return Q6V64_GET_H3(data
);
1913 unsigned short UH0(void) {
1914 return Q6V64_GET_UH0(data
);
1916 unsigned short UH1(void) {
1917 return Q6V64_GET_UH1(data
);
1919 unsigned short UH2(void) {
1920 return Q6V64_GET_UH2(data
);
1922 unsigned short UH3(void) {
1923 return Q6V64_GET_UH3(data
);
1926 // Extract byte methods
1927 signed char B0(void) {
1928 return Q6V64_GET_B0(data
);
1930 signed char B1(void) {
1931 return Q6V64_GET_B1(data
);
1933 signed char B2(void) {
1934 return Q6V64_GET_B2(data
);
1936 signed char B3(void) {
1937 return Q6V64_GET_B3(data
);
1939 signed char B4(void) {
1940 return Q6V64_GET_B4(data
);
1942 signed char B5(void) {
1943 return Q6V64_GET_B5(data
);
1945 signed char B6(void) {
1946 return Q6V64_GET_B6(data
);
1948 signed char B7(void) {
1949 return Q6V64_GET_B7(data
);
1951 unsigned char UB0(void) {
1952 return Q6V64_GET_UB0(data
);
1954 unsigned char UB1(void) {
1955 return Q6V64_GET_UB1(data
);
1957 unsigned char UB2(void) {
1958 return Q6V64_GET_UB2(data
);
1960 unsigned char UB3(void) {
1961 return Q6V64_GET_UB3(data
);
1963 unsigned char UB4(void) {
1964 return Q6V64_GET_UB4(data
);
1966 unsigned char UB5(void) {
1967 return Q6V64_GET_UB5(data
);
1969 unsigned char UB6(void) {
1970 return Q6V64_GET_UB6(data
);
1972 unsigned char UB7(void) {
1973 return Q6V64_GET_UB7(data
);
1976 // NOTE: All set methods return a Q6Vect64C type
1978 // Set doubleword method
1979 Q6Vect64C
D(long long d
) {
1980 return Q6Vect64C(Q6V64_PUT_D(data
, d
));
1984 Q6Vect64C
W0(int w
) {
1985 return Q6Vect64C(Q6V64_PUT_W0(data
, w
));
1987 Q6Vect64C
W1(int w
) {
1988 return Q6Vect64C(Q6V64_PUT_W1(data
, w
));
1991 // Set half word methods
1992 Q6Vect64C
H0(short h
) {
1993 return Q6Vect64C(Q6V64_PUT_H0(data
, h
));
1995 Q6Vect64C
H1(short h
) {
1996 return Q6Vect64C(Q6V64_PUT_H1(data
, h
));
1998 Q6Vect64C
H2(short h
) {
1999 return Q6Vect64C(Q6V64_PUT_H2(data
, h
));
2001 Q6Vect64C
H3(short h
) {
2002 return Q6Vect64C(Q6V64_PUT_H3(data
, h
));
2006 Q6Vect64C
B0(signed char b
) {
2007 return Q6Vect64C(Q6V64_PUT_B0(data
, b
));
2009 Q6Vect64C
B1(signed char b
) {
2010 return Q6Vect64C(Q6V64_PUT_B1(data
, b
));
2012 Q6Vect64C
B2(signed char b
) {
2013 return Q6Vect64C(Q6V64_PUT_B2(data
, b
));
2015 Q6Vect64C
B3(signed char b
) {
2016 return Q6Vect64C(Q6V64_PUT_B3(data
, b
));
2018 Q6Vect64C
B4(signed char b
) {
2019 return Q6Vect64C(Q6V64_PUT_B4(data
, b
));
2021 Q6Vect64C
B5(signed char b
) {
2022 return Q6Vect64C(Q6V64_PUT_B5(data
, b
));
2024 Q6Vect64C
B6(signed char b
) {
2025 return Q6Vect64C(Q6V64_PUT_B6(data
, b
));
2027 Q6Vect64C
B7(signed char b
) {
2028 return Q6Vect64C(Q6V64_PUT_B7(data
, b
));
2035 #endif /* __cplusplus */
2037 /* 32 Bit Vectors */
2039 typedef int Q6Vect32
;
2041 /* Extract word macros */
2043 #define Q6V32_GET_W(v) (v)
2044 #define Q6V32_GET_UW(v) ((unsigned int)(v))
2046 /* Extract half word macros */
2048 #define Q6V32_GET_H0(v) \
2053 } _Q6V32_internal_union; \
2054 _Q6V32_internal_union.w = (v); \
2055 _Q6V32_internal_union.h[0]; \
2057 #define Q6V32_GET_H1(v) \
2062 } _Q6V32_internal_union; \
2063 _Q6V32_internal_union.w = (v); \
2064 _Q6V32_internal_union.h[1]; \
2066 #define Q6V32_GET_UH0(v) \
2070 unsigned short uh[2]; \
2071 } _Q6V32_internal_union; \
2072 _Q6V32_internal_union.w = (v); \
2073 _Q6V32_internal_union.uh[0]; \
2075 #define Q6V32_GET_UH1(v) \
2079 unsigned short uh[2]; \
2080 } _Q6V32_internal_union; \
2081 _Q6V32_internal_union.w = (v); \
2082 _Q6V32_internal_union.uh[1]; \
2085 /* Extract byte macros */
2087 #define Q6V32_GET_B0(v) \
2092 } _Q6V32_internal_union; \
2093 _Q6V32_internal_union.w = (v); \
2094 _Q6V32_internal_union.b[0]; \
2096 #define Q6V32_GET_B1(v) \
2101 } _Q6V32_internal_union; \
2102 _Q6V32_internal_union.w = (v); \
2103 _Q6V32_internal_union.b[1]; \
2105 #define Q6V32_GET_B2(v) \
2110 } _Q6V32_internal_union; \
2111 _Q6V32_internal_union.w = (v); \
2112 _Q6V32_internal_union.b[2]; \
2114 #define Q6V32_GET_B3(v) \
2119 } _Q6V32_internal_union; \
2120 _Q6V32_internal_union.w = (v); \
2121 _Q6V32_internal_union.b[3]; \
2123 #define Q6V32_GET_UB0(v) \
2127 unsigned char ub[4]; \
2128 } _Q6V32_internal_union; \
2129 _Q6V32_internal_union.w = (v); \
2130 _Q6V32_internal_union.ub[0]; \
2132 #define Q6V32_GET_UB1(v) \
2136 unsigned char ub[4]; \
2137 } _Q6V32_internal_union; \
2138 _Q6V32_internal_union.w = (v); \
2139 _Q6V32_internal_union.ub[1]; \
2141 #define Q6V32_GET_UB2(v) \
2145 unsigned char ub[4]; \
2146 } _Q6V32_internal_union; \
2147 _Q6V32_internal_union.w = (v); \
2148 _Q6V32_internal_union.ub[2]; \
2150 #define Q6V32_GET_UB3(v) \
2154 unsigned char ub[4]; \
2155 } _Q6V32_internal_union; \
2156 _Q6V32_internal_union.w = (v); \
2157 _Q6V32_internal_union.ub[3]; \
2160 /* NOTE: All set macros return a Q6Vect32 type */
2162 /* Set word macro */
2164 #define Q6V32_PUT_W(v, new) (new)
2166 /* Set half word macros */
2170 #define Q6V32_PUT_H0(v, new) \
2175 } _Q6V32_internal_union; \
2176 _Q6V32_internal_union.w = (v); \
2177 _Q6V32_internal_union.h[0] = (new); \
2178 _Q6V32_internal_union.w; \
2180 #define Q6V32_PUT_H1(v, new) \
2185 } _Q6V32_internal_union; \
2186 _Q6V32_internal_union.w = (v); \
2187 _Q6V32_internal_union.h[1] = (new); \
2188 _Q6V32_internal_union.w; \
2191 #else /* !__qdsp6__ */
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))
2197 #endif /* !__qdsp6__ */
2199 /* Set byte macros */
2203 #define Q6V32_PUT_B0(v, new) \
2208 } _Q6V32_internal_union; \
2209 _Q6V32_internal_union.w = (v); \
2210 _Q6V32_internal_union.b[0] = (new); \
2211 _Q6V32_internal_union.w; \
2213 #define Q6V32_PUT_B1(v, new) \
2218 } _Q6V32_internal_union; \
2219 _Q6V32_internal_union.w = (v); \
2220 _Q6V32_internal_union.b[1] = (new); \
2221 _Q6V32_internal_union.w; \
2223 #define Q6V32_PUT_B2(v, new) \
2228 } _Q6V32_internal_union; \
2229 _Q6V32_internal_union.w = (v); \
2230 _Q6V32_internal_union.b[2] = (new); \
2231 _Q6V32_internal_union.w; \
2233 #define Q6V32_PUT_B3(v, new) \
2238 } _Q6V32_internal_union; \
2239 _Q6V32_internal_union.w = (v); \
2240 _Q6V32_internal_union.b[3] = (new); \
2241 _Q6V32_internal_union.w; \
2244 #else /* !__qdsp6__ */
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))
2254 #endif /* !__qdsp6__ */
2256 /* NOTE: All create macros return a Q6Vect32 type */
2258 /* Create from a word */
2260 #define Q6V32_CREATE_W(w) (w)
2262 /* Create from half words */
2266 #define Q6V32_CREATE_H(h1, h0) \
2271 } _Q6V32_internal_union; \
2272 _Q6V32_internal_union.h[0] = (h0); \
2273 _Q6V32_internal_union.h[1] = (h1); \
2274 _Q6V32_internal_union.d; \
2277 #else /* !__qdsp6__ */
2279 #define Q6V32_CREATE_H(h1, h0) \
2280 ((((Q6Vect32)(h1)) << 16) | ((Q6Vect32)((h0) & 0xffff)))
2282 #endif /* !__qdsp6__ */
2284 /* Create from bytes */
2287 #define Q6V32_CREATE_B(b3, b2, b1, b0) \
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; \
2300 #else /* !__qdsp6__ */
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)))
2306 #endif /* !__qdsp6__ */
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
) {};
2319 Q6Vect32C
&operator=(const Q6Vect32C
&v
) {
2328 // Extract word methods
2330 return Q6V32_GET_W(data
);
2332 unsigned int UW(void) {
2333 return Q6V32_GET_UW(data
);
2336 // Extract half word methods
2338 return Q6V32_GET_H0(data
);
2341 return Q6V32_GET_H1(data
);
2343 unsigned short UH0(void) {
2344 return Q6V32_GET_UH0(data
);
2346 unsigned short UH1(void) {
2347 return Q6V32_GET_UH1(data
);
2350 // Extract byte methods
2351 signed char B0(void) {
2352 return Q6V32_GET_B0(data
);
2354 signed char B1(void) {
2355 return Q6V32_GET_B1(data
);
2357 signed char B2(void) {
2358 return Q6V32_GET_B2(data
);
2360 signed char B3(void) {
2361 return Q6V32_GET_B3(data
);
2363 unsigned char UB0(void) {
2364 return Q6V32_GET_UB0(data
);
2366 unsigned char UB1(void) {
2367 return Q6V32_GET_UB1(data
);
2369 unsigned char UB2(void) {
2370 return Q6V32_GET_UB2(data
);
2372 unsigned char UB3(void) {
2373 return Q6V32_GET_UB3(data
);
2376 // NOTE: All set methods return a Q6Vect32C type
2379 Q6Vect32C
W(int w
) {
2380 return Q6Vect32C(Q6V32_PUT_W(data
, w
));
2383 // Set half word methods
2384 Q6Vect32C
H0(short h
) {
2385 return Q6Vect32C(Q6V32_PUT_H0(data
, h
));
2387 Q6Vect32C
H1(short h
) {
2388 return Q6Vect32C(Q6V32_PUT_H1(data
, h
));
2392 Q6Vect32C
B0(signed char b
) {
2393 return Q6Vect32C(Q6V32_PUT_B0(data
, b
));
2395 Q6Vect32C
B1(signed char b
) {
2396 return Q6Vect32C(Q6V32_PUT_B1(data
, b
));
2398 Q6Vect32C
B2(signed char b
) {
2399 return Q6Vect32C(Q6V32_PUT_B2(data
, b
));
2401 Q6Vect32C
B3(signed char b
) {
2402 return Q6Vect32C(Q6V32_PUT_B3(data
, b
));
2409 #endif /* __cplusplus */
2412 #if __HVX_ARCH__ >= 65
2413 #if defined __HVX__ && (__HVX_LENGTH__ == 128)
2414 typedef long Q6VecPred128
__attribute__((__vector_size__(128)))
2415 __attribute__((aligned(128)));
2417 typedef long Q6Vect1024
__attribute__((__vector_size__(128)))
2418 __attribute__((aligned(128)));
2420 typedef long Q6Vect2048
__attribute__((__vector_size__(256)))
2421 __attribute__((aligned(256)));
2423 #else /* defined __HVX__ && (__HVX_LENGTH__ == 128) */
2424 #if defined __HVX__ && (__HVX_LENGTH__ == 64)
2425 typedef long Q6VecPred64
__attribute__((__vector_size__(64)))
2426 __attribute__((aligned(64)));
2428 typedef long Q6Vect512
__attribute__((__vector_size__(64)))
2429 __attribute__((aligned(64)));
2431 typedef long Q6Vect1024
__attribute__((__vector_size__(128)))
2432 __attribute__((aligned(128)));
2434 #endif /* defined __HVX__ && (__HVX_LENGTH__ == 64) */
2435 #endif /* defined __HVX__ && (__HVX_LENGTH__ == 128) */
2436 #endif /* __HVX_ARCH__ >= 65 */
2445 // Extract HVX VectorPair macro.
2446 #define HEXAGON_HVX_GET_W(v) (v)
2448 // Extract HVX Vector macros.
2449 #define HEXAGON_HVX_GET_V0(v) \
2454 } _HEXAGON_HVX_internal_union; \
2455 _HEXAGON_HVX_internal_union.W = (v); \
2456 _HEXAGON_HVX_internal_union.V[0]; \
2458 #define HEXAGON_HVX_GET_V1(v) \
2463 } _HEXAGON_HVX_internal_union; \
2464 _HEXAGON_HVX_internal_union.W = (v); \
2465 _HEXAGON_HVX_internal_union.V[1]; \
2467 #define HEXAGON_HVX_GET_P(v) \
2471 HVX_VectorPred P[2]; \
2472 } _HEXAGON_HVX_internal_union; \
2473 _HEXAGON_HVX_internal_union.W = (v); \
2474 _HEXAGON_HVX_internal_union.P[0]; \
2477 // Set HVX VectorPair macro.
2478 #define HEXAGON_HVX_PUT_W(v, new) (new)
2480 // Set HVX Vector macros.
2481 #define HEXAGON_HVX_PUT_V0(v, new) \
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; \
2492 #define HEXAGON_HVX_PUT_V1(v, new) \
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; \
2503 #define HEXAGON_HVX_PUT_P(v, new) \
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; \
2515 #define HEXAGON_HVX_CREATE_W(v1, v0) \
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; \
2532 HVX_Vect() : data(Q6_W_vcombine_VV(Q6_V_vzero(), Q6_V_vzero())){};
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
)){};
2538 // Copy constructor.
2539 HVX_Vect(const HVX_Vect
&W
) = default;
2541 // Move constructor.
2542 HVX_Vect(HVX_Vect
&&W
) = default;
2544 // Assignment operator.
2545 HVX_Vect
&operator=(const HVX_Vect
&W
) = default;
2547 operator HVX_VectorPair() { return data
; };
2549 // Extract VectorPair method.
2550 HVX_VectorPair
W(void) { return HEXAGON_HVX_GET_W(data
); };
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
); };
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
)); };
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
)); };
2567 HVX_VectorPair data
;
2570 #endif /* __cplusplus */
2571 #endif /* __HVX__ */
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
2587 typedef struct hexagon_udma_descriptor_type0_s
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;
2600 } hexagon_udma_descriptor_type0_t
;
2602 typedef struct hexagon_udma_descriptor_type1_s
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;
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;
2623 } hexagon_udma_descriptor_type1_t
;
2625 #endif /* !HEXAGON_TYPES_H */