make dyarith array-array dispatch its own function
This commit is contained in:
parent
bd04e38a5e
commit
1b8bd0707e
@ -255,7 +255,7 @@ static f64 pfmod(f64 a, f64 b) {
|
|||||||
case el_f64: { SI_AS_I(NAME,f64,x,asBad) } \
|
case el_f64: { SI_AS_I(NAME,f64,x,asBad) } \
|
||||||
case el_c8: case el_c16: case el_c32: case el_B:; /*fallthrough*/ \
|
case el_c8: case el_c16: case el_c32: case el_B:; /*fallthrough*/ \
|
||||||
} asBad:;
|
} asBad:;
|
||||||
#define SI_AA(N) return do_dyArith(&N##DyTable, w, x);
|
#define SI_AA(N) return dyArith_AA(&N##DyTableAA, w, x);
|
||||||
#define IFN_SINGELI(X)
|
#define IFN_SINGELI(X)
|
||||||
#else
|
#else
|
||||||
#define SI_AA NO_SI_AA
|
#define SI_AA NO_SI_AA
|
||||||
|
|||||||
@ -285,9 +285,8 @@ B internalTemp_c1(B t, B x) {
|
|||||||
#endif
|
#endif
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#if !SINGELI
|
|
||||||
B internalTemp_c2(B t, B w, B x) { dec(w); return x; }
|
B internalTemp_c2(B t, B w, B x) { dec(w); return x; }
|
||||||
#endif
|
|
||||||
|
|
||||||
B heapDump_c1(B t, B x) {
|
B heapDump_c1(B t, B x) {
|
||||||
cbqn_heapDump();
|
cbqn_heapDump();
|
||||||
|
|||||||
@ -41,31 +41,25 @@ char* execAA_repr(u8 ex) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct FnInfo {
|
typedef struct FnInfoAA {
|
||||||
union { CheckedFn cFn; UncheckedFn uFn; };
|
union { CheckedFn cFn; UncheckedFn uFn; };
|
||||||
u8 ex1, ex2; // ExecAA
|
u8 ex1, ex2; // ExecAA
|
||||||
u8 type; // t_*; unused for u_call_bit
|
u8 type; // t_*; unused for u_call_bit
|
||||||
u8 width; // width in bytes; unused for u_call_bit
|
u8 width; // width in bytes; unused for u_call_bit
|
||||||
} FnInfo;
|
} FnInfoAA;
|
||||||
typedef struct EntAA {
|
typedef struct EntAA {
|
||||||
FnInfo a, b;
|
FnInfoAA a, b;
|
||||||
} EntAA;
|
} EntAA;
|
||||||
|
|
||||||
typedef struct DyTable {
|
typedef struct DyTableAA {
|
||||||
EntAA entsAA[8*8]; // one for each instruction
|
EntAA entsAA[8*8]; // one for each instruction
|
||||||
BBB2B mainFn;
|
BBB2B mainFn;
|
||||||
char* repr;
|
char* repr;
|
||||||
} DyTable;
|
} DyTableAA;
|
||||||
|
|
||||||
NOINLINE B do_dyArith(DyTable* table, B w, B x) {
|
NOINLINE B dyArith_AA(DyTableAA* table, B w, B x) {
|
||||||
B r;
|
u8 we = TI(w, elType); if (we==el_B) goto rec;
|
||||||
|
u8 xe = TI(x, elType); if (xe==el_B) goto rec;
|
||||||
if (1 || isArr(w)) {
|
|
||||||
u8 we = TI(w, elType);
|
|
||||||
if (we==el_B) goto rec;
|
|
||||||
if (1 || isArr(x)) {
|
|
||||||
u8 xe = TI(x, elType);
|
|
||||||
if (xe==el_B) goto rec;
|
|
||||||
ur wr = RNK(w);
|
ur wr = RNK(w);
|
||||||
ur xr = RNK(x);
|
ur xr = RNK(x);
|
||||||
if (wr!=xr || !eqShPart(SH(w), SH(x), wr)) goto rec;
|
if (wr!=xr || !eqShPart(SH(w), SH(x), wr)) goto rec;
|
||||||
@ -74,11 +68,11 @@ NOINLINE B do_dyArith(DyTable* table, B w, B x) {
|
|||||||
EntAA* e = &table->entsAA[we*8 + xe];
|
EntAA* e = &table->entsAA[we*8 + xe];
|
||||||
newEnt:
|
newEnt:
|
||||||
|
|
||||||
FnInfo* fn = &e->a;
|
FnInfoAA* fn = &e->a;
|
||||||
newFn:
|
newFn:
|
||||||
u8 ex = fn->ex1;
|
u8 ex = fn->ex1;
|
||||||
newEx:
|
newEx:
|
||||||
B t;
|
B r, t;
|
||||||
#if ARITH_DEBUG
|
#if ARITH_DEBUG
|
||||||
printf("opcode %d / %s\n", ex, execAA_repr(ex));
|
printf("opcode %d / %s\n", ex, execAA_repr(ex));
|
||||||
#endif
|
#endif
|
||||||
@ -142,18 +136,6 @@ NOINLINE B do_dyArith(DyTable* table, B w, B x) {
|
|||||||
}
|
}
|
||||||
case fail: goto rec;
|
case fail: goto rec;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
goto rec;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (isArr(x)) {
|
|
||||||
u8 xe = TI(x, elType);
|
|
||||||
if (xe==el_B) goto rec;
|
|
||||||
goto rec;
|
|
||||||
} else { // TODO decide if this is even a case that needs to be handled here
|
|
||||||
return table->mainFn(w, w, x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rec:
|
rec:
|
||||||
return arith_recd(table->mainFn, w, x);
|
return arith_recd(table->mainFn, w, x);
|
||||||
@ -174,8 +156,3 @@ static void stileAAu_f64_f64_f64(u8* r, u8* w, u8* x, u64 len) { for (u64 i = 0;
|
|||||||
static void logAAu_f64_f64_f64(u8* r, u8* w, u8* x, u64 len) { for (u64 i = 0; i < len; i++) ((f64*)r)[i] = log(((f64*)x)[i])/log(((f64*)w)[i]); }
|
static void logAAu_f64_f64_f64(u8* r, u8* w, u8* x, u64 len) { for (u64 i = 0; i < len; i++) ((f64*)r)[i] = log(((f64*)x)[i])/log(((f64*)w)[i]); }
|
||||||
|
|
||||||
#include "../gen/arTables.c"
|
#include "../gen/arTables.c"
|
||||||
|
|
||||||
|
|
||||||
B internalTemp_c2(B t, B w, B x) {
|
|
||||||
return do_dyArith(&addDyTable, w, x);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -107,7 +107,7 @@ Make ← {𝕊ns:
|
|||||||
|
|
||||||
cSrc∾↩ ∾⟨
|
cSrc∾↩ ∾⟨
|
||||||
"B ", cbqn, "_c2(B,B,B);", nl
|
"B ", cbqn, "_c2(B,B,B);", nl
|
||||||
"static DyTable ", cbqn,"DyTable = {", nl
|
"static DyTableAA ", cbqn,"DyTableAA = {", nl
|
||||||
" .entsAA = {", nl
|
" .entsAA = {", nl
|
||||||
∾{ ⟨instrs, we‿xe⟩:
|
∾{ ⟨instrs, we‿xe⟩:
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user