2 /* autogenerated from gstadderorc.orc */
9 #ifndef _ORC_INTEGER_TYPEDEFS_
10 #define _ORC_INTEGER_TYPEDEFS_
11 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
13 typedef int8_t orc_int8;
14 typedef int16_t orc_int16;
15 typedef int32_t orc_int32;
16 typedef int64_t orc_int64;
17 typedef uint8_t orc_uint8;
18 typedef uint16_t orc_uint16;
19 typedef uint32_t orc_uint32;
20 typedef uint64_t orc_uint64;
21 #define ORC_UINT64_C(x) UINT64_C(x)
22 #elif defined(_MSC_VER)
23 typedef signed __int8 orc_int8;
24 typedef signed __int16 orc_int16;
25 typedef signed __int32 orc_int32;
26 typedef signed __int64 orc_int64;
27 typedef unsigned __int8 orc_uint8;
28 typedef unsigned __int16 orc_uint16;
29 typedef unsigned __int32 orc_uint32;
30 typedef unsigned __int64 orc_uint64;
31 #define ORC_UINT64_C(x) (x##Ui64)
32 #define inline __inline
35 typedef signed char orc_int8;
36 typedef short orc_int16;
37 typedef int orc_int32;
38 typedef unsigned char orc_uint8;
39 typedef unsigned short orc_uint16;
40 typedef unsigned int orc_uint32;
41 #if INT_MAX == LONG_MAX
42 typedef long long orc_int64;
43 typedef unsigned long long orc_uint64;
44 #define ORC_UINT64_C(x) (x##ULL)
46 typedef long orc_int64;
47 typedef unsigned long orc_uint64;
48 #define ORC_UINT64_C(x) (x##UL)
73 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
74 #define ORC_RESTRICT restrict
75 #elif defined(__GNUC__) && __GNUC__ >= 4
76 #define ORC_RESTRICT __restrict__
85 void adder_orc_add_int32 (gint32 * ORC_RESTRICT d1,
86 const gint32 * ORC_RESTRICT s1, int n);
87 void adder_orc_add_int16 (gint16 * ORC_RESTRICT d1,
88 const gint16 * ORC_RESTRICT s1, int n);
89 void adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
91 void adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
92 const guint32 * ORC_RESTRICT s1, int n);
93 void adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
94 const guint16 * ORC_RESTRICT s1, int n);
95 void adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1,
96 const guint8 * ORC_RESTRICT s1, int n);
97 void adder_orc_add_float32 (float *ORC_RESTRICT d1,
98 const float *ORC_RESTRICT s1, int n);
101 /* begin Orc C target preamble */
102 #define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
103 #define ORC_ABS(a) ((a)<0 ? -(a) : (a))
104 #define ORC_MIN(a,b) ((a)<(b) ? (a) : (b))
105 #define ORC_MAX(a,b) ((a)>(b) ? (a) : (b))
106 #define ORC_SB_MAX 127
107 #define ORC_SB_MIN (-1-ORC_SB_MAX)
108 #define ORC_UB_MAX 255
110 #define ORC_SW_MAX 32767
111 #define ORC_SW_MIN (-1-ORC_SW_MAX)
112 #define ORC_UW_MAX 65535
114 #define ORC_SL_MAX 2147483647
115 #define ORC_SL_MIN (-1-ORC_SL_MAX)
116 #define ORC_UL_MAX 4294967295U
118 #define ORC_CLAMP_SB(x) ORC_CLAMP(x,ORC_SB_MIN,ORC_SB_MAX)
119 #define ORC_CLAMP_UB(x) ORC_CLAMP(x,ORC_UB_MIN,ORC_UB_MAX)
120 #define ORC_CLAMP_SW(x) ORC_CLAMP(x,ORC_SW_MIN,ORC_SW_MAX)
121 #define ORC_CLAMP_UW(x) ORC_CLAMP(x,ORC_UW_MIN,ORC_UW_MAX)
122 #define ORC_CLAMP_SL(x) ORC_CLAMP(x,ORC_SL_MIN,ORC_SL_MAX)
123 #define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX)
124 #define ORC_SWAP_W(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))
125 #define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))
126 #define ORC_SWAP_Q(x) ((((x)&ORC_UINT64_C(0xff))<<56) | (((x)&ORC_UINT64_C(0xff00))<<40) | (((x)&ORC_UINT64_C(0xff0000))<<24) | (((x)&ORC_UINT64_C(0xff000000))<<8) | (((x)&ORC_UINT64_C(0xff00000000))>>8) | (((x)&ORC_UINT64_C(0xff0000000000))>>24) | (((x)&ORC_UINT64_C(0xff000000000000))>>40) | (((x)&ORC_UINT64_C(0xff00000000000000))>>56))
127 #define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
128 #define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))
129 #define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0))
130 #define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff)))
131 #define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0))
133 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
134 #define ORC_RESTRICT restrict
135 #elif defined(__GNUC__) && __GNUC__ >= 4
136 #define ORC_RESTRICT __restrict__
141 /* end Orc C target preamble */
145 /* adder_orc_add_int32 */
148 adder_orc_add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
152 orc_union32 *ORC_RESTRICT ptr0;
153 const orc_union32 *ORC_RESTRICT ptr4;
158 ptr0 = (orc_union32 *) d1;
159 ptr4 = (orc_union32 *) s1;
162 for (i = 0; i < n; i++) {
168 var34.i = ORC_CLAMP_SL ((orc_int64) var32.i + (orc_int64) var33.i);
177 _backup_adder_orc_add_int32 (OrcExecutor * ORC_RESTRICT ex)
181 orc_union32 *ORC_RESTRICT ptr0;
182 const orc_union32 *ORC_RESTRICT ptr4;
187 ptr0 = (orc_union32 *) ex->arrays[0];
188 ptr4 = (orc_union32 *) ex->arrays[4];
191 for (i = 0; i < n; i++) {
197 var34.i = ORC_CLAMP_SL ((orc_int64) var32.i + (orc_int64) var33.i);
205 adder_orc_add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
208 OrcExecutor _ex, *ex = &_ex;
209 static volatile int p_inited = 0;
210 static OrcCode *c = 0;
211 void (*func) (OrcExecutor *);
214 orc_once_mutex_lock ();
218 p = orc_program_new ();
219 orc_program_set_name (p, "adder_orc_add_int32");
220 orc_program_set_backup_function (p, _backup_adder_orc_add_int32);
221 orc_program_add_destination (p, 4, "d1");
222 orc_program_add_source (p, 4, "s1");
224 orc_program_append_2 (p, "addssl", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
227 orc_program_compile (p);
228 c = orc_program_take_code (p);
229 orc_program_free (p);
232 orc_once_mutex_unlock ();
234 ex->arrays[ORC_VAR_A2] = c;
238 ex->arrays[ORC_VAR_D1] = d1;
239 ex->arrays[ORC_VAR_S1] = (void *) s1;
247 /* adder_orc_add_int16 */
250 adder_orc_add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
254 orc_union16 *ORC_RESTRICT ptr0;
255 const orc_union16 *ORC_RESTRICT ptr4;
260 ptr0 = (orc_union16 *) d1;
261 ptr4 = (orc_union16 *) s1;
264 for (i = 0; i < n; i++) {
270 var34.i = ORC_CLAMP_SW (var32.i + var33.i);
279 _backup_adder_orc_add_int16 (OrcExecutor * ORC_RESTRICT ex)
283 orc_union16 *ORC_RESTRICT ptr0;
284 const orc_union16 *ORC_RESTRICT ptr4;
289 ptr0 = (orc_union16 *) ex->arrays[0];
290 ptr4 = (orc_union16 *) ex->arrays[4];
293 for (i = 0; i < n; i++) {
299 var34.i = ORC_CLAMP_SW (var32.i + var33.i);
307 adder_orc_add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
310 OrcExecutor _ex, *ex = &_ex;
311 static volatile int p_inited = 0;
312 static OrcCode *c = 0;
313 void (*func) (OrcExecutor *);
316 orc_once_mutex_lock ();
320 p = orc_program_new ();
321 orc_program_set_name (p, "adder_orc_add_int16");
322 orc_program_set_backup_function (p, _backup_adder_orc_add_int16);
323 orc_program_add_destination (p, 2, "d1");
324 orc_program_add_source (p, 2, "s1");
326 orc_program_append_2 (p, "addssw", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
329 orc_program_compile (p);
330 c = orc_program_take_code (p);
331 orc_program_free (p);
334 orc_once_mutex_unlock ();
336 ex->arrays[ORC_VAR_A2] = c;
340 ex->arrays[ORC_VAR_D1] = d1;
341 ex->arrays[ORC_VAR_S1] = (void *) s1;
349 /* adder_orc_add_int8 */
352 adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
356 orc_int8 *ORC_RESTRICT ptr0;
357 const orc_int8 *ORC_RESTRICT ptr4;
362 ptr0 = (orc_int8 *) d1;
363 ptr4 = (orc_int8 *) s1;
366 for (i = 0; i < n; i++) {
372 var34 = ORC_CLAMP_SB (var32 + var33);
381 _backup_adder_orc_add_int8 (OrcExecutor * ORC_RESTRICT ex)
385 orc_int8 *ORC_RESTRICT ptr0;
386 const orc_int8 *ORC_RESTRICT ptr4;
391 ptr0 = (orc_int8 *) ex->arrays[0];
392 ptr4 = (orc_int8 *) ex->arrays[4];
395 for (i = 0; i < n; i++) {
401 var34 = ORC_CLAMP_SB (var32 + var33);
409 adder_orc_add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1,
412 OrcExecutor _ex, *ex = &_ex;
413 static volatile int p_inited = 0;
414 static OrcCode *c = 0;
415 void (*func) (OrcExecutor *);
418 orc_once_mutex_lock ();
422 p = orc_program_new ();
423 orc_program_set_name (p, "adder_orc_add_int8");
424 orc_program_set_backup_function (p, _backup_adder_orc_add_int8);
425 orc_program_add_destination (p, 1, "d1");
426 orc_program_add_source (p, 1, "s1");
428 orc_program_append_2 (p, "addssb", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
431 orc_program_compile (p);
432 c = orc_program_take_code (p);
433 orc_program_free (p);
436 orc_once_mutex_unlock ();
438 ex->arrays[ORC_VAR_A2] = c;
442 ex->arrays[ORC_VAR_D1] = d1;
443 ex->arrays[ORC_VAR_S1] = (void *) s1;
451 /* adder_orc_add_uint32 */
454 adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
455 const guint32 * ORC_RESTRICT s1, int n)
458 orc_union32 *ORC_RESTRICT ptr0;
459 const orc_union32 *ORC_RESTRICT ptr4;
464 ptr0 = (orc_union32 *) d1;
465 ptr4 = (orc_union32 *) s1;
468 for (i = 0; i < n; i++) {
475 ORC_CLAMP_UL ((orc_int64) (orc_uint32) var32.i +
476 (orc_int64) (orc_uint32) var33.i);
485 _backup_adder_orc_add_uint32 (OrcExecutor * ORC_RESTRICT ex)
489 orc_union32 *ORC_RESTRICT ptr0;
490 const orc_union32 *ORC_RESTRICT ptr4;
495 ptr0 = (orc_union32 *) ex->arrays[0];
496 ptr4 = (orc_union32 *) ex->arrays[4];
499 for (i = 0; i < n; i++) {
506 ORC_CLAMP_UL ((orc_int64) (orc_uint32) var32.i +
507 (orc_int64) (orc_uint32) var33.i);
515 adder_orc_add_uint32 (guint32 * ORC_RESTRICT d1,
516 const guint32 * ORC_RESTRICT s1, int n)
518 OrcExecutor _ex, *ex = &_ex;
519 static volatile int p_inited = 0;
520 static OrcCode *c = 0;
521 void (*func) (OrcExecutor *);
524 orc_once_mutex_lock ();
528 p = orc_program_new ();
529 orc_program_set_name (p, "adder_orc_add_uint32");
530 orc_program_set_backup_function (p, _backup_adder_orc_add_uint32);
531 orc_program_add_destination (p, 4, "d1");
532 orc_program_add_source (p, 4, "s1");
534 orc_program_append_2 (p, "addusl", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
537 orc_program_compile (p);
538 c = orc_program_take_code (p);
539 orc_program_free (p);
542 orc_once_mutex_unlock ();
544 ex->arrays[ORC_VAR_A2] = c;
548 ex->arrays[ORC_VAR_D1] = d1;
549 ex->arrays[ORC_VAR_S1] = (void *) s1;
557 /* adder_orc_add_uint16 */
560 adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
561 const guint16 * ORC_RESTRICT s1, int n)
564 orc_union16 *ORC_RESTRICT ptr0;
565 const orc_union16 *ORC_RESTRICT ptr4;
570 ptr0 = (orc_union16 *) d1;
571 ptr4 = (orc_union16 *) s1;
574 for (i = 0; i < n; i++) {
580 var34.i = ORC_CLAMP_UW ((orc_uint16) var32.i + (orc_uint16) var33.i);
589 _backup_adder_orc_add_uint16 (OrcExecutor * ORC_RESTRICT ex)
593 orc_union16 *ORC_RESTRICT ptr0;
594 const orc_union16 *ORC_RESTRICT ptr4;
599 ptr0 = (orc_union16 *) ex->arrays[0];
600 ptr4 = (orc_union16 *) ex->arrays[4];
603 for (i = 0; i < n; i++) {
609 var34.i = ORC_CLAMP_UW ((orc_uint16) var32.i + (orc_uint16) var33.i);
617 adder_orc_add_uint16 (guint16 * ORC_RESTRICT d1,
618 const guint16 * ORC_RESTRICT s1, int n)
620 OrcExecutor _ex, *ex = &_ex;
621 static volatile int p_inited = 0;
622 static OrcCode *c = 0;
623 void (*func) (OrcExecutor *);
626 orc_once_mutex_lock ();
630 p = orc_program_new ();
631 orc_program_set_name (p, "adder_orc_add_uint16");
632 orc_program_set_backup_function (p, _backup_adder_orc_add_uint16);
633 orc_program_add_destination (p, 2, "d1");
634 orc_program_add_source (p, 2, "s1");
636 orc_program_append_2 (p, "addusw", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
639 orc_program_compile (p);
640 c = orc_program_take_code (p);
641 orc_program_free (p);
644 orc_once_mutex_unlock ();
646 ex->arrays[ORC_VAR_A2] = c;
650 ex->arrays[ORC_VAR_D1] = d1;
651 ex->arrays[ORC_VAR_S1] = (void *) s1;
659 /* adder_orc_add_uint8 */
662 adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
666 orc_int8 *ORC_RESTRICT ptr0;
667 const orc_int8 *ORC_RESTRICT ptr4;
672 ptr0 = (orc_int8 *) d1;
673 ptr4 = (orc_int8 *) s1;
676 for (i = 0; i < n; i++) {
682 var34 = ORC_CLAMP_UB ((orc_uint8) var32 + (orc_uint8) var33);
691 _backup_adder_orc_add_uint8 (OrcExecutor * ORC_RESTRICT ex)
695 orc_int8 *ORC_RESTRICT ptr0;
696 const orc_int8 *ORC_RESTRICT ptr4;
701 ptr0 = (orc_int8 *) ex->arrays[0];
702 ptr4 = (orc_int8 *) ex->arrays[4];
705 for (i = 0; i < n; i++) {
711 var34 = ORC_CLAMP_UB ((orc_uint8) var32 + (orc_uint8) var33);
719 adder_orc_add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
722 OrcExecutor _ex, *ex = &_ex;
723 static volatile int p_inited = 0;
724 static OrcCode *c = 0;
725 void (*func) (OrcExecutor *);
728 orc_once_mutex_lock ();
732 p = orc_program_new ();
733 orc_program_set_name (p, "adder_orc_add_uint8");
734 orc_program_set_backup_function (p, _backup_adder_orc_add_uint8);
735 orc_program_add_destination (p, 1, "d1");
736 orc_program_add_source (p, 1, "s1");
738 orc_program_append_2 (p, "addusb", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
741 orc_program_compile (p);
742 c = orc_program_take_code (p);
743 orc_program_free (p);
746 orc_once_mutex_unlock ();
748 ex->arrays[ORC_VAR_A2] = c;
752 ex->arrays[ORC_VAR_D1] = d1;
753 ex->arrays[ORC_VAR_S1] = (void *) s1;
761 /* adder_orc_add_float32 */
764 adder_orc_add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1,
768 orc_union32 *ORC_RESTRICT ptr0;
769 const orc_union32 *ORC_RESTRICT ptr4;
774 ptr0 = (orc_union32 *) d1;
775 ptr4 = (orc_union32 *) s1;
778 for (i = 0; i < n; i++) {
788 _src1.i = ORC_DENORMAL (var32.i);
789 _src2.i = ORC_DENORMAL (var33.i);
790 _dest1.f = _src1.f + _src2.f;
791 var34.i = ORC_DENORMAL (_dest1.i);
801 _backup_adder_orc_add_float32 (OrcExecutor * ORC_RESTRICT ex)
805 orc_union32 *ORC_RESTRICT ptr0;
806 const orc_union32 *ORC_RESTRICT ptr4;
811 ptr0 = (orc_union32 *) ex->arrays[0];
812 ptr4 = (orc_union32 *) ex->arrays[4];
815 for (i = 0; i < n; i++) {
825 _src1.i = ORC_DENORMAL (var32.i);
826 _src2.i = ORC_DENORMAL (var33.i);
827 _dest1.f = _src1.f + _src2.f;
828 var34.i = ORC_DENORMAL (_dest1.i);
837 adder_orc_add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1,
840 OrcExecutor _ex, *ex = &_ex;
841 static volatile int p_inited = 0;
842 static OrcCode *c = 0;
843 void (*func) (OrcExecutor *);
846 orc_once_mutex_lock ();
850 p = orc_program_new ();
851 orc_program_set_name (p, "adder_orc_add_float32");
852 orc_program_set_backup_function (p, _backup_adder_orc_add_float32);
853 orc_program_add_destination (p, 4, "d1");
854 orc_program_add_source (p, 4, "s1");
856 orc_program_append_2 (p, "addf", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
859 orc_program_compile (p);
860 c = orc_program_take_code (p);
861 orc_program_free (p);
864 orc_once_mutex_unlock ();
866 ex->arrays[ORC_VAR_A2] = c;
870 ex->arrays[ORC_VAR_D1] = d1;
871 ex->arrays[ORC_VAR_S1] = (void *) s1;