AC_C_BIGENDIAN
-AX_CREATE_STDINT_H([orc/orc-stdint.h])
-
AC_FUNC_MMAP()
AC_CHECK_HEADERS([inttypes.h])
#define N 10
-int16_t a[N];
-int16_t b[N];
-int16_t c[N];
+orc_int16 a[N];
+orc_int16 b[N];
+orc_int16 c[N];
-void add_s16(int16_t *dest, int16_t *src1, int16_t *src2, int n);
+void add_s16(orc_int16 *dest, orc_int16 *src1, orc_int16 *src2, int n);
int
}
void
-add_s16(int16_t *dest, int16_t *src1, int16_t *src2, int n)
+add_s16(orc_int16 *dest, orc_int16 *src1, orc_int16 *src2, int n)
{
static OrcProgram *p = NULL;
OrcExecutor _ex;
/* mag01[x] = x * MATRIX_A for x=0,1 */
-static const uint32_t mag01[2]={0x0UL, MATRIX_A};
+static const orc_uint32 mag01[2]={0x0UL, MATRIX_A};
void
-mt19937_ref (uint32_t *d, uint32_t *mt)
+mt19937_ref (orc_uint32 *d, orc_uint32 *mt)
{
- uint32_t y;
+ orc_uint32 y;
int kk;
for (kk=0;kk<N-M;kk++) {
static void
mulhslw (OrcOpcodeExecutor *ex, void *user)
{
- int32_t src, sl, sh, scale;
+ orc_int32 src, sl, sh, scale;
scale = ex->src_values[0];
src = ex->src_values[1];
sh = scale >> 16;
sl = scale & 0xffff;
- ex->dest_values[0] = (int32_t) ((src * sl) >> 16) + (src * sh);
+ ex->dest_values[0] = (orc_int32) ((src * sl) >> 16) + (src * sh);
}
static OrcStaticOpcode opcodes[] = {
}
static void
-do_volume_c (int16_t *dest, const int32_t *vols, const int16_t *samp, int len)
+do_volume_c (orc_int16 *dest, const orc_int32 *vols, const orc_int16 *samp, int len)
{
int i;
for (i = 0; i < len; i++) {
- int32_t t, hi, lo;
+ orc_int32 t, hi, lo;
hi = vols[i] >> 16;
lo = vols[i] & 0xffff;
- t = (int32_t)(samp[i]);
+ t = (orc_int32)(samp[i]);
t = ((t * lo) >> 16) + (t * hi);
- dest[i] = (int16_t) ORC_CLAMP (t, -0x8000, 0x7FFF);
+ dest[i] = (orc_int16) ORC_CLAMP (t, -0x8000, 0x7FFF);
}
}
static void
do_volume_backup (OrcExecutor *ex)
{
- int16_t *dest;
- int32_t *vols;
- const int16_t *samp;
+ orc_int16 *dest;
+ orc_int32 *vols;
+ const orc_int16 *samp;
int len;
dest = ex->arrays[ORC_VAR_D1];
}
static void
-do_volume_orc (int16_t *dest, int32_t *volumes, int16_t *samp, int length)
+do_volume_orc (orc_int16 *dest, orc_int32 *volumes, orc_int16 *samp, int length)
{
OrcExecutor _ex;
OrcExecutor *ex = &_ex;
orc_executor_run (ex);
}
-static uint64_t
+static orc_uint64
get_timestamp ()
{
#ifndef _MSC_VER
#define TIMES 100000
#define N 1024
-int16_t dest[N];
-int16_t samp[N];
-int32_t vols[N];
+orc_int16 dest[N];
+orc_int16 samp[N];
+orc_int32 vols[N];
int
main (int argc, char *argv[])
{
int i;
- uint64_t start, stop;
+ orc_uint64 start, stop;
/* orc_init() must be called before any other Orc function */
orc_init ();
void
orc_random_bits (OrcRandomContext *context, void *data, int n_bytes)
{
- uint8_t *d = data;
+ orc_uint8 *d = data;
int i;
for(i=0;i<n_bytes;i++){
context->x = 1103515245*context->x + 12345;
orc_test_random_bits (void *data, int n_bytes)
{
#if 1
- uint8_t *d = data;
+ orc_uint8 *d = data;
int i;
for(i=0;i<n_bytes;i++){
d[i] = rand();
switch (array->element_size) {
case 1:
- printf(" %4d", *(int8_t *)ptr);
- return *(int8_t *)ptr;
+ printf(" %4d", *(orc_int8 *)ptr);
+ return *(orc_int8 *)ptr;
case 2:
- printf(" %5d", *(int16_t *)ptr);
- return *(int16_t *)ptr;
+ printf(" %5d", *(orc_int16 *)ptr);
+ return *(orc_int16 *)ptr;
case 4:
- printf(" %10d", *(int32_t *)ptr);
- return *(int32_t *)ptr;
+ printf(" %10d", *(orc_int32 *)ptr);
+ return *(orc_int32 *)ptr;
case 8:
- printf(" %20lld", (long long)*(int64_t *)ptr);
- return *(int64_t *)ptr;
+ printf(" %20lld", (long long)*(orc_int64 *)ptr);
+ return *(orc_int64 *)ptr;
default:
return -1;
}
switch (array->element_size) {
case 1:
- printf(" %4u", *(uint8_t *)ptr);
- return *(int8_t *)ptr;
+ printf(" %4u", *(orc_uint8 *)ptr);
+ return *(orc_int8 *)ptr;
case 2:
- printf(" %5u", *(uint16_t *)ptr);
- return *(int16_t *)ptr;
+ printf(" %5u", *(orc_uint16 *)ptr);
+ return *(orc_int16 *)ptr;
case 4:
- printf(" %10u", *(uint32_t *)ptr);
- return *(int32_t *)ptr;
+ printf(" %10u", *(orc_uint32 *)ptr);
+ return *(orc_int32 *)ptr;
case 8:
- printf(" %20llu", (long long)*(uint64_t *)ptr);
- return *(int64_t *)ptr;
+ printf(" %20llu", (long long)*(orc_uint64 *)ptr);
+ return *(orc_int64 *)ptr;
default:
return -1;
}
switch (array->element_size) {
case 1:
- printf(" %02x", *(uint8_t *)ptr);
- return *(int8_t *)ptr;
+ printf(" %02x", *(orc_uint8 *)ptr);
+ return *(orc_int8 *)ptr;
case 2:
- printf(" %04x", *(uint16_t *)ptr);
- return *(int16_t *)ptr;
+ printf(" %04x", *(orc_uint16 *)ptr);
+ return *(orc_int16 *)ptr;
case 4:
- printf(" %08x", *(uint32_t *)ptr);
- return *(int32_t *)ptr;
+ printf(" %08x", *(orc_uint32 *)ptr);
+ return *(orc_int32 *)ptr;
case 8:
- printf(" %016llx", (long long)*(uint64_t *)ptr);
- return *(int64_t *)ptr;
+ printf(" %016llx", (long long)*(orc_uint64 *)ptr);
+ return *(orc_int64 *)ptr;
default:
return -1;
}
switch (array->element_size) {
case 4:
if (isnan(*(float *)ptr)) {
- printf(" nan %08x", *(uint32_t *)ptr);
+ printf(" nan %08x", *(orc_uint32 *)ptr);
/* This is to get around signaling/non-signaling nans in the output */
- return (*(uint32_t *)ptr) & 0xffbfffff;
+ return (*(orc_uint32 *)ptr) & 0xffbfffff;
} else {
printf(" %12.5g", *(float *)ptr);
- return *(int32_t *)ptr;
+ return *(orc_int32 *)ptr;
}
case 8:
printf(" %12.5g", *(double *)ptr);
- return *(int64_t *)ptr;
+ return *(orc_int64 *)ptr;
default:
printf(" ERROR");
return -1;
orcpowerpc.h \
orcarm.h
-nodist_pkginclude_HEADERS = orc-stdint.h
-
-DISTCLEANFILES = orc-stdint.h
-
-
-
orcfunctions:
$(top_builddir)/tools/orcc$(EXEEXT) --implementation -o orcfunctions.c orcfunctions.orc
$(top_builddir)/tools/orcc$(EXEEXT) --header -o orcfunctions.h orcfunctions.orc
UNARY_SB(absb, "ORC_ABS(%s)")
BINARY_SB(addb, "%s + %s")
BINARY_SB(addssb, "ORC_CLAMP_SB(%s + %s)")
-BINARY_UB(addusb, "ORC_CLAMP_UB((uint8_t)%s + (uint8_t)%s)")
+BINARY_UB(addusb, "ORC_CLAMP_UB((orc_uint8)%s + (orc_uint8)%s)")
BINARY_SB(andb, "%s & %s")
BINARY_SB(andnb, "(~%s) & %s")
BINARY_SB(avgsb, "(%s + %s + 1)>>1")
-BINARY_UB(avgub, "((uint8_t)%s + (uint8_t)%s + 1)>>1")
+BINARY_UB(avgub, "((orc_uint8)%s + (orc_uint8)%s + 1)>>1")
BINARY_SB(cmpeqb, "(%s == %s) ? (~0) : 0")
BINARY_SB(cmpgtsb, "(%s > %s) ? (~0) : 0")
UNARY_SB(copyb, "%s")
BINARY_SB(maxsb, "ORC_MAX(%s, %s)")
-BINARY_UB(maxub, "ORC_MAX((uint8_t)%s, (uint8_t)%s)")
+BINARY_UB(maxub, "ORC_MAX((orc_uint8)%s, (orc_uint8)%s)")
BINARY_SB(minsb, "ORC_MIN(%s, %s)")
-BINARY_UB(minub, "ORC_MIN((uint8_t)%s, (uint8_t)%s)")
+BINARY_UB(minub, "ORC_MIN((orc_uint8)%s, (orc_uint8)%s)")
BINARY_SB(mullb, "(%s * %s) & 0xff")
BINARY_SB(mulhsb, "(%s * %s) >> 8")
-BINARY_UB(mulhub, "((uint32_t)(uint8_t)%s * (uint32_t)(uint8_t)%s) >> 8")
+BINARY_UB(mulhub, "((orc_uint32)(orc_uint8)%s * (orc_uint32)(orc_uint8)%s) >> 8")
BINARY_SB(orb, "%s | %s")
BINARY_SB(shlb, "%s << %s")
BINARY_SB(shrsb, "%s >> %s")
-BINARY_UB(shrub, "((uint8_t)%s) >> %s")
+BINARY_UB(shrub, "((orc_uint8)%s) >> %s")
UNARY_SB(signb, "ORC_CLAMP(%s,-1,1)")
BINARY_SB(subb, "%s - %s")
BINARY_SB(subssb, "ORC_CLAMP_SB(%s - %s)")
-BINARY_UB(subusb, "ORC_CLAMP_UB((uint8_t)%s - (uint8_t)%s)")
+BINARY_UB(subusb, "ORC_CLAMP_UB((orc_uint8)%s - (orc_uint8)%s)")
BINARY_SB(xorb, "%s ^ %s")
UNARY_SW(absw, "ORC_ABS(%s)")
BINARY_SW(addw, "%s + %s")
BINARY_SW(addssw, "ORC_CLAMP_SW(%s + %s)")
-BINARY_UW(addusw, "ORC_CLAMP_UW((uint16_t)%s + (uint16_t)%s)")
+BINARY_UW(addusw, "ORC_CLAMP_UW((orc_uint16)%s + (orc_uint16)%s)")
BINARY_SW(andw, "%s & %s")
BINARY_SW(andnw, "(~%s) & %s")
BINARY_SW(avgsw, "(%s + %s + 1)>>1")
-BINARY_UW(avguw, "((uint16_t)%s + (uint16_t)%s + 1)>>1")
+BINARY_UW(avguw, "((orc_uint16)%s + (orc_uint16)%s + 1)>>1")
BINARY_SW(cmpeqw, "(%s == %s) ? (~0) : 0")
BINARY_SW(cmpgtsw, "(%s > %s) ? (~0) : 0")
UNARY_SW(copyw, "%s")
BINARY_SW(maxsw, "ORC_MAX(%s, %s)")
-BINARY_UW(maxuw, "ORC_MAX((uint16_t)%s, (uint16_t)%s)")
+BINARY_UW(maxuw, "ORC_MAX((orc_uint16)%s, (orc_uint16)%s)")
BINARY_SW(minsw, "ORC_MIN(%s, %s)")
-BINARY_UW(minuw, "ORC_MIN((uint16_t)%s, (uint16_t)%s)")
+BINARY_UW(minuw, "ORC_MIN((orc_uint16)%s, (orc_uint16)%s)")
BINARY_SW(mullw, "(%s * %s) & 0xffff")
BINARY_SW(mulhsw, "(%s * %s) >> 16")
-BINARY_UW(mulhuw, "((uint32_t)((uint16_t)%s) * (uint32_t)((uint16_t)%s)) >> 16")
+BINARY_UW(mulhuw, "((orc_uint32)((orc_uint16)%s) * (orc_uint32)((orc_uint16)%s)) >> 16")
BINARY_SW(orw, "%s | %s")
BINARY_SW(shlw, "%s << %s")
BINARY_SW(shrsw, "%s >> %s")
-BINARY_UW(shruw, "((uint16_t)%s) >> %s")
+BINARY_UW(shruw, "((orc_uint16)%s) >> %s")
UNARY_SW(signw, "ORC_CLAMP(%s,-1,1)")
BINARY_SW(subw, "%s - %s")
BINARY_SW(subssw, "ORC_CLAMP_SW(%s - %s)")
-BINARY_UW(subusw, "ORC_CLAMP_UW((uint16_t)%s - (uint16_t)%s)")
+BINARY_UW(subusw, "ORC_CLAMP_UW((orc_uint16)%s - (orc_uint16)%s)")
BINARY_SW(xorw, "%s ^ %s")
UNARY_SL(absl, "ORC_ABS(%s)")
BINARY_SL(addl, "%s + %s")
-BINARY_SL(addssl, "ORC_CLAMP_SL((int64_t)%s + (int64_t)%s)")
-BINARY_UL(addusl, "ORC_CLAMP_UL((int64_t)(uint32_t)%s + (int64_t)(uint32_t)%s)")
+BINARY_SL(addssl, "ORC_CLAMP_SL((orc_int64)%s + (orc_int64)%s)")
+BINARY_UL(addusl, "ORC_CLAMP_UL((orc_int64)(orc_uint32)%s + (orc_int64)(orc_uint32)%s)")
BINARY_SL(andl, "%s & %s")
BINARY_SL(andnl, "(~%s) & %s")
-BINARY_SL(avgsl, "((int64_t)%s + (int64_t)%s + 1)>>1")
-BINARY_UL(avgul, "((uint64_t)(uint32_t)%s + (uint64_t)(uint32_t)%s + 1)>>1")
+BINARY_SL(avgsl, "((orc_int64)%s + (orc_int64)%s + 1)>>1")
+BINARY_UL(avgul, "((orc_uint64)(orc_uint32)%s + (orc_uint64)(orc_uint32)%s + 1)>>1")
BINARY_SL(cmpeql, "(%s == %s) ? (~0) : 0")
BINARY_SL(cmpgtsl, "(%s > %s) ? (~0) : 0")
UNARY_SL(copyl, "%s")
BINARY_SL(maxsl, "ORC_MAX(%s, %s)")
-BINARY_UL(maxul, "ORC_MAX((uint32_t)%s, (uint32_t)%s)")
+BINARY_UL(maxul, "ORC_MAX((orc_uint32)%s, (orc_uint32)%s)")
BINARY_SL(minsl, "ORC_MIN(%s, %s)")
-BINARY_UL(minul, "ORC_MIN((uint32_t)%s, (uint32_t)%s)")
+BINARY_UL(minul, "ORC_MIN((orc_uint32)%s, (orc_uint32)%s)")
BINARY_SL(mulll, "(%s * %s) & 0xffffffff")
-BINARY_SL(mulhsl, "((int64_t)%s * (int64_t)%s) >> 32")
-BINARY_UL(mulhul, "((uint64_t)%s * (uint64_t)%s) >> 32")
+BINARY_SL(mulhsl, "((orc_int64)%s * (orc_int64)%s) >> 32")
+BINARY_UL(mulhul, "((orc_uint64)%s * (orc_uint64)%s) >> 32")
BINARY_SL(orl, "%s | %s")
BINARY_SL(shll, "%s << %s")
BINARY_SL(shrsl, "%s >> %s")
-BINARY_UL(shrul, "((uint32_t)%s) >> %s")
+BINARY_UL(shrul, "((orc_uint32)%s) >> %s")
UNARY_SL(signl, "ORC_CLAMP(%s,-1,1)")
BINARY_SL(subl, "%s - %s")
-BINARY_SL(subssl, "ORC_CLAMP_SL((int64_t)%s - (int64_t)%s)")
-BINARY_UL(subusl, "ORC_CLAMP_UL((int64_t)(uint32_t)%s - (int64_t)(uint32_t)%s)")
+BINARY_SL(subssl, "ORC_CLAMP_SL((orc_int64)%s - (orc_int64)%s)")
+BINARY_UL(subusl, "ORC_CLAMP_UL((orc_int64)(orc_uint32)%s - (orc_int64)(orc_uint32)%s)")
BINARY_SL(xorl, "%s ^ %s")
UNARY_BW(convsbw, "%s")
-UNARY_BW(convubw, "(uint8_t)%s")
+UNARY_BW(convubw, "(orc_uint8)%s")
UNARY_WL(convswl, "%s")
-UNARY_WL(convuwl, "(uint16_t)%s")
+UNARY_WL(convuwl, "(orc_uint16)%s")
UNARY_WB(convwb, "%s")
UNARY_WB(convssswb, "ORC_CLAMP_SB(%s)")
UNARY_WB(convsuswb, "ORC_CLAMP_UB(%s)")
-UNARY_WB(convusswb, "ORC_CLAMP_SB((uint16_t)%s)")
-UNARY_WB(convuuswb, "ORC_CLAMP_UB((uint16_t)%s)")
+UNARY_WB(convusswb, "ORC_CLAMP_SB((orc_uint16)%s)")
+UNARY_WB(convuuswb, "ORC_CLAMP_UB((orc_uint16)%s)")
UNARY_LW(convlw, "%s")
UNARY_LW(convssslw, "ORC_CLAMP_SW(%s)")
UNARY_LW(convsuslw, "ORC_CLAMP_UW(%s)")
-UNARY_LW(convusslw, "ORC_CLAMP_SW((uint32_t)%s)")
-UNARY_LW(convuuslw, "ORC_CLAMP_UW((uint32_t)%s)")
+UNARY_LW(convusslw, "ORC_CLAMP_SW((orc_uint32)%s)")
+UNARY_LW(convuuslw, "ORC_CLAMP_UW((orc_uint32)%s)")
BINARY_BW(mulsbw, "%s * %s")
-BINARY_BW(mulubw, "(uint8_t)%s * (uint8_t)%s")
+BINARY_BW(mulubw, "(orc_uint8)%s * (orc_uint8)%s")
BINARY_WL(mulswl, "%s * %s")
-BINARY_WL(muluwl, "(uint16_t)%s * (uint16_t)%s")
+BINARY_WL(muluwl, "(orc_uint16)%s * (orc_uint16)%s")
-BINARY_WL(mergewl, "((uint16_t)%s) | ((uint16_t)%s << 16)")
-BINARY_BW(mergebw, "((uint8_t)%s) | ((uint8_t)%s << 8)")
-UNARY_WB(select0wb, "(uint16_t)%s & 0xff")
-UNARY_WB(select1wb, "((uint16_t)%s >> 8)&0xff")
-UNARY_LW(select0lw, "(uint32_t)%s & 0xffff")
-UNARY_LW(select1lw, "((uint32_t)%s >> 16)&0xffff")
+BINARY_WL(mergewl, "((orc_uint16)%s) | ((orc_uint16)%s << 16)")
+BINARY_BW(mergebw, "((orc_uint8)%s) | ((orc_uint8)%s << 8)")
+UNARY_WB(select0wb, "(orc_uint16)%s & 0xff")
+UNARY_WB(select1wb, "((orc_uint16)%s >> 8)&0xff")
+UNARY_LW(select0lw, "(orc_uint32)%s & 0xffff")
+UNARY_LW(select1lw, "((orc_uint32)%s >> 16)&0xffff")
UNARY_UW(swapw, "ORC_SWAP_W(%s)")
UNARY_UL(swapl, "ORC_SWAP_L(%s)")
#define _ORC_ORC_H_
#include <orc/orcprogram.h>
-#include <orc/orc-stdint.h>
#include <orc/orcarm.h>
#include <orc/orcdebug.h>
#include <orc/orcfunctions.h>
}
void
-orc_arm_emit (OrcCompiler *compiler, uint32_t insn)
+orc_arm_emit (OrcCompiler *compiler, orc_uint32 insn)
{
ORC_WRITE_UINT32_LE (compiler->codeptr, insn);
compiler->codeptr+=4;
for(i=0;i<compiler->n_fixups;i++){
unsigned char *label = compiler->labels[compiler->fixups[i].label];
unsigned char *ptr = compiler->fixups[i].ptr;
- uint32_t code;
+ orc_uint32 code;
int diff;
if (compiler->fixups[i].type == 0) {
void
orc_arm_emit_branch (OrcCompiler *compiler, int cond, int label)
{
- uint32_t code;
+ orc_uint32 code;
code = 0x0afffffe;
code |= (cond&0xf) << 28;
void
orc_arm_emit_load_imm (OrcCompiler *compiler, int dest, int imm)
{
- uint32_t code;
+ orc_uint32 code;
int shift2;
unsigned int x;
void
orc_arm_emit_add_imm (OrcCompiler *compiler, int dest, int src1, int imm)
{
- uint32_t code;
+ orc_uint32 code;
int shift2;
unsigned int x;
void
orc_arm_emit_and_imm (OrcCompiler *compiler, int dest, int src1, int value)
{
- uint32_t code;
+ orc_uint32 code;
code = 0xe2000000;
code |= (src1&0xf) << 16;
void
orc_arm_emit_cmp (OrcCompiler *compiler, int src1, int src2)
{
- uint32_t code;
+ orc_uint32 code;
code = 0xe1500000;
code |= (src1&0xf) << 16;
void
orc_arm_emit_asr_imm (OrcCompiler *compiler, int dest, int src1, int value)
{
- uint32_t code;
+ orc_uint32 code;
if (value == 0) {
ORC_ERROR("bad immediate value");
void
orc_arm_emit_lsl_imm (OrcCompiler *compiler, int dest, int src1, int value)
{
- uint32_t code;
+ orc_uint32 code;
if (value == 0) {
ORC_ERROR("bad immediate value");
void
orc_arm_emit_load_reg (OrcCompiler *compiler, int dest, int src1, int offset)
{
- uint32_t code;
+ orc_uint32 code;
code = 0xe5900000;
code |= (src1&0xf) << 16;
void
orc_arm_emit_store_reg (OrcCompiler *compiler, int src1, int dest, int offset)
{
- uint32_t code;
+ orc_uint32 code;
code = 0xe5800000;
code |= (dest&0xf) << 16;
*/
void
orc_arm_emit_dp (OrcCompiler *p, int type, OrcArmCond cond, OrcArmDP opcode,
- int S, int Rd, int Rn, int Rm, int shift, uint32_t val)
+ int S, int Rd, int Rn, int Rm, int shift, orc_uint32 val)
{
- uint32_t code;
+ orc_uint32 code;
int I = 0;
int shifter_op;
char shifter[64];
- uint32_t imm;
+ orc_uint32 imm;
static const char *shift_names[] = {
"LSL", "LSR", "ASR", "ROR"
};
switch (type) {
case 0:
/* #imm */
- imm = (uint32_t) val;
+ imm = (orc_uint32) val;
/* if imm <= 0xff we're done. It's recommanded that we choose the
* smallest shifter value. Impossible values will overflow the shifter. */
while (imm > 0xff && shift < 16) {
orc_arm_emit_par (OrcCompiler *p, int op, int mode, OrcArmCond cond,
int Rd, int Rn, int Rm)
{
- uint32_t code;
+ orc_uint32 code;
static const int par_op[] = {
1, 3, 5, 7, 9, 15, 11, 5, 5
};
orc_arm_emit_xt (OrcCompiler *p, int op, OrcArmCond cond,
int Rd, int Rn, int Rm, int r8)
{
- uint32_t code;
+ orc_uint32 code;
char shifter[64];
- static const uint32_t xt_opcodes[] = {
+ static const orc_uint32 xt_opcodes[] = {
0x06800070, 0x06a00070, 0x06b00070, 0x06c00070, 0x06e00070, 0x06f00070
};
static const char *xt_insn_names[] = {
orc_arm_emit_pkh (OrcCompiler *p, int op, OrcArmCond cond,
int Rd, int Rn, int Rm, int sh)
{
- uint32_t code;
+ orc_uint32 code;
char shifter[64];
- static const uint32_t pkh_opcodes[] = { 0x06800010, 0x06800050 };
+ static const orc_uint32 pkh_opcodes[] = { 0x06800010, 0x06800050 };
static const char *pkh_insn_names[] = { "pkhbt", "pkhtb" };
if (sh > 0) {
orc_arm_emit_sat (OrcCompiler *p, int op, OrcArmCond cond,
int Rd, int sat, int Rm, int sh, int asr)
{
- uint32_t code;
+ orc_uint32 code;
char shifter[64];
- static const uint32_t sat_opcodes[] = { 0x06a00010, 0x06e00010, 0, 0 };
+ static const orc_uint32 sat_opcodes[] = { 0x06a00010, 0x06e00010, 0, 0 };
static const char *sat_insn_names[] = { "ssat", "usat", "ssat16", "usat16" };
static const int par_mode[] = { 0, 0, 0x6a, 0x6e };
static const int par_op[] = { 0, 0, 3, 3 };
orc_arm_emit_rv (OrcCompiler *p, int op, OrcArmCond cond,
int Rd, int Rm)
{
- uint32_t code;
- static const uint32_t rv_opcodes[] = { 0x06b00030, 0x06e000b0 };
+ orc_uint32 code;
+ static const orc_uint32 rv_opcodes[] = { 0x06b00030, 0x06e000b0 };
static const char *rv_insn_names[] = { "rev", "rev16" };
code = arm_code_rv (rv_opcodes[op], cond, Rd, Rm);
ORC_ARM_ROR
} OrcArmShift;
-void orc_arm_emit (OrcCompiler *compiler, uint32_t insn);
+void orc_arm_emit (OrcCompiler *compiler, orc_uint32 insn);
void orc_arm_emit_bx_lr (OrcCompiler *compiler);
const char * orc_arm_reg_name (int reg);
const char * orc_arm_cond_name (OrcArmCond cond);
void orc_arm_do_fixups (OrcCompiler *compiler);
void orc_arm_emit_dp (OrcCompiler *p, int type, OrcArmCond cond, OrcArmDP opcode,
- int S, int Rd, int Rn, int Rm, int shift, uint32_t val);
+ int S, int Rd, int Rn, int Rm, int shift, orc_uint32 val);
void orc_arm_emit_par (OrcCompiler *p, int op, int mode, OrcArmCond cond,
int Rd, int Rn, int Rm);
void orc_arm_emit_xt (OrcCompiler *p, int op, OrcArmCond cond,
#ifdef USE_I386_CPUID
#ifdef _MSC_VER
static void
-get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
+get_cpuid (orc_uint32 op, orc_uint32 *a, orc_uint32 *b, orc_uint32 *c, orc_uint32 *d)
{
int tmp[4];
__cpuid(tmp, op);
#ifdef __i386__
static void
-get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
+get_cpuid (orc_uint32 op, orc_uint32 *a, orc_uint32 *b, orc_uint32 *c, orc_uint32 *d)
{
__asm__ (
" pushl %%ebx\n"
#ifdef __amd64__
static void
-get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
+get_cpuid (orc_uint32 op, orc_uint32 *a, orc_uint32 *b, orc_uint32 *c, orc_uint32 *d)
{
__asm__ (
" pushq %%rbx\n"
static void
test_cpuid (void *ignored)
{
- uint32_t eax, ebx, ecx, edx;
+ orc_uint32 eax, ebx, ecx, edx;
get_cpuid (0x00000000, &eax, &ebx, &ecx, &edx);
}
static unsigned int
orc_sse_detect_cpuid (void)
{
- uint32_t eax, ebx, ecx, edx;
- uint32_t level;
+ orc_uint32 eax, ebx, ecx, edx;
+ orc_uint32 level;
char vendor[13] = { 0 };
unsigned int sse_flags = 0;
#if 0
}
#endif
- get_cpuid (0x00000000, &level, (uint32_t *)(vendor+0),
- (uint32_t *)(vendor+8), (uint32_t *)(vendor+4));
+ get_cpuid (0x00000000, &level, (orc_uint32 *)(vendor+0),
+ (orc_uint32 *)(vendor+8), (orc_uint32 *)(vendor+4));
ORC_DEBUG("cpuid %d %s", level, vendor);
static unsigned int
orc_mmx_detect_cpuid (void)
{
- uint32_t eax, ebx, ecx, edx;
- uint32_t level;
+ orc_uint32 eax, ebx, ecx, edx;
+ orc_uint32 level;
char vendor[13] = { 0 };
unsigned int mmx_flags = 0;
- get_cpuid (0x00000000, &level, (uint32_t *)(vendor+0),
- (uint32_t *)(vendor+8), (uint32_t *)(vendor+4));
+ get_cpuid (0x00000000, &level, (orc_uint32 *)(vendor+0),
+ (orc_uint32 *)(vendor+8), (orc_uint32 *)(vendor+4));
ORC_DEBUG("cpuid %d %s", level, vendor);
switch (var->size) {
case 1:
- opcode_ex.src_values[k] = *(int8_t *)ptr;
+ opcode_ex.src_values[k] = *(orc_int8 *)ptr;
break;
case 2:
- opcode_ex.src_values[k] = *(int16_t *)ptr;
+ opcode_ex.src_values[k] = *(orc_int16 *)ptr;
break;
case 4:
- opcode_ex.src_values[k] = *(int32_t *)ptr;
+ opcode_ex.src_values[k] = *(orc_int32 *)ptr;
break;
case 8:
- opcode_ex.src_values[k] = *(int64_t *)ptr;
+ opcode_ex.src_values[k] = *(orc_int64 *)ptr;
break;
default:
ORC_ERROR("unhandled size %d", program->vars[insn->src_args[k]].size);
switch (var->size) {
case 1:
- *(int8_t *)ptr = opcode_ex.dest_values[k];
+ *(orc_int8 *)ptr = opcode_ex.dest_values[k];
break;
case 2:
- *(int16_t *)ptr = opcode_ex.dest_values[k];
+ *(orc_int16 *)ptr = opcode_ex.dest_values[k];
break;
case 4:
- *(int32_t *)ptr = opcode_ex.dest_values[k];
+ *(orc_int32 *)ptr = opcode_ex.dest_values[k];
break;
case 8:
- *(int64_t *)ptr = opcode_ex.dest_values[k];
+ *(orc_int64 *)ptr = opcode_ex.dest_values[k];
break;
default:
ORC_ERROR("unhandled size %d", program->vars[insn->dest_args[k]].size);
static void
convsbw (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = (int8_t)(ex->src_values[0]);
+ ex->dest_values[0] = (orc_int8)(ex->src_values[0]);
}
static void
convubw (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = (uint8_t)(ex->src_values[0]);
+ ex->dest_values[0] = (orc_uint8)(ex->src_values[0]);
}
static void
convswl (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = (int16_t)(ex->src_values[0]);
+ ex->dest_values[0] = (orc_int16)(ex->src_values[0]);
}
static void
convuwl (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = (uint16_t)(ex->src_values[0]);
+ ex->dest_values[0] = (orc_uint16)(ex->src_values[0]);
}
static void
convwb (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = (int16_t)(ex->src_values[0]);
+ ex->dest_values[0] = (orc_int16)(ex->src_values[0]);
}
static void
convssswb (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = ORC_CLAMP_SB((int16_t)(ex->src_values[0]));
+ ex->dest_values[0] = ORC_CLAMP_SB((orc_int16)(ex->src_values[0]));
}
static void
convsuswb (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = ORC_CLAMP_UB((int16_t)(ex->src_values[0]));
+ ex->dest_values[0] = ORC_CLAMP_UB((orc_int16)(ex->src_values[0]));
}
static void
convusswb (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = MIN((int)(uint16_t)(ex->src_values[0]), ORC_SB_MAX);
+ ex->dest_values[0] = MIN((int)(orc_uint16)(ex->src_values[0]), ORC_SB_MAX);
}
static void
convuuswb (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = MIN((int)(uint16_t)(ex->src_values[0]), ORC_UB_MAX);
+ ex->dest_values[0] = MIN((int)(orc_uint16)(ex->src_values[0]), ORC_UB_MAX);
}
static void
convlw (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = (int32_t)(ex->src_values[0]);
+ ex->dest_values[0] = (orc_int32)(ex->src_values[0]);
}
static void
convssslw (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = ORC_CLAMP_SW((int32_t)(ex->src_values[0]));
+ ex->dest_values[0] = ORC_CLAMP_SW((orc_int32)(ex->src_values[0]));
}
static void
convsuslw (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = ORC_CLAMP_UW((int32_t)(ex->src_values[0]));
+ ex->dest_values[0] = ORC_CLAMP_UW((orc_int32)(ex->src_values[0]));
}
static void
convusslw (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = ORC_CLAMP_SW((uint32_t)(ex->src_values[0]));
+ ex->dest_values[0] = ORC_CLAMP_SW((orc_uint32)(ex->src_values[0]));
}
static void
convuuslw (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = ORC_CLAMP_UW((uint32_t)(ex->src_values[0]));
+ ex->dest_values[0] = ORC_CLAMP_UW((orc_uint32)(ex->src_values[0]));
}
#define UNARY(name,type,code) \
ex->dest_values[0] = ( type )( code ); \
}
-#define UNARY_SB(name,code) UNARY(name, int8_t, code)
-#define BINARY_SB(name,code) BINARY(name, int8_t, code)
-#define BINARY_UB(name,code) BINARY(name, uint8_t, code)
+#define UNARY_SB(name,code) UNARY(name, orc_int8, code)
+#define BINARY_SB(name,code) BINARY(name, orc_int8, code)
+#define BINARY_UB(name,code) BINARY(name, orc_uint8, code)
-#define UNARY_SW(name,code) UNARY(name, int16_t, code)
-#define BINARY_SW(name,code) BINARY(name, int16_t, code)
-#define BINARY_UW(name,code) BINARY(name, uint16_t, code)
+#define UNARY_SW(name,code) UNARY(name, orc_int16, code)
+#define BINARY_SW(name,code) BINARY(name, orc_int16, code)
+#define BINARY_UW(name,code) BINARY(name, orc_uint16, code)
-#define UNARY_SL(name,code) UNARY(name, int32_t, code)
-#define BINARY_SL(name,code) BINARY(name, int32_t, code)
-#define BINARY_UL(name,code) BINARY(name, uint32_t, code)
+#define UNARY_SL(name,code) UNARY(name, orc_int32, code)
+#define BINARY_SL(name,code) BINARY(name, orc_int32, code)
+#define BINARY_UL(name,code) BINARY(name, orc_uint32, code)
UNARY_SB(absb, (a<0)?-a:a)
BINARY_SB(addb, a + b)
UNARY_SL(absl, (a<0)?-a:a)
BINARY_SL(addl, a + b)
-BINARY_SL(addssl, ORC_CLAMP_SL((int64_t)a + (int64_t)b))
-BINARY_UL(addusl, ORC_CLAMP_UL((uint64_t)(uint32_t)a + (uint64_t)(uint32_t)b))
+BINARY_SL(addssl, ORC_CLAMP_SL((orc_int64)a + (orc_int64)b))
+BINARY_UL(addusl, ORC_CLAMP_UL((orc_uint64)(orc_uint32)a + (orc_uint64)(orc_uint32)b))
BINARY_SL(andl, a & b)
BINARY_SL(andnl, (~a) & b)
-BINARY_SL(avgsl, ((int64_t)a + (int64_t)b + 1)>>1)
-BINARY_UL(avgul, ((uint64_t)(uint32_t)a + (uint64_t)(uint32_t)b + 1)>>1)
+BINARY_SL(avgsl, ((orc_int64)a + (orc_int64)b + 1)>>1)
+BINARY_UL(avgul, ((orc_uint64)(orc_uint32)a + (orc_uint64)(orc_uint32)b + 1)>>1)
BINARY_SL(cmpeql, (a == b) ? (~0) : 0)
BINARY_SL(cmpgtsl, (a > b) ? (~0) : 0)
UNARY_SL(copyl, a)
BINARY_SL(maxsl, (a > b) ? a : b)
-BINARY_UL(maxul, ((uint32_t)a > (uint32_t)b) ? a : b)
+BINARY_UL(maxul, ((orc_uint32)a > (orc_uint32)b) ? a : b)
BINARY_SL(minsl, (a < b) ? a : b)
-BINARY_UL(minul, ((uint32_t)a < (uint32_t)b) ? a : b)
+BINARY_UL(minul, ((orc_uint32)a < (orc_uint32)b) ? a : b)
BINARY_SL(mulll, (a * b) & 0xffffffff)
-BINARY_SL(mulhsl, ((int64_t)a * (int64_t)b) >> 32)
-BINARY_UL(mulhul, ((uint64_t)a * (uint64_t)b) >> 32)
+BINARY_SL(mulhsl, ((orc_int64)a * (orc_int64)b) >> 32)
+BINARY_UL(mulhul, ((orc_uint64)a * (orc_uint64)b) >> 32)
BINARY_SL(orl, a | b)
BINARY_SL(shll, a << b)
BINARY_SL(shrsl, a >> b)
-BINARY_UL(shrul, ((uint32_t)a) >> b)
+BINARY_UL(shrul, ((orc_uint32)a) >> b)
UNARY_SL(signl, ORC_CLAMP(a,-1,1))
BINARY_SL(subl, a - b)
-BINARY_SL(subssl, ORC_CLAMP_SL((int64_t)a - (int64_t)b))
-BINARY_UL(subusl, (((uint32_t)a) < ((uint32_t)b)) ? 0 : a - b)
+BINARY_SL(subssl, ORC_CLAMP_SL((orc_int64)a - (orc_int64)b))
+BINARY_UL(subusl, (((orc_uint32)a) < ((orc_uint32)b)) ? 0 : a - b)
BINARY_SL(xorl, a ^ b)
((type2)(type1)ex->src_values[1]); \
}
-MUL(mulsbw, int8_t, int16_t)
-MUL(mulubw, uint8_t, uint16_t)
-MUL(mulswl, int16_t, int32_t)
-MUL(muluwl, uint16_t, uint32_t)
+MUL(mulsbw, orc_int8, orc_int16)
+MUL(mulubw, orc_uint8, orc_uint16)
+MUL(mulswl, orc_int16, orc_int32)
+MUL(muluwl, orc_uint16, orc_uint32)
#ifdef ENABLE_INT64
-MUL(mulslq, int32_t, int64_t)
-MUL(mululq, uint32_t, uint64_t)
+MUL(mulslq, orc_int32, orc_int64)
+MUL(mululq, orc_uint32, orc_uint64)
#endif
#define ACC(name, type1) \
ex->dest_values[0] = ((type1)ex->src_values[0]); \
}
-ACC(accw, int16_t);
-ACC(accl, int32_t);
+ACC(accw, orc_int16);
+ACC(accl, orc_int32);
static void
swapw (OrcOpcodeExecutor *ex, void *user)
mergewl (OrcOpcodeExecutor *ex, void *user)
{
union {
- uint16_t u16[2];
- uint32_t u32;
+ orc_uint16 u16[2];
+ orc_uint32 u32;
} val;
val.u16[0] = ex->src_values[0];
val.u16[1] = ex->src_values[1];
mergebw (OrcOpcodeExecutor *ex, void *user)
{
union {
- uint8_t u8[2];
- uint16_t u16;
+ orc_uint8 u8[2];
+ orc_uint16 u16;
} val;
val.u8[0] = ex->src_values[0];
val.u8[1] = ex->src_values[1];
static void
accsadubl (OrcOpcodeExecutor *ex, void *user)
{
- ex->dest_values[0] = abs((int)((uint8_t)ex->src_values[0]) -
- (int)((uint8_t)ex->src_values[1]));
+ ex->dest_values[0] = abs((int)((orc_uint8)ex->src_values[0]) -
+ (int)((orc_uint8)ex->src_values[1]));
}
/* float ops */
#ifndef _ORC_PROGRAM_H_
#define _ORC_PROGRAM_H_
-#include <orc/orc-stdint.h>
#include <orc/orcutils.h>
typedef struct _OrcOpcodeExecutor OrcOpcodeExecutor;
void
orc_arm_loadw (OrcCompiler *compiler, int dest, int src1, int offset)
{
- uint32_t code;
+ orc_uint32 code;
code = 0xe1d000b0;
code |= (src1&0xf) << 16;
void
orc_arm_storew (OrcCompiler *compiler, int dest, int offset, int src1)
{
- uint32_t code;
+ orc_uint32 code;
code = 0xe1c000b0;
code |= (dest&0xf) << 16;
static void
arm_rule_mulhub (OrcCompiler *p, void *user, OrcInstruction *insn)
{
- /* BINARY_UB(mulhub, "((uint32_t)(uint8_t)%s * (uint32_t)(uint8_t)%s) >> 8") */
+ /* BINARY_UB(mulhub, "((orc_uint32)(uint8_t)%s * (orc_uint32)(uint8_t)%s) >> 8") */
int src1 = ORC_SRC_ARG (p, insn, 0);
int src2 = ORC_SRC_ARG (p, insn, 1);
int dest = ORC_DEST_ARG (p, insn, 0);
static void
arm_rule_mulhuw (OrcCompiler *p, void *user, OrcInstruction *insn)
{
- /* BINARY_UW(mulhuw, "((uint32_t)((uint16_t)%s) * (uint32_t)((uint16_t)%s)) >> 16") */
+ /* BINARY_UW(mulhuw, "((orc_uint32)((uint16_t)%s) * (orc_uint32)((uint16_t)%s)) >> 16") */
int src1 = ORC_SRC_ARG (p, insn, 0);
int src2 = ORC_SRC_ARG (p, insn, 1);
int dest = ORC_DEST_ARG (p, insn, 0);
static void
arm_rule_select0lw (OrcCompiler *p, void *user, OrcInstruction *insn)
{
- /* UNARY_LW(select0lw, "(uint32_t)%s & 0xffff") */
+ /* UNARY_LW(select0lw, "(orc_uint32)%s & 0xffff") */
/* NOP */
}
static void
arm_rule_select1lw (OrcCompiler *p, void *user, OrcInstruction *insn)
{
- /* UNARY_LW(select1lw, "((uint32_t)%s >> 16)&0xffff") */
+ /* UNARY_LW(select1lw, "((orc_uint32)%s >> 16)&0xffff") */
int src1 = ORC_SRC_ARG (p, insn, 0);
int dest = ORC_DEST_ARG (p, insn, 0);
void
orc_neon_load_halfvec_aligned (OrcCompiler *compiler, OrcVariable *var, int update)
{
- uint32_t code;
+ orc_uint32 code;
ORC_ASM_CODE(compiler," vld1.32 %s[0], [%s]%s\n",
orc_neon_reg_name (var->alloc),
void
orc_neon_load_vec_aligned (OrcCompiler *compiler, OrcVariable *var, int update)
{
- uint32_t code;
+ orc_uint32 code;
ORC_ASM_CODE(compiler," vld1.64 %s, [%s]%s\n",
orc_neon_reg_name (var->alloc),
orc_neon_load_vec_unaligned (OrcCompiler *compiler, OrcVariable *var,
int update)
{
- uint32_t code;
+ orc_uint32 code;
ORC_ASM_CODE(compiler," vld1.64 %s, [%s]%s\n",
orc_neon_reg_name (var->aligned_data + 1),
orc_neon_load_halfvec_unaligned (OrcCompiler *compiler, OrcVariable *var,
int update)
{
- uint32_t code;
+ orc_uint32 code;
ORC_ASM_CODE(compiler," vld1.32 %s[1], [%s]%s\n",
orc_neon_reg_name (var->aligned_data),
void
orc_neon_loadb (OrcCompiler *compiler, OrcVariable *var, int update)
{
- uint32_t code;
+ orc_uint32 code;
int i;
if (var->is_aligned && compiler->loop_shift == 3) {
} else if (compiler->loop_shift == 2 && var->mask_alloc) {
orc_neon_load_vec_unaligned (compiler, var, update);
} else {
- uint32_t code;
+ orc_uint32 code;
int i;
if (compiler->loop_shift == 2) {
void
orc_neon_loadl (OrcCompiler *compiler, OrcVariable *var, int update)
{
- uint32_t code;
+ orc_uint32 code;
int i;
if (var->is_aligned && compiler->loop_shift == 1) {
void
orc_neon_loadq (OrcCompiler *compiler, int dest, int src1, int update, int is_aligned)
{
- uint32_t code;
+ orc_uint32 code;
ORC_ASM_CODE(compiler," vld1.64 %s, [%s]%s\n",
orc_neon_reg_name (dest),
void
orc_neon_storeb (OrcCompiler *compiler, int dest, int update, int src1, int is_aligned)
{
- uint32_t code;
+ orc_uint32 code;
int i;
if (is_aligned && compiler->loop_shift == 3) {
void
orc_neon_storew (OrcCompiler *compiler, int dest, int update, int src1, int is_aligned)
{
- uint32_t code;
+ orc_uint32 code;
int i;
if (is_aligned && compiler->loop_shift == 2) {
void
orc_neon_storel (OrcCompiler *compiler, int dest, int update, int src1, int is_aligned)
{
- uint32_t code;
+ orc_uint32 code;
int i;
if (is_aligned && compiler->loop_shift == 2) {
void
orc_neon_storeq (OrcCompiler *compiler, int dest, int update, int src1, int is_aligned)
{
- uint32_t code;
+ orc_uint32 code;
ORC_ASM_CODE(compiler," vst1.64 %s, [%s]%s\n",
orc_neon_reg_name (src1),
void
orc_neon_emit_loadib (OrcCompiler *compiler, int reg, int value)
{
- uint32_t code;
+ orc_uint32 code;
if (value == 0) {
orc_neon_emit_binary_quad (compiler, "veor", 0xf3000110, reg, reg, reg);
void
orc_neon_emit_loadiw (OrcCompiler *compiler, int reg, int value)
{
- uint32_t code;
+ orc_uint32 code;
int shift;
int neg = FALSE;
void
orc_neon_emit_loadil (OrcCompiler *compiler, int reg, int value)
{
- uint32_t code;
+ orc_uint32 code;
int shift;
int neg = FALSE;
void
orc_neon_emit_loadpb (OrcCompiler *compiler, int dest, int param)
{
- uint32_t code;
+ orc_uint32 code;
orc_arm_emit_add_imm (compiler, compiler->gp_tmpreg,
compiler->exec_reg, ORC_STRUCT_OFFSET(OrcExecutor, params[param]));
void
orc_neon_emit_loadpw (OrcCompiler *compiler, int dest, int param)
{
- uint32_t code;
+ orc_uint32 code;
orc_arm_emit_add_imm (compiler, compiler->gp_tmpreg,
compiler->exec_reg, ORC_STRUCT_OFFSET(OrcExecutor, params[param]));
void
orc_neon_emit_loadpl (OrcCompiler *compiler, int dest, int param)
{
- uint32_t code;
+ orc_uint32 code;
orc_arm_emit_add_imm (compiler, compiler->gp_tmpreg,
compiler->exec_reg, ORC_STRUCT_OFFSET(OrcExecutor, params[param]));
return; \
} \
if (p->loop_shift <= vec_shift) { \
- uint32_t x = code; \
+ orc_uint32 x = code; \
ORC_ASM_CODE(p," " insn_name " %s, %s\n", \
orc_neon_reg_name (p->vars[insn->dest_args[0]].alloc), \
orc_neon_reg_name (p->vars[insn->src_args[0]].alloc)); \
p->vars[insn->src_args[0]].alloc); \
orc_arm_emit (p, x); \
} else if (p->loop_shift == vec_shift + 1) { \
- uint32_t x = code; \
+ orc_uint32 x = code; \
ORC_ASM_CODE(p," " insn_name " %s, %s\n", \
orc_neon_reg_name (p->vars[insn->dest_args[0]].alloc), \
orc_neon_reg_name (p->vars[insn->src_args[0]].alloc)); \
typedef struct {
- uint32_t code;
+ orc_uint32 code;
char *name;
int negate;
int bits;
orc_neon_rule_shift (OrcCompiler *p, void *user, OrcInstruction *insn)
{
int type = (unsigned long)user;
- uint32_t code;
+ orc_uint32 code;
if (p->vars[insn->src_args[1]].vartype == ORC_VAR_TYPE_CONST) {
int shift = p->vars[insn->src_args[1]].value;
static void
orc_neon_rule_shrsw (OrcCompiler *p, void *user, OrcInstruction *insn)
{
- uint32_t code;
+ orc_uint32 code;
if (p->vars[insn->src_args[1]].vartype == ORC_VAR_TYPE_CONST) {
code = 0xf2900010;
ORC_ASM_CODE(p," vshr.s16 %s, %s, #%d\n",
static void
orc_neon_rule_shrsl (OrcCompiler *p, void *user, OrcInstruction *insn)
{
- uint32_t code;
+ orc_uint32 code;
if (p->vars[insn->src_args[1]].vartype == ORC_VAR_TYPE_CONST) {
code = 0xf2900010;
ORC_ASM_CODE(p," vshr.s32 %s, %s, #%d\n",
static void
orc_neon_rule_accsadubl (OrcCompiler *p, void *user, OrcInstruction *insn)
{
- uint32_t x;
+ orc_uint32 x;
x = 0xf3800700;
ORC_ASM_CODE(p," vabdl.u8 %s, %s, %s\n",
#ifndef _ORC_UTILS_H_
#define _ORC_UTILS_H_
-#include <orc/orc-stdint.h>
+#ifndef _ORC_INTEGER_TYPEDEFS_
+#define _ORC_INTEGER_TYPEDEFS_
+#if defined(_x_STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L
+#include <stdint.h>
+typedef int8_t orc_int8;
+typedef int16_t orc_int16;
+typedef int32_t orc_int32;
+typedef int64_t orc_int64;
+typedef uint8_t orc_uint8;
+typedef uint16_t orc_uint16;
+typedef uint32_t orc_uint32;
+typedef uint64_t orc_uint64;
+#elif defined(_MSC_VER)
+typedef signed __int8 orc_int8;
+typedef signed __int16 orc_int16;
+typedef signed __int32 orc_int32;
+typedef signed __int64 orc_int64;
+typedef unsigned __int8 orc_uint8;
+typedef unsigned __int16 orc_uint16;
+typedef unsigned __int32 orc_uint32;
+typedef unsigned __int64 orc_uint64;
+#else
+#include <limits.h>
+typedef signed char orc_int8;
+typedef short orc_int16;
+typedef int orc_int32;
+typedef unsigned char orc_uint8;
+typedef unsigned short orc_uint16;
+typedef unsigned int orc_uint32;
+#if INT_MAX == LONG_MAX
+typedef long long orc_int64;
+typedef unsigned long long orc_uint64;
+#else
+typedef long orc_int64;
+typedef unsigned long orc_uint64;
+#endif
+#endif
+typedef union { orc_int32 i; float f; } orc_union32;
+typedef union { orc_int64 i; double f; } orc_union64;
+#endif
#ifndef TRUE
#define TRUE 1
#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
#define ORC_READ_UINT32_LE(ptr) \
- ((uint32_t)( \
- ((uint8_t *)(ptr))[0] | \
- (((uint8_t *)(ptr))[1]<<8) | \
- (((uint8_t *)(ptr))[2]<<16) | \
- (((uint8_t *)(ptr))[3]<<24)))
+ ((orc_uint32)( \
+ ((orc_uint8 *)(ptr))[0] | \
+ (((orc_uint8 *)(ptr))[1]<<8) | \
+ (((orc_uint8 *)(ptr))[2]<<16) | \
+ (((orc_uint8 *)(ptr))[3]<<24)))
#define ORC_WRITE_UINT32_LE(ptr,val) \
do { \
- ((uint8_t *)ptr)[0] = ((val)>>0)&0xff; \
- ((uint8_t *)ptr)[1] = ((val)>>8)&0xff; \
- ((uint8_t *)ptr)[2] = ((val)>>16)&0xff; \
- ((uint8_t *)ptr)[3] = ((val)>>24)&0xff; \
+ ((orc_uint8 *)ptr)[0] = ((val)>>0)&0xff; \
+ ((orc_uint8 *)ptr)[1] = ((val)>>8)&0xff; \
+ ((orc_uint8 *)ptr)[2] = ((val)>>16)&0xff; \
+ ((orc_uint8 *)ptr)[3] = ((val)>>24)&0xff; \
} while(0)
#endif
main(int argc, char *argv[])
{
char *s, *d;
- uint8_t *src, *dest;
+ orc_uint8 *src, *dest;
OrcProfile prof;
OrcProfile prof_libc;
double ave, std;
s = malloc(1024*1024*64+1024);
d = malloc(1024*1024*64+1024);
- src = ALIGN(s,128) + 1;
+ src = ALIGN(s,128);
dest = ALIGN(d,128);
orc_profile_init (&prof);
void test_opcode (OrcStaticOpcode *opcode);
-uint8_t array1[100];
-uint8_t array2[100];
+orc_uint8 array1[100];
+orc_uint8 array2[100];
-int orc_sad_u8 (uint8_t *s1, uint8_t *s2, int n);
+int orc_sad_u8 (orc_uint8 *s1, orc_uint8 *s2, int n);
int
main (int argc, char *argv[])
int
-orc_sad_u8 (uint8_t *s1, uint8_t *s2, int n)
+orc_sad_u8 (orc_uint8 *s1, orc_uint8 *s2, int n)
{
static OrcProgram *p = NULL;
OrcExecutor *ex;
fprintf(output, "#endif\n");
fprintf(output, "#ifndef DISABLE_ORC\n");
fprintf(output, "#include <orc/orc.h>\n");
- fprintf(output, "#else\n");
- print_exec_header (output);
fprintf(output, "#endif\n");
if (include_file) {
fprintf(output, "#include <%s>\n", include_file);
}
-static void
-print_exec_header (FILE *output)
-{
-#if 0
- fprintf(output,
- "typedef struct _OrcExecutor OrcExecutor;\n"
- "typedef struct _OrcProgram OrcProgram;\n"
- "#define ORC_N_VARIABLES 64\n"
- "struct _OrcExecutor {\n"
- " OrcProgram *program;\n"
- " int n;\n"
- " int counter1;\n"
- " int counter2;\n"
- " int counter3;\n"
- " void *arrays[ORC_N_VARIABLES];\n"
- " int params[ORC_N_VARIABLES];\n"
- " int accumulators[4];\n"
- "};\n"
- "\n"
- "enum {\n"
- " ORC_VAR_D1,\n"
- " ORC_VAR_D2,\n"
- " ORC_VAR_D3,\n"
- " ORC_VAR_D4,\n"
- " ORC_VAR_S1,\n"
- " ORC_VAR_S2,\n"
- " ORC_VAR_S3,\n"
- " ORC_VAR_S4,\n"
- " ORC_VAR_S5,\n"
- " ORC_VAR_S6,\n"
- " ORC_VAR_S7,\n"
- " ORC_VAR_S8,\n"
- " ORC_VAR_A1,\n"
- " ORC_VAR_A2,\n"
- " ORC_VAR_A3,\n"
- " ORC_VAR_A4,\n"
- " ORC_VAR_C1,\n"
- " ORC_VAR_C2,\n"
- " ORC_VAR_C3,\n"
- " ORC_VAR_C4,\n"
- " ORC_VAR_C5,\n"
- " ORC_VAR_C6,\n"
- " ORC_VAR_C7,\n"
- " ORC_VAR_C8,\n"
- " ORC_VAR_P1,\n"
- " ORC_VAR_P2,\n"
- " ORC_VAR_P3,\n"
- " ORC_VAR_P4,\n"
- " ORC_VAR_P5,\n"
- " ORC_VAR_P6,\n"
- " ORC_VAR_P7,\n"
- " ORC_VAR_P8,\n"
- " ORC_VAR_T1,\n"
- " ORC_VAR_T2,\n"
- " ORC_VAR_T3,\n"
- " ORC_VAR_T4,\n"
- " ORC_VAR_T5,\n"
- " ORC_VAR_T6,\n"
- " ORC_VAR_T7,\n"
- " ORC_VAR_T8,\n"
- " ORC_VAR_T9,\n"
- " ORC_VAR_T10,\n"
- " ORC_VAR_T11,\n"
- " ORC_VAR_T12,\n"
- " ORC_VAR_T13,\n"
- " ORC_VAR_T14,\n"
- " ORC_VAR_T15\n"
- "};\n");
-#endif
-}
-
static char *
get_barrier (const char *s)
{
return barrier;
}
-#if 0
-static void
-print_defines (FILE *output)
-{
- fprintf(output,
- "#define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))\n"
- "#define ORC_ABS(a) ((a)<0 ? -(a) : (a))\n"
- "#define ORC_MIN(a,b) ((a)<(b) ? (a) : (b))\n"
- "#define ORC_MAX(a,b) ((a)>(b) ? (a) : (b))\n"
- "#define ORC_SB_MAX 127\n"
- "#define ORC_SB_MIN (-1-ORC_SB_MAX)\n"
- "#define ORC_UB_MAX 255\n"
- "#define ORC_UB_MIN 0\n"
- "#define ORC_SW_MAX 32767\n"
- "#define ORC_SW_MIN (-1-ORC_SW_MAX)\n"
- "#define ORC_UW_MAX 65535\n"
- "#define ORC_UW_MIN 0\n"
- "#define ORC_SL_MAX 2147483647\n"
- "#define ORC_SL_MIN (-1-ORC_SL_MAX)\n"
- "#define ORC_UL_MAX 4294967295U\n"
- "#define ORC_UL_MIN 0\n"
- "#define ORC_CLAMP_SB(x) ORC_CLAMP(x,ORC_SB_MIN,ORC_SB_MAX)\n"
- "#define ORC_CLAMP_UB(x) ORC_CLAMP(x,ORC_UB_MIN,ORC_UB_MAX)\n"
- "#define ORC_CLAMP_SW(x) ORC_CLAMP(x,ORC_SW_MIN,ORC_SW_MAX)\n"
- "#define ORC_CLAMP_UW(x) ORC_CLAMP(x,ORC_UW_MIN,ORC_UW_MAX)\n"
- "#define ORC_CLAMP_SL(x) ORC_CLAMP(x,ORC_SL_MIN,ORC_SL_MAX)\n"
- "#define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX)\n"
- "#define ORC_SWAP_W(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))\n"
- "#define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))\n"
- "#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))\n");
-}
-#endif
-
static char *
read_file (const char *filename)
{