| 1 |
|
| 2 |
/* autogenerated from orcfunctions.orc */ |
| 3 |
|
| 4 |
#ifdef HAVE_CONFIG_H |
| 5 |
#include "config.h" |
| 6 |
#endif |
| 7 |
|
| 8 |
#ifndef _ORC_INTEGER_TYPEDEFS_ |
| 9 |
#define _ORC_INTEGER_TYPEDEFS_ |
| 10 |
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 11 |
#include <stdint.h> |
| 12 |
typedef int8_t orc_int8; |
| 13 |
typedef int16_t orc_int16; |
| 14 |
typedef int32_t orc_int32; |
| 15 |
typedef int64_t orc_int64; |
| 16 |
typedef uint8_t orc_uint8; |
| 17 |
typedef uint16_t orc_uint16; |
| 18 |
typedef uint32_t orc_uint32; |
| 19 |
typedef uint64_t orc_uint64; |
| 20 |
#define ORC_UINT64_C(x) UINT64_C(x) |
| 21 |
#elif defined(_MSC_VER) |
| 22 |
typedef signed __int8 orc_int8; |
| 23 |
typedef signed __int16 orc_int16; |
| 24 |
typedef signed __int32 orc_int32; |
| 25 |
typedef signed __int64 orc_int64; |
| 26 |
typedef unsigned __int8 orc_uint8; |
| 27 |
typedef unsigned __int16 orc_uint16; |
| 28 |
typedef unsigned __int32 orc_uint32; |
| 29 |
typedef unsigned __int64 orc_uint64; |
| 30 |
#define ORC_UINT64_C(x) (x##Ui64) |
| 31 |
#define inline __inline |
| 32 |
#else |
| 33 |
#include <limits.h> |
| 34 |
typedef signed char orc_int8; |
| 35 |
typedef short orc_int16; |
| 36 |
typedef int orc_int32; |
| 37 |
typedef unsigned char orc_uint8; |
| 38 |
typedef unsigned short orc_uint16; |
| 39 |
typedef unsigned int orc_uint32; |
| 40 |
#if INT_MAX == LONG_MAX |
| 41 |
typedef long long orc_int64; |
| 42 |
typedef unsigned long long orc_uint64; |
| 43 |
#define ORC_UINT64_C(x) (x##ULL) |
| 44 |
#else |
| 45 |
typedef long orc_int64; |
| 46 |
typedef unsigned long orc_uint64; |
| 47 |
#define ORC_UINT64_C(x) (x##UL) |
| 48 |
#endif |
| 49 |
#endif |
| 50 |
typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16; |
| 51 |
typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32; |
| 52 |
typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; orc_int8 x8[8]; } orc_union64; |
| 53 |
#endif |
| 54 |
#ifndef ORC_RESTRICT |
| 55 |
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 56 |
#define ORC_RESTRICT restrict |
| 57 |
#elif defined(__GNUC__) && __GNUC__ >= 4 |
| 58 |
#define ORC_RESTRICT __restrict__ |
| 59 |
#elif defined(_MSC_VER) |
| 60 |
#define ORC_RESTRICT __restrict |
| 61 |
#else |
| 62 |
#define ORC_RESTRICT |
| 63 |
#endif |
| 64 |
#endif |
| 65 |
|
| 66 |
#ifndef ORC_INTERNAL |
| 67 |
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) |
| 68 |
#define ORC_INTERNAL __attribute__((visibility("hidden"))) |
| 69 |
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) |
| 70 |
#define ORC_INTERNAL __hidden |
| 71 |
#elif defined (__GNUC__) |
| 72 |
#define ORC_INTERNAL __attribute__((visibility("hidden"))) |
| 73 |
#else |
| 74 |
#define ORC_INTERNAL |
| 75 |
#endif |
| 76 |
#endif |
| 77 |
|
| 78 |
|
| 79 |
#ifndef DISABLE_ORC |
| 80 |
#include <orc/orc.h> |
| 81 |
#endif |
| 82 |
void orc_memcpy (void * ORC_RESTRICT d1, const void * ORC_RESTRICT s1, int n); |
| 83 |
void orc_memset (void * ORC_RESTRICT d1, int p1, int n); |
| 84 |
|
| 85 |
|
| 86 |
/* begin Orc C target preamble */ |
| 87 |
#include <math.h> |
| 88 |
#define ORC_CLAMP_U(x,a,b) (((x)>(b) ? (b) : (x))) |
| 89 |
#define ORC_CLAMP_S(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x))) |
| 90 |
#define ORC_ABS(a) ((a)<0 ? -(a) : (a)) |
| 91 |
#define ORC_MIN(a,b) ((a)<(b) ? (a) : (b)) |
| 92 |
#define ORC_MAX(a,b) ((a)>(b) ? (a) : (b)) |
| 93 |
#define ORC_SB_MAX 127 |
| 94 |
#define ORC_SB_MIN (-1-ORC_SB_MAX) |
| 95 |
#define ORC_UB_MAX (orc_uint8) 255 |
| 96 |
#define ORC_UB_MIN 0 |
| 97 |
#define ORC_SW_MAX 32767 |
| 98 |
#define ORC_SW_MIN (-1-ORC_SW_MAX) |
| 99 |
#define ORC_UW_MAX (orc_uint16)65535 |
| 100 |
#define ORC_UW_MIN 0 |
| 101 |
#define ORC_SL_MAX 2147483647 |
| 102 |
#define ORC_SL_MIN (-1-ORC_SL_MAX) |
| 103 |
#define ORC_UL_MAX 4294967295U |
| 104 |
#define ORC_UL_MIN 0 |
| 105 |
#define ORC_CLAMP_SB(x) ORC_CLAMP_S(x,ORC_SB_MIN,ORC_SB_MAX) |
| 106 |
#define ORC_CLAMP_UB(x) ORC_CLAMP_U(x,ORC_UB_MIN,ORC_UB_MAX) |
| 107 |
#define ORC_CLAMP_SW(x) ORC_CLAMP_S(x,ORC_SW_MIN,ORC_SW_MAX) |
| 108 |
#define ORC_CLAMP_UW(x) ORC_CLAMP_U(x,ORC_UW_MIN,ORC_UW_MAX) |
| 109 |
#define ORC_CLAMP_SL(x) ORC_CLAMP_S(x,ORC_SL_MIN,ORC_SL_MAX) |
| 110 |
#define ORC_CLAMP_UL(x) ORC_CLAMP_U(x,ORC_UL_MIN,ORC_UL_MAX) |
| 111 |
#define ORC_SWAP_W(x) ((((x)&0xffU)<<8) | (((x)&0xff00U)>>8)) |
| 112 |
#define ORC_SWAP_L(x) ((((x)&0xffU)<<24) | (((x)&0xff00U)<<8) | (((x)&0xff0000U)>>8) | (((x)&0xff000000U)>>24)) |
| 113 |
#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)) |
| 114 |
#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset))) |
| 115 |
#define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff)) |
| 116 |
#define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0)) |
| 117 |
#define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff))) |
| 118 |
#define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0)) |
| 119 |
#ifndef ORC_RESTRICT |
| 120 |
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 121 |
#define ORC_RESTRICT restrict |
| 122 |
#elif defined(__GNUC__) && __GNUC__ >= 4 |
| 123 |
#define ORC_RESTRICT __restrict__ |
| 124 |
#elif defined(_MSC_VER) |
| 125 |
#define ORC_RESTRICT __restrict |
| 126 |
#else |
| 127 |
#define ORC_RESTRICT |
| 128 |
#endif |
| 129 |
#endif |
| 130 |
/* end Orc C target preamble */ |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
/* orc_memcpy */ |
| 135 |
#ifdef DISABLE_ORC |
| 136 |
void |
| 137 |
orc_memcpy (void * ORC_RESTRICT d1, const void * ORC_RESTRICT s1, int n){ |
| 138 |
int i; |
| 139 |
orc_int8 * ORC_RESTRICT ptr0; |
| 140 |
const orc_int8 * ORC_RESTRICT ptr4; |
| 141 |
orc_int8 var32; |
| 142 |
orc_int8 var33; |
| 143 |
|
| 144 |
ptr0 = (orc_int8 *)d1; |
| 145 |
ptr4 = (orc_int8 *)s1; |
| 146 |
|
| 147 |
|
| 148 |
for (i = 0; i < n; i++) { |
| 149 |
/* 0: loadb */ |
| 150 |
var32 = ptr4[i]; |
| 151 |
/* 1: copyb */ |
| 152 |
var33 = var32; |
| 153 |
/* 2: storeb */ |
| 154 |
ptr0[i] = var33; |
| 155 |
} |
| 156 |
|
| 157 |
} |
| 158 |
|
| 159 |
#else |
| 160 |
static void |
| 161 |
_backup_orc_memcpy (OrcExecutor * ORC_RESTRICT ex) |
| 162 |
{ |
| 163 |
int i; |
| 164 |
int n = ex->n; |
| 165 |
orc_int8 * ORC_RESTRICT ptr0; |
| 166 |
const orc_int8 * ORC_RESTRICT ptr4; |
| 167 |
orc_int8 var32; |
| 168 |
orc_int8 var33; |
| 169 |
|
| 170 |
ptr0 = (orc_int8 *)ex->arrays[0]; |
| 171 |
ptr4 = (orc_int8 *)ex->arrays[4]; |
| 172 |
|
| 173 |
|
| 174 |
for (i = 0; i < n; i++) { |
| 175 |
/* 0: loadb */ |
| 176 |
var32 = ptr4[i]; |
| 177 |
/* 1: copyb */ |
| 178 |
var33 = var32; |
| 179 |
/* 2: storeb */ |
| 180 |
ptr0[i] = var33; |
| 181 |
} |
| 182 |
|
| 183 |
} |
| 184 |
|
| 185 |
void |
| 186 |
orc_memcpy (void * ORC_RESTRICT d1, const void * ORC_RESTRICT s1, int n) |
| 187 |
{ |
| 188 |
OrcExecutor _ex, *ex = &_ex; |
| 189 |
static OrcOnce once = ORC_ONCE_INIT; |
| 190 |
OrcCode *c; |
| 191 |
OrcExecutorFunc func = NULL; |
| 192 |
|
| 193 |
if (!orc_once_enter (&once, (void **) &c)) { |
| 194 |
OrcProgram *p; |
| 195 |
|
| 196 |
#if 1 |
| 197 |
static const orc_uint8 bc[] = { |
| 198 |
1, 9, 10, 111, 114, 99, 95, 109, 101, 109, 99, 112, 121, 11, 1, 1, |
| 199 |
12, 1, 1, 42, 0, 4, 2, 0, |
| 200 |
}; |
| 201 |
p = orc_program_new_from_static_bytecode (bc); |
| 202 |
orc_program_set_backup_function (p, _backup_orc_memcpy); |
| 203 |
#else |
| 204 |
p = orc_program_new (); |
| 205 |
orc_program_set_name (p, "orc_memcpy"); |
| 206 |
orc_program_set_backup_function (p, _backup_orc_memcpy); |
| 207 |
orc_program_add_destination (p, 1, "d1"); |
| 208 |
orc_program_add_source (p, 1, "s1"); |
| 209 |
|
| 210 |
orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); |
| 211 |
#endif |
| 212 |
|
| 213 |
orc_program_compile (p); |
| 214 |
c = orc_program_take_code (p); |
| 215 |
orc_program_free (p); |
| 216 |
orc_once_leave (&once, c); |
| 217 |
} |
| 218 |
ex->arrays[ORC_VAR_A2] = c; |
| 219 |
ex->program = 0; |
| 220 |
|
| 221 |
ex->n = n; |
| 222 |
ex->arrays[ORC_VAR_D1] = d1; |
| 223 |
ex->arrays[ORC_VAR_S1] = (void *)s1; |
| 224 |
|
| 225 |
func = c->exec; |
| 226 |
func (ex); |
| 227 |
} |
| 228 |
#endif |
| 229 |
|
| 230 |
|
| 231 |
/* orc_memset */ |
| 232 |
#ifdef DISABLE_ORC |
| 233 |
void |
| 234 |
orc_memset (void * ORC_RESTRICT d1, int p1, int n){ |
| 235 |
int i; |
| 236 |
orc_int8 * ORC_RESTRICT ptr0; |
| 237 |
orc_int8 var32; |
| 238 |
orc_int8 var33; |
| 239 |
|
| 240 |
ptr0 = (orc_int8 *)d1; |
| 241 |
|
| 242 |
/* 0: loadpb */ |
| 243 |
var32 = p1; |
| 244 |
|
| 245 |
for (i = 0; i < n; i++) { |
| 246 |
/* 1: copyb */ |
| 247 |
var33 = var32; |
| 248 |
/* 2: storeb */ |
| 249 |
ptr0[i] = var33; |
| 250 |
} |
| 251 |
|
| 252 |
} |
| 253 |
|
| 254 |
#else |
| 255 |
static void |
| 256 |
_backup_orc_memset (OrcExecutor * ORC_RESTRICT ex) |
| 257 |
{ |
| 258 |
int i; |
| 259 |
int n = ex->n; |
| 260 |
orc_int8 * ORC_RESTRICT ptr0; |
| 261 |
orc_int8 var32; |
| 262 |
orc_int8 var33; |
| 263 |
|
| 264 |
ptr0 = (orc_int8 *)ex->arrays[0]; |
| 265 |
|
| 266 |
/* 0: loadpb */ |
| 267 |
var32 = ex->params[24]; |
| 268 |
|
| 269 |
for (i = 0; i < n; i++) { |
| 270 |
/* 1: copyb */ |
| 271 |
var33 = var32; |
| 272 |
/* 2: storeb */ |
| 273 |
ptr0[i] = var33; |
| 274 |
} |
| 275 |
|
| 276 |
} |
| 277 |
|
| 278 |
void |
| 279 |
orc_memset (void * ORC_RESTRICT d1, int p1, int n) |
| 280 |
{ |
| 281 |
OrcExecutor _ex, *ex = &_ex; |
| 282 |
static OrcOnce once = ORC_ONCE_INIT; |
| 283 |
OrcCode *c; |
| 284 |
OrcExecutorFunc func = NULL; |
| 285 |
|
| 286 |
if (!orc_once_enter (&once, (void **) &c)) { |
| 287 |
OrcProgram *p; |
| 288 |
|
| 289 |
#if 1 |
| 290 |
static const orc_uint8 bc[] = { |
| 291 |
1, 9, 10, 111, 114, 99, 95, 109, 101, 109, 115, 101, 116, 11, 1, 1, |
| 292 |
16, 1, 42, 0, 24, 2, 0, |
| 293 |
}; |
| 294 |
p = orc_program_new_from_static_bytecode (bc); |
| 295 |
orc_program_set_backup_function (p, _backup_orc_memset); |
| 296 |
#else |
| 297 |
p = orc_program_new (); |
| 298 |
orc_program_set_name (p, "orc_memset"); |
| 299 |
orc_program_set_backup_function (p, _backup_orc_memset); |
| 300 |
orc_program_add_destination (p, 1, "d1"); |
| 301 |
orc_program_add_parameter (p, 1, "p1"); |
| 302 |
|
| 303 |
orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_P1, ORC_VAR_D1, ORC_VAR_D1); |
| 304 |
#endif |
| 305 |
|
| 306 |
orc_program_compile (p); |
| 307 |
c = orc_program_take_code (p); |
| 308 |
orc_program_free (p); |
| 309 |
orc_once_leave (&once, c); |
| 310 |
} |
| 311 |
ex->arrays[ORC_VAR_A2] = c; |
| 312 |
ex->program = 0; |
| 313 |
|
| 314 |
ex->n = n; |
| 315 |
ex->arrays[ORC_VAR_D1] = d1; |
| 316 |
ex->params[ORC_VAR_P1] = p1; |
| 317 |
|
| 318 |
func = c->exec; |
| 319 |
func (ex); |
| 320 |
} |
| 321 |
#endif |
| 322 |
|
| 323 |
|