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 add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1,
87 void add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1,
89 void add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1, int n);
90 void add_uint32 (guint32 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1,
92 void add_uint16 (guint16 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1,
94 void add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
96 void add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1, int n);
98 void gst_adder_orc_init (void);
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 */
148 add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1, int n)
151 orc_union32 *ORC_RESTRICT ptr0;
152 const orc_union32 *ORC_RESTRICT ptr4;
157 ptr0 = (orc_union32 *) d1;
158 ptr4 = (orc_union32 *) s1;
161 for (i = 0; i < n; i++) {
167 var34.i = ORC_CLAMP_SL ((orc_int64) var32.i + (orc_int64) var33.i);
176 _backup_add_int32 (OrcExecutor * ORC_RESTRICT ex)
180 orc_union32 *ORC_RESTRICT ptr0;
181 const orc_union32 *ORC_RESTRICT ptr4;
186 ptr0 = (orc_union32 *) ex->arrays[0];
187 ptr4 = (orc_union32 *) ex->arrays[4];
190 for (i = 0; i < n; i++) {
196 var34.i = ORC_CLAMP_SL ((orc_int64) var32.i + (orc_int64) var33.i);
203 static OrcProgram *_orc_program_add_int32;
205 add_int32 (gint32 * ORC_RESTRICT d1, const gint32 * ORC_RESTRICT s1, int n)
207 OrcExecutor _ex, *ex = &_ex;
208 OrcProgram *p = _orc_program_add_int32;
209 void (*func) (OrcExecutor *);
214 ex->arrays[ORC_VAR_D1] = d1;
215 ex->arrays[ORC_VAR_S1] = (void *) s1;
226 add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1, int n)
229 orc_union16 *ORC_RESTRICT ptr0;
230 const orc_union16 *ORC_RESTRICT ptr4;
235 ptr0 = (orc_union16 *) d1;
236 ptr4 = (orc_union16 *) s1;
239 for (i = 0; i < n; i++) {
245 var34.i = ORC_CLAMP_SW (var32.i + var33.i);
254 _backup_add_int16 (OrcExecutor * ORC_RESTRICT ex)
258 orc_union16 *ORC_RESTRICT ptr0;
259 const orc_union16 *ORC_RESTRICT ptr4;
264 ptr0 = (orc_union16 *) ex->arrays[0];
265 ptr4 = (orc_union16 *) ex->arrays[4];
268 for (i = 0; i < n; i++) {
274 var34.i = ORC_CLAMP_SW (var32.i + var33.i);
281 static OrcProgram *_orc_program_add_int16;
283 add_int16 (gint16 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1, int n)
285 OrcExecutor _ex, *ex = &_ex;
286 OrcProgram *p = _orc_program_add_int16;
287 void (*func) (OrcExecutor *);
292 ex->arrays[ORC_VAR_D1] = d1;
293 ex->arrays[ORC_VAR_S1] = (void *) s1;
304 add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1, int n)
307 orc_int8 *ORC_RESTRICT ptr0;
308 const orc_int8 *ORC_RESTRICT ptr4;
313 ptr0 = (orc_int8 *) d1;
314 ptr4 = (orc_int8 *) s1;
317 for (i = 0; i < n; i++) {
323 var34 = ORC_CLAMP_SB (var32 + var33);
332 _backup_add_int8 (OrcExecutor * ORC_RESTRICT ex)
336 orc_int8 *ORC_RESTRICT ptr0;
337 const orc_int8 *ORC_RESTRICT ptr4;
342 ptr0 = (orc_int8 *) ex->arrays[0];
343 ptr4 = (orc_int8 *) ex->arrays[4];
346 for (i = 0; i < n; i++) {
352 var34 = ORC_CLAMP_SB (var32 + var33);
359 static OrcProgram *_orc_program_add_int8;
361 add_int8 (gint8 * ORC_RESTRICT d1, const gint8 * ORC_RESTRICT s1, int n)
363 OrcExecutor _ex, *ex = &_ex;
364 OrcProgram *p = _orc_program_add_int8;
365 void (*func) (OrcExecutor *);
370 ex->arrays[ORC_VAR_D1] = d1;
371 ex->arrays[ORC_VAR_S1] = (void *) s1;
382 add_uint32 (guint32 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n)
385 orc_union32 *ORC_RESTRICT ptr0;
386 const orc_union32 *ORC_RESTRICT ptr4;
391 ptr0 = (orc_union32 *) d1;
392 ptr4 = (orc_union32 *) s1;
395 for (i = 0; i < n; i++) {
402 ORC_CLAMP_UL ((orc_int64) (orc_uint32) var32.i +
403 (orc_int64) (orc_uint32) var33.i);
412 _backup_add_uint32 (OrcExecutor * ORC_RESTRICT ex)
416 orc_union32 *ORC_RESTRICT ptr0;
417 const orc_union32 *ORC_RESTRICT ptr4;
422 ptr0 = (orc_union32 *) ex->arrays[0];
423 ptr4 = (orc_union32 *) ex->arrays[4];
426 for (i = 0; i < n; i++) {
433 ORC_CLAMP_UL ((orc_int64) (orc_uint32) var32.i +
434 (orc_int64) (orc_uint32) var33.i);
441 static OrcProgram *_orc_program_add_uint32;
443 add_uint32 (guint32 * ORC_RESTRICT d1, const guint32 * ORC_RESTRICT s1, int n)
445 OrcExecutor _ex, *ex = &_ex;
446 OrcProgram *p = _orc_program_add_uint32;
447 void (*func) (OrcExecutor *);
452 ex->arrays[ORC_VAR_D1] = d1;
453 ex->arrays[ORC_VAR_S1] = (void *) s1;
464 add_uint16 (guint16 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n)
467 orc_union16 *ORC_RESTRICT ptr0;
468 const orc_union16 *ORC_RESTRICT ptr4;
473 ptr0 = (orc_union16 *) d1;
474 ptr4 = (orc_union16 *) s1;
477 for (i = 0; i < n; i++) {
483 var34.i = ORC_CLAMP_UW ((orc_uint16) var32.i + (orc_uint16) var33.i);
492 _backup_add_uint16 (OrcExecutor * ORC_RESTRICT ex)
496 orc_union16 *ORC_RESTRICT ptr0;
497 const orc_union16 *ORC_RESTRICT ptr4;
502 ptr0 = (orc_union16 *) ex->arrays[0];
503 ptr4 = (orc_union16 *) ex->arrays[4];
506 for (i = 0; i < n; i++) {
512 var34.i = ORC_CLAMP_UW ((orc_uint16) var32.i + (orc_uint16) var33.i);
519 static OrcProgram *_orc_program_add_uint16;
521 add_uint16 (guint16 * ORC_RESTRICT d1, const guint16 * ORC_RESTRICT s1, int n)
523 OrcExecutor _ex, *ex = &_ex;
524 OrcProgram *p = _orc_program_add_uint16;
525 void (*func) (OrcExecutor *);
530 ex->arrays[ORC_VAR_D1] = d1;
531 ex->arrays[ORC_VAR_S1] = (void *) s1;
542 add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n)
545 orc_int8 *ORC_RESTRICT ptr0;
546 const orc_int8 *ORC_RESTRICT ptr4;
551 ptr0 = (orc_int8 *) d1;
552 ptr4 = (orc_int8 *) s1;
555 for (i = 0; i < n; i++) {
561 var34 = ORC_CLAMP_UB ((orc_uint8) var32 + (orc_uint8) var33);
570 _backup_add_uint8 (OrcExecutor * ORC_RESTRICT ex)
574 orc_int8 *ORC_RESTRICT ptr0;
575 const orc_int8 *ORC_RESTRICT ptr4;
580 ptr0 = (orc_int8 *) ex->arrays[0];
581 ptr4 = (orc_int8 *) ex->arrays[4];
584 for (i = 0; i < n; i++) {
590 var34 = ORC_CLAMP_UB ((orc_uint8) var32 + (orc_uint8) var33);
597 static OrcProgram *_orc_program_add_uint8;
599 add_uint8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n)
601 OrcExecutor _ex, *ex = &_ex;
602 OrcProgram *p = _orc_program_add_uint8;
603 void (*func) (OrcExecutor *);
608 ex->arrays[ORC_VAR_D1] = d1;
609 ex->arrays[ORC_VAR_S1] = (void *) s1;
620 add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1, int n)
623 orc_union32 *ORC_RESTRICT ptr0;
624 const orc_union32 *ORC_RESTRICT ptr4;
629 ptr0 = (orc_union32 *) d1;
630 ptr4 = (orc_union32 *) s1;
633 for (i = 0; i < n; i++) {
643 _src1.i = ORC_DENORMAL (var32.i);
644 _src2.i = ORC_DENORMAL (var33.i);
645 _dest1.f = _src1.f + _src2.f;
646 var34.i = ORC_DENORMAL (_dest1.i);
656 _backup_add_float32 (OrcExecutor * ORC_RESTRICT ex)
660 orc_union32 *ORC_RESTRICT ptr0;
661 const orc_union32 *ORC_RESTRICT ptr4;
666 ptr0 = (orc_union32 *) ex->arrays[0];
667 ptr4 = (orc_union32 *) ex->arrays[4];
670 for (i = 0; i < n; i++) {
680 _src1.i = ORC_DENORMAL (var32.i);
681 _src2.i = ORC_DENORMAL (var33.i);
682 _dest1.f = _src1.f + _src2.f;
683 var34.i = ORC_DENORMAL (_dest1.i);
691 static OrcProgram *_orc_program_add_float32;
693 add_float32 (float *ORC_RESTRICT d1, const float *ORC_RESTRICT s1, int n)
695 OrcExecutor _ex, *ex = &_ex;
696 OrcProgram *p = _orc_program_add_float32;
697 void (*func) (OrcExecutor *);
702 ex->arrays[ORC_VAR_D1] = d1;
703 ex->arrays[ORC_VAR_S1] = (void *) s1;
712 gst_adder_orc_init (void)
719 p = orc_program_new ();
720 orc_program_set_name (p, "add_int32");
721 orc_program_set_backup_function (p, _backup_add_int32);
722 orc_program_add_destination (p, 4, "d1");
723 orc_program_add_source (p, 4, "s1");
725 orc_program_append_2 (p, "addssl", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
728 orc_program_compile (p);
730 _orc_program_add_int32 = p;
736 p = orc_program_new ();
737 orc_program_set_name (p, "add_int16");
738 orc_program_set_backup_function (p, _backup_add_int16);
739 orc_program_add_destination (p, 2, "d1");
740 orc_program_add_source (p, 2, "s1");
742 orc_program_append_2 (p, "addssw", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
745 orc_program_compile (p);
747 _orc_program_add_int16 = p;
753 p = orc_program_new ();
754 orc_program_set_name (p, "add_int8");
755 orc_program_set_backup_function (p, _backup_add_int8);
756 orc_program_add_destination (p, 1, "d1");
757 orc_program_add_source (p, 1, "s1");
759 orc_program_append_2 (p, "addssb", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
762 orc_program_compile (p);
764 _orc_program_add_int8 = p;
770 p = orc_program_new ();
771 orc_program_set_name (p, "add_uint32");
772 orc_program_set_backup_function (p, _backup_add_uint32);
773 orc_program_add_destination (p, 4, "d1");
774 orc_program_add_source (p, 4, "s1");
776 orc_program_append_2 (p, "addusl", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
779 orc_program_compile (p);
781 _orc_program_add_uint32 = p;
787 p = orc_program_new ();
788 orc_program_set_name (p, "add_uint16");
789 orc_program_set_backup_function (p, _backup_add_uint16);
790 orc_program_add_destination (p, 2, "d1");
791 orc_program_add_source (p, 2, "s1");
793 orc_program_append_2 (p, "addusw", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
796 orc_program_compile (p);
798 _orc_program_add_uint16 = p;
804 p = orc_program_new ();
805 orc_program_set_name (p, "add_uint8");
806 orc_program_set_backup_function (p, _backup_add_uint8);
807 orc_program_add_destination (p, 1, "d1");
808 orc_program_add_source (p, 1, "s1");
810 orc_program_append_2 (p, "addusb", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
813 orc_program_compile (p);
815 _orc_program_add_uint8 = p;
821 p = orc_program_new ();
822 orc_program_set_name (p, "add_float32");
823 orc_program_set_backup_function (p, _backup_add_float32);
824 orc_program_add_destination (p, 4, "d1");
825 orc_program_add_source (p, 4, "s1");
827 orc_program_append_2 (p, "addf", 0, ORC_VAR_D1, ORC_VAR_D1, ORC_VAR_S1,
830 orc_program_compile (p);
832 _orc_program_add_float32 = p;