mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[gamecode] Rearrange several instructions
ANY/ALL/NONE have been temporarily removed until I implement the HOPS (horizontal operations) sub-instructions, which will all both 32-bit and 64-bit operands and several other operations (eg, horizontal add). All the fancy addressing modes for the conditional branch instructions have been permanently removed: I decided the gain was too little for the cost (24 instructions vs 6). JUMP and CALL retain their addressing modes, though. Other instructions have been shuffled around a little to fill most of the holes in the upper block of 256 instructions: just a single small 7-instruction hole. Rearrangements in the actual engine are mostly just to keep the code organized. The only real changes were the various IF statements and dealing with the resulting changes in their addressing.
This commit is contained in:
parent
dc4df49fff
commit
8050c7bd77
17 changed files with 316 additions and 358 deletions
|
@ -3,41 +3,31 @@ bitmap_txt = """
|
|||
0 0001 mmss store
|
||||
0 0010 mmss push
|
||||
0 0011 mmss pop
|
||||
0 010c ccmm branch
|
||||
|
||||
# while call and return are part of the branch block, they have different
|
||||
# handling for addressing and formatting
|
||||
0 0101 11mm call (return specified st->c)
|
||||
0 0101 1100 return (size in st->c)
|
||||
|
||||
0 0110 0nnn
|
||||
0 0110 10mm lea
|
||||
0 0110 1100 convert (conversion mode in st->b)
|
||||
0 0110 1101 with (mode in st->a, value in st->b, reg in st->c)
|
||||
0 0110 111t state
|
||||
0 0111 tooo vecops
|
||||
0 1ccc ttss compare
|
||||
0 1011 nnnn
|
||||
0 1111 nnnn
|
||||
|
||||
1 0ooo ttss mathops
|
||||
1 011r tuss shiftops
|
||||
1 0110 o1oo string
|
||||
1 1ccc t0ss compare2
|
||||
1 1001 t1ss scale
|
||||
1 1001 t100 swizzle
|
||||
1 1010 d1xx
|
||||
1 1011 00nn
|
||||
1 1011 01ss any
|
||||
1 1011 0100
|
||||
1 1011 10ss all
|
||||
1 1011 1000
|
||||
1 1011 11ss none
|
||||
1 1011 1100
|
||||
1 1101 01oo move
|
||||
1 1101 11oo memset
|
||||
1 1110 d1xx
|
||||
1 11dd t100 vecops2
|
||||
1 1t00 ooss bitops
|
||||
n 1111 nnnn
|
||||
0 1011 nnnn
|
||||
1 1001 01mm jump
|
||||
1 1001 11mm call (return specified st->c)
|
||||
1 1001 1100 return (size in st->c)
|
||||
1 1010 t1ss scale
|
||||
1 1010 t100 swizzle
|
||||
1 1011 tooo vecops
|
||||
1 1101 01oo move
|
||||
1 1101 0111 convert (conversion mode in st->b)
|
||||
1 1101 11oo memset
|
||||
1 1101 1111 with (mode in st->a, value in st->b, reg in st->c)
|
||||
1 1110 c1cc branch
|
||||
1 1110 t111 state
|
||||
1 1111 00mm lea
|
||||
1 1111 01td vecops2
|
||||
1 1111 1nnn
|
||||
1 1111 1111 hops
|
||||
"""
|
||||
|
||||
import copy
|
||||
|
@ -96,16 +86,16 @@ bitops_formats = {
|
|||
},
|
||||
}
|
||||
branch_formats = {
|
||||
"opcode": "OP_{op_cond[ccc].upper()}_{op_mode[mm]}",
|
||||
"mnemonic": "{op_cond[ccc]}",
|
||||
"opname": "{op_cond[ccc]}",
|
||||
"format": "{cond_fmt[ccc]}{branch_fmt[mm]}",
|
||||
"widths": "{cond_widths[ccc]}",
|
||||
"opcode": "OP_{op_cond[c*4+cc].upper()}",
|
||||
"mnemonic": "{op_cond[c*4+cc]}",
|
||||
"opname": "{op_cond[c*4+cc]}",
|
||||
"format": "{cond_fmt[c*4+cc]}{branch_fmt[0]}",
|
||||
"widths": "{cond_widths[c*4+cc]}",
|
||||
"types": "ev_void, ev_void, ev_integer",
|
||||
"args": {
|
||||
"op_mode": "ABCD",
|
||||
"op_cond": ["ifz", "ifb", "ifa", "jump",
|
||||
"ifnz", "ifae", "ifbe", None], #call and return seprate
|
||||
"op_cond": ["ifz", "ifb", "ifa", None,
|
||||
"ifnz", "ifae", "ifbe", None],
|
||||
"branch_fmt": branch_fmt,
|
||||
"cond_fmt": ["%Gc ", "%Gc ", "%Gc ", "", "%Gc ", "%Gc ", "%Gc ", ""],
|
||||
"cond_widths": [
|
||||
|
@ -169,6 +159,26 @@ convert_formats = {
|
|||
"widths": "1, 0, 1",
|
||||
"types": "ev_void, ev_short, ev_void",
|
||||
}
|
||||
hops_formats = {
|
||||
"opcode": "OP_HOPS",
|
||||
"mnemonic": "hops",
|
||||
"opname": "hops",
|
||||
"format": "%Ga %Hb %gc",
|
||||
"widths": "1, 0, 1",
|
||||
"types": "ev_void, ev_short, ev_void",
|
||||
}
|
||||
jump_formats = {
|
||||
"opcode": "OP_JUMP_{op_mode[mm]}",
|
||||
"mnemonic": "jump",
|
||||
"opname": "jump",
|
||||
"format": "{branch_fmt[mm]}",
|
||||
"widths": "0, 0, 0",
|
||||
"types": "ev_void, ev_void, ev_invalid",
|
||||
"args": {
|
||||
"op_mode": "ABCD",
|
||||
"branch_fmt": branch_fmt,
|
||||
},
|
||||
}
|
||||
lea_formats = {
|
||||
"opcode": "OP_LEA_{op_mode[mm]}",
|
||||
"mnemonic": "lea",
|
||||
|
@ -218,8 +228,8 @@ memset_formats = {
|
|||
"widths": "0, 0, 0",
|
||||
"types": "ev_integer, ev_void, ev_void",
|
||||
"args": {
|
||||
"op_memset": [None, "i", "p", "pi"],
|
||||
"memset_fmt": [None, "%Ga, %sb, %gc", "%Ga, %Gb, %Gc", "%Ga, %sb, %Gc"],
|
||||
"op_memset": ["i", "p", "pi", None],
|
||||
"memset_fmt": ["%Ga, %sb, %gc", "%Ga, %Gb, %Gc", "%Ga, %sb, %Gc", None],
|
||||
},
|
||||
}
|
||||
move_formats = {
|
||||
|
@ -230,8 +240,8 @@ move_formats = {
|
|||
"widths": "0, 0, 0",
|
||||
"types": "ev_integer, ev_void, ev_void",
|
||||
"args": {
|
||||
"op_move": [None, "i", "p", "pi"],
|
||||
"move_fmt": [None, "%Ga, %sb, %gc", "%Ga, %Gb, %Gc", "%Ga, %sb, %Gc"],
|
||||
"op_move": ["i", "p", "pi", None],
|
||||
"move_fmt": ["%Ga, %sb, %gc", "%Ga, %Gb, %Gc", "%Ga, %sb, %Gc", None],
|
||||
},
|
||||
}
|
||||
none_formats = {
|
||||
|
@ -423,13 +433,13 @@ vecops_formats = {
|
|||
},
|
||||
}
|
||||
vecops2_formats = {
|
||||
"opcode": "OP_{op_vop[dd].upper()}_{vop_type[t]}",
|
||||
"mnemonic": "{op_vop[dd]}.{vop_type[t]}",
|
||||
"opname": "{op_vop[dd]}",
|
||||
"opcode": "OP_{op_vop[d].upper()}_{vop_type[t]}",
|
||||
"mnemonic": "{op_vop[d]}.{vop_type[t]}",
|
||||
"opname": "{op_vop[d]}",
|
||||
"widths": "4, 4, 4",
|
||||
"types": "{vec_types[t]}, {vec_types[t]}, {vec_types[t]}",
|
||||
"args": {
|
||||
"op_vop": [None, "qv4mul", "v4qmul", None],
|
||||
"op_vop": ["qv4mul", "v4qmul"],
|
||||
"vop_type": ['F', 'D'],
|
||||
"vec_types": float_t,
|
||||
},
|
||||
|
@ -452,6 +462,8 @@ group_map = {
|
|||
"compare": compare_formats,
|
||||
"compare2": compare2_formats,
|
||||
"convert": convert_formats,
|
||||
"hops": hops_formats,
|
||||
"jump": jump_formats,
|
||||
"lea": lea_formats,
|
||||
"load": load_formats,
|
||||
"mathops": mathops_formats,
|
||||
|
@ -522,6 +534,7 @@ def process_opcode(opcode, group):
|
|||
params.update(gm["args"])
|
||||
inst = {}
|
||||
opcodes[opcode] = inst
|
||||
#print(f"{opcode:03x}", group)
|
||||
inst["op"] = eval(f'''f"{gm['opcode']}"''', params)
|
||||
mn = eval(f'''f"{gm['mnemonic']}"''', params)
|
||||
inst["mn"] = f'"{mn}"'
|
||||
|
|
|
@ -1830,11 +1830,10 @@ pr_call_mode (progs_t *pr, const dstatement_t *st, int mm_ind)
|
|||
}
|
||||
|
||||
static pr_pointer_t __attribute__((pure))
|
||||
pr_jump_mode (progs_t *pr, const dstatement_t *st)
|
||||
pr_jump_mode (progs_t *pr, const dstatement_t *st, int jump_ind)
|
||||
{
|
||||
pr_type_t *op_a = pr->pr_globals + st->a + PR_BASE (pr, st, A);
|
||||
pr_type_t *op_b = pr->pr_globals + st->b + PR_BASE (pr, st, B);
|
||||
int jump_ind = st->op & 3;
|
||||
pointer_t jump_offs = pr->pr_xstatement;
|
||||
|
||||
switch (jump_ind) {
|
||||
|
@ -2892,228 +2891,9 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
|
|||
MM(ivec4) = STK(ivec4);
|
||||
break;
|
||||
// 0 0100
|
||||
case OP_IFZ_A:
|
||||
case OP_IFZ_B:
|
||||
case OP_IFZ_C:
|
||||
case OP_IFZ_D:
|
||||
if (!OPC(int)) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_IFB_A:
|
||||
case OP_IFB_B:
|
||||
case OP_IFB_C:
|
||||
case OP_IFB_D:
|
||||
if (OPC(int) < 0) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_IFA_A:
|
||||
case OP_IFA_B:
|
||||
case OP_IFA_C:
|
||||
case OP_IFA_D:
|
||||
if (OPC(int) > 0) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_JUMP_A:
|
||||
case OP_JUMP_B:
|
||||
case OP_JUMP_C:
|
||||
case OP_JUMP_D:
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
break;
|
||||
// 0 0101
|
||||
case OP_IFNZ_A:
|
||||
case OP_IFNZ_B:
|
||||
case OP_IFNZ_C:
|
||||
case OP_IFNZ_D:
|
||||
if (OPC(int)) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_IFAE_A:
|
||||
case OP_IFAE_B:
|
||||
case OP_IFAE_C:
|
||||
case OP_IFAE_D:
|
||||
if (OPC(int) >= 0) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_IFBE_A:
|
||||
case OP_IFBE_B:
|
||||
case OP_IFBE_C:
|
||||
case OP_IFBE_D:
|
||||
if (OPC(int) <= 0) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_RETURN:
|
||||
int ret_size = st->c & 0x1f; // up to 32 words
|
||||
if (ret_size) {
|
||||
mm = pr_return_mode (pr, st, (st->c >> 5) & 7);
|
||||
memcpy (&R_INT (pr), mm, ret_size * sizeof (*op_a));
|
||||
}
|
||||
pr->pr_xfunction->profile += profile - startprofile;
|
||||
startprofile = profile;
|
||||
PR_LeaveFunction (pr, pr->pr_depth == exitdepth);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
if (pr->pr_depth== exitdepth) {
|
||||
if (pr->pr_trace && pr->pr_depth <= pr->pr_trace_depth) {
|
||||
pr->pr_trace = false;
|
||||
}
|
||||
goto exit_program;
|
||||
}
|
||||
break;
|
||||
case OP_CALL_B:
|
||||
case OP_CALL_C:
|
||||
case OP_CALL_D:
|
||||
mm = pr_call_mode (pr, st, st->c & 3);
|
||||
function = mm->func_var;
|
||||
pr->pr_argc = 0;
|
||||
// op_c specifies the location for the return value if any
|
||||
pr->pr_return = op_c;
|
||||
pr->pr_xfunction->profile += profile - startprofile;
|
||||
startprofile = profile;
|
||||
PR_CallFunction (pr, function);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
break;
|
||||
// 0 0110
|
||||
// 0nnn spare
|
||||
case OP_LEA_A:
|
||||
case OP_LEA_C:
|
||||
case OP_LEA_D:
|
||||
mm = pr_address_mode (pr, st, (st_op - OP_LEA_A));
|
||||
op_c->pointer_var = mm - pr->pr_globals;
|
||||
break;
|
||||
case OP_LEA_E:
|
||||
mm = pr_address_mode (pr, st, 4);
|
||||
op_c->pointer_var = mm - pr->pr_globals;
|
||||
break;
|
||||
case OP_CONV:
|
||||
switch (st->b) {
|
||||
#include "libs/gamecode/pr_convert.cinc"
|
||||
default:
|
||||
PR_RunError (pr, "invalid conversion code: %04o",
|
||||
st->b);
|
||||
}
|
||||
break;
|
||||
case OP_WITH:
|
||||
pr_with (pr, st);
|
||||
break;
|
||||
case OP_STATE_ft:
|
||||
{
|
||||
int self = *pr->globals.self;
|
||||
int nextthink = pr->fields.nextthink + self;
|
||||
int frame = pr->fields.frame + self;
|
||||
int think = pr->fields.think + self;
|
||||
float time = *pr->globals.time + 0.1;
|
||||
pr->pr_edict_area[nextthink].float_var = time;
|
||||
pr->pr_edict_area[frame].float_var = OPA(float);
|
||||
pr->pr_edict_area[think].func_var = op_b->func_var;
|
||||
}
|
||||
break;
|
||||
case OP_STATE_ftt:
|
||||
{
|
||||
int self = *pr->globals.self;
|
||||
int nextthink = pr->fields.nextthink + self;
|
||||
int frame = pr->fields.frame + self;
|
||||
int think = pr->fields.think + self;
|
||||
float time = *pr->globals.time + OPC(float);
|
||||
pr->pr_edict_area[nextthink].float_var = time;
|
||||
pr->pr_edict_area[frame].float_var = OPA(float);
|
||||
pr->pr_edict_area[think].func_var = op_b->func_var;
|
||||
}
|
||||
break;
|
||||
// 0 0111
|
||||
case OP_CROSS_F:
|
||||
{
|
||||
pr_vec4_t a = loadvec3f (&OPA(float));
|
||||
pr_vec4_t b = loadvec3f (&OPB(float));
|
||||
pr_vec4_t c = crossf (a, b);
|
||||
storevec3f (&OPC(float), c);
|
||||
}
|
||||
break;
|
||||
case OP_CDOT_F:
|
||||
OPC(vec2) = dot2f (OPA(vec2), OPB(vec2));
|
||||
break;
|
||||
case OP_VDOT_F:
|
||||
{
|
||||
vec_t d = DotProduct (&OPA(float),
|
||||
&OPB(float));
|
||||
VectorSet (d, d, d, &OPC(float));
|
||||
}
|
||||
break;
|
||||
case OP_QDOT_F:
|
||||
OPC(vec4) = dotf (OPA(vec4), OPB(vec4));
|
||||
break;
|
||||
case OP_CMUL_F:
|
||||
OPC(vec2) = cmulf (OPA(vec2), OPB(vec2));
|
||||
break;
|
||||
case OP_QVMUL_F:
|
||||
{
|
||||
pr_vec4_t v = loadvec3f (&OPB(float));
|
||||
v = qvmulf (OPA(vec4), v);
|
||||
storevec3f (&OPC(float), v);
|
||||
}
|
||||
break;
|
||||
case OP_VQMUL_F:
|
||||
{
|
||||
pr_vec4_t v = loadvec3f (&OPA(float));
|
||||
v = vqmulf (v, OPB(vec4));
|
||||
storevec3f (&OPC(float), v);
|
||||
}
|
||||
break;
|
||||
case OP_QMUL_F:
|
||||
OPC(vec4) = qmulf (OPA(vec4), OPB(vec4));
|
||||
break;
|
||||
case OP_CROSS_D:
|
||||
{
|
||||
pr_dvec4_t a = loadvec3d (&OPA(double));
|
||||
pr_dvec4_t b = loadvec3d (&OPB(double));
|
||||
pr_dvec4_t c = crossd (a, b);
|
||||
storevec3d (&OPC(double), c);
|
||||
}
|
||||
break;
|
||||
case OP_CDOT_D:
|
||||
OPC(dvec2) = dot2d (OPA(dvec2), OPB(dvec2));
|
||||
break;
|
||||
case OP_VDOT_D:
|
||||
{
|
||||
double d = DotProduct (&OPA(double),
|
||||
&OPB(double));
|
||||
VectorSet (d, d, d, &OPC(double));
|
||||
}
|
||||
break;
|
||||
case OP_QDOT_D:
|
||||
OPC(dvec4) = dotd (OPA(dvec4), OPB(dvec4));
|
||||
break;
|
||||
case OP_CMUL_D:
|
||||
OPC(dvec2) = cmuld (OPA(dvec2), OPB(dvec2));
|
||||
break;
|
||||
case OP_QVMUL_D:
|
||||
{
|
||||
pr_dvec4_t v = loadvec3d (&OPB(double));
|
||||
v = qvmuld (OPA(dvec4), v);
|
||||
storevec3d (&OPC(double), v);
|
||||
}
|
||||
break;
|
||||
case OP_VQMUL_D:
|
||||
{
|
||||
pr_dvec4_t v = loadvec3d (&OPA(double));
|
||||
v = vqmuld (v, OPB(dvec4));
|
||||
storevec3d (&OPC(double), v);
|
||||
}
|
||||
break;
|
||||
case OP_QMUL_D:
|
||||
OPC(dvec4) = qmuld (OPA(dvec4), OPB(dvec4));
|
||||
break;
|
||||
|
||||
#define OP_cmp_1(OP, T, rt, cmp, ct) \
|
||||
case OP_##OP##_##T##_1: \
|
||||
|
@ -3330,6 +3110,46 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
|
|||
OP_uop_T (BITNOT, I, int, ivec2, ivec4, ~);
|
||||
// 1 1001
|
||||
OP_cmp_T (LT, u, int, ivec2, ivec4, <, uint, uivec2, uivec4);
|
||||
case OP_JUMP_A:
|
||||
case OP_JUMP_B:
|
||||
case OP_JUMP_C:
|
||||
case OP_JUMP_D:
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st, st_op - OP_JUMP_A);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
break;
|
||||
OP_cmp_T (LT, U, long, lvec2, lvec4, <, ulong, ulvec2, ulvec4);
|
||||
case OP_RETURN:
|
||||
int ret_size = st->c & 0x1f; // up to 32 words
|
||||
if (ret_size) {
|
||||
mm = pr_return_mode (pr, st, (st->c >> 5) & 7);
|
||||
memcpy (&R_INT (pr), mm, ret_size * sizeof (*op_a));
|
||||
}
|
||||
pr->pr_xfunction->profile += profile - startprofile;
|
||||
startprofile = profile;
|
||||
PR_LeaveFunction (pr, pr->pr_depth == exitdepth);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
if (pr->pr_depth== exitdepth) {
|
||||
if (pr->pr_trace && pr->pr_depth <= pr->pr_trace_depth) {
|
||||
pr->pr_trace = false;
|
||||
}
|
||||
goto exit_program;
|
||||
}
|
||||
break;
|
||||
case OP_CALL_B:
|
||||
case OP_CALL_C:
|
||||
case OP_CALL_D:
|
||||
mm = pr_call_mode (pr, st, st->c & 3);
|
||||
function = mm->func_var;
|
||||
pr->pr_argc = 0;
|
||||
// op_c specifies the location for the return value if any
|
||||
pr->pr_return = op_c;
|
||||
pr->pr_xfunction->profile += profile - startprofile;
|
||||
startprofile = profile;
|
||||
PR_CallFunction (pr, function);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
break;
|
||||
// 1 1010
|
||||
OP_cmp_T (GT, u, int, ivec2, ivec4, >, uint, uivec2, uivec4);
|
||||
case OP_SWIZZLE_F:
|
||||
OPC(ivec4) = pr_swizzle_f (OPA(ivec4), st->b);
|
||||
break;
|
||||
|
@ -3342,7 +3162,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
|
|||
case OP_SCALE_F_4:
|
||||
OPC(vec4) = OPA(vec4) * OPB(float);
|
||||
break;
|
||||
OP_cmp_T (LT, U, long, lvec2, lvec4, <, ulong, ulvec2, ulvec4);
|
||||
OP_cmp_T (GT, U, long, lvec2, lvec4, >, ulong, ulvec2, ulvec4);
|
||||
case OP_SWIZZLE_D:
|
||||
OPC(lvec4) = pr_swizzle_d (OPA(lvec4), st->b);
|
||||
break;
|
||||
|
@ -3355,53 +3175,89 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
|
|||
case OP_SCALE_D_4:
|
||||
OPC(dvec4) = OPA(dvec4) * OPB(double);
|
||||
break;
|
||||
// 1 1010
|
||||
OP_cmp_T (GT, u, int, ivec2, ivec4, >, uint, uivec2, uivec4);
|
||||
// spare
|
||||
OP_cmp_T (GT, U, long, lvec2, lvec4, >, ulong, ulvec2, ulvec4);
|
||||
// spare
|
||||
// 1 1011
|
||||
// 00nn spare
|
||||
case OP_ANY_2:
|
||||
OPC(int) = any2i (OPA(ivec2));
|
||||
break;
|
||||
case OP_ANY_3:
|
||||
case OP_CROSS_F:
|
||||
{
|
||||
__auto_type v = loadvec3i (&OPA(int));
|
||||
OPC(int) = any4i (v);
|
||||
pr_vec4_t a = loadvec3f (&OPA(float));
|
||||
pr_vec4_t b = loadvec3f (&OPB(float));
|
||||
pr_vec4_t c = crossf (a, b);
|
||||
storevec3f (&OPC(float), c);
|
||||
}
|
||||
break;
|
||||
case OP_ANY_4:
|
||||
OPC(int) = any4i (OPA(ivec4));
|
||||
case OP_CDOT_F:
|
||||
OPC(vec2) = dot2f (OPA(vec2), OPB(vec2));
|
||||
break;
|
||||
// spare
|
||||
case OP_ALL_2:
|
||||
OPC(int) = all2i (OPA(ivec2));
|
||||
break;
|
||||
case OP_ALL_3:
|
||||
case OP_VDOT_F:
|
||||
{
|
||||
__auto_type v = loadvec3i (&OPA(int));
|
||||
v[3] = -1;
|
||||
OPC(int) = all4i (v);
|
||||
vec_t d = DotProduct (&OPA(float),
|
||||
&OPB(float));
|
||||
VectorSet (d, d, d, &OPC(float));
|
||||
}
|
||||
break;
|
||||
case OP_ALL_4:
|
||||
OPC(int) = all4i (OPA(ivec4));
|
||||
case OP_QDOT_F:
|
||||
OPC(vec4) = dotf (OPA(vec4), OPB(vec4));
|
||||
break;
|
||||
// spare
|
||||
case OP_NONE_2:
|
||||
OPC(int) = none2i (OPA(ivec2));
|
||||
case OP_CMUL_F:
|
||||
OPC(vec2) = cmulf (OPA(vec2), OPB(vec2));
|
||||
break;
|
||||
case OP_NONE_3:
|
||||
case OP_QVMUL_F:
|
||||
{
|
||||
__auto_type v = loadvec3i (&OPA(int));
|
||||
OPC(int) = none4i (v);
|
||||
pr_vec4_t v = loadvec3f (&OPB(float));
|
||||
v = qvmulf (OPA(vec4), v);
|
||||
storevec3f (&OPC(float), v);
|
||||
}
|
||||
break;
|
||||
case OP_NONE_4:
|
||||
OPC(int) = none4i (OPA(ivec4));
|
||||
case OP_VQMUL_F:
|
||||
{
|
||||
pr_vec4_t v = loadvec3f (&OPA(float));
|
||||
v = vqmulf (v, OPB(vec4));
|
||||
storevec3f (&OPC(float), v);
|
||||
}
|
||||
break;
|
||||
case OP_QMUL_F:
|
||||
OPC(vec4) = qmulf (OPA(vec4), OPB(vec4));
|
||||
break;
|
||||
case OP_CROSS_D:
|
||||
{
|
||||
pr_dvec4_t a = loadvec3d (&OPA(double));
|
||||
pr_dvec4_t b = loadvec3d (&OPB(double));
|
||||
pr_dvec4_t c = crossd (a, b);
|
||||
storevec3d (&OPC(double), c);
|
||||
}
|
||||
break;
|
||||
case OP_CDOT_D:
|
||||
OPC(dvec2) = dot2d (OPA(dvec2), OPB(dvec2));
|
||||
break;
|
||||
case OP_VDOT_D:
|
||||
{
|
||||
double d = DotProduct (&OPA(double),
|
||||
&OPB(double));
|
||||
VectorSet (d, d, d, &OPC(double));
|
||||
}
|
||||
break;
|
||||
case OP_QDOT_D:
|
||||
OPC(dvec4) = dotd (OPA(dvec4), OPB(dvec4));
|
||||
break;
|
||||
case OP_CMUL_D:
|
||||
OPC(dvec2) = cmuld (OPA(dvec2), OPB(dvec2));
|
||||
break;
|
||||
case OP_QVMUL_D:
|
||||
{
|
||||
pr_dvec4_t v = loadvec3d (&OPB(double));
|
||||
v = qvmuld (OPA(dvec4), v);
|
||||
storevec3d (&OPC(double), v);
|
||||
}
|
||||
break;
|
||||
case OP_VQMUL_D:
|
||||
{
|
||||
pr_dvec4_t v = loadvec3d (&OPA(double));
|
||||
v = vqmuld (v, OPB(dvec4));
|
||||
storevec3d (&OPC(double), v);
|
||||
}
|
||||
break;
|
||||
case OP_QMUL_D:
|
||||
OPC(dvec4) = qmuld (OPA(dvec4), OPB(dvec4));
|
||||
break;
|
||||
|
||||
// 1 1100
|
||||
OP_op_T (BITAND, L, long, lvec2, lvec4, &);
|
||||
OP_op_T (BITOR, L, long, lvec2, lvec4, |);
|
||||
|
@ -3409,9 +3265,6 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
|
|||
OP_uop_T (BITNOT, L, long, lvec2, lvec4, ~);
|
||||
// 1 1101
|
||||
OP_cmp_T (GE, u, int, ivec2, ivec4, >=, uint, uivec2, uivec4);
|
||||
case OP_QV4MUL_F:
|
||||
OPC(vec4) = qvmulf (OPA(vec4), OPB(vec4));
|
||||
break;
|
||||
case OP_MOVE_I:
|
||||
memmove (op_c, op_a, st->b * sizeof (pr_type_t));
|
||||
break;
|
||||
|
@ -3423,10 +3276,15 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
|
|||
memmove (pr->pr_globals + OPC(int), pr->pr_globals + OPA(int),
|
||||
st->b * sizeof (pr_type_t));
|
||||
break;
|
||||
OP_cmp_T (GE, U, long, lvec2, lvec4, >=, ulong, ulvec2, ulvec4);
|
||||
case OP_QV4MUL_D:
|
||||
OPC(dvec4) = qvmuld (OPA(dvec4), OPB(dvec4));
|
||||
case OP_CONV:
|
||||
switch (st->b) {
|
||||
#include "libs/gamecode/pr_convert.cinc"
|
||||
default:
|
||||
PR_RunError (pr, "invalid conversion code: %04o",
|
||||
st->b);
|
||||
}
|
||||
break;
|
||||
OP_cmp_T (GE, U, long, lvec2, lvec4, >=, ulong, ulvec2, ulvec4);
|
||||
case OP_MEMSET_I:
|
||||
pr_memset (op_c, OPA(int), st->b);
|
||||
break;
|
||||
|
@ -3436,19 +3294,106 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
|
|||
case OP_MEMSET_PI:
|
||||
pr_memset (pr->pr_globals + OPC(int), OPA(int), st->b);
|
||||
break;
|
||||
case OP_WITH:
|
||||
pr_with (pr, st);
|
||||
break;
|
||||
// 1 1110
|
||||
OP_cmp_T (LE, u, int, ivec2, ivec4, <=, uint, uivec2, uivec4);
|
||||
case OP_IFZ:
|
||||
if (!OPC(int)) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st, 0);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_IFB:
|
||||
if (OPC(int) < 0) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st, 0);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_IFA:
|
||||
if (OPC(int) > 0) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st, 0);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_STATE_ft:
|
||||
{
|
||||
int self = *pr->globals.self;
|
||||
int nextthink = pr->fields.nextthink + self;
|
||||
int frame = pr->fields.frame + self;
|
||||
int think = pr->fields.think + self;
|
||||
float time = *pr->globals.time + 0.1;
|
||||
pr->pr_edict_area[nextthink].float_var = time;
|
||||
pr->pr_edict_area[frame].float_var = OPA(float);
|
||||
pr->pr_edict_area[think].func_var = op_b->func_var;
|
||||
}
|
||||
break;
|
||||
OP_cmp_T (LE, U, long, lvec2, lvec4, <=, ulong, ulvec2, ulvec4);
|
||||
case OP_IFNZ:
|
||||
if (OPC(int)) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st, 0);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_IFAE:
|
||||
if (OPC(int) >= 0) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st, 0);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_IFBE:
|
||||
if (OPC(int) <= 0) {
|
||||
pr->pr_xstatement = pr_jump_mode (pr, st, 0);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
}
|
||||
break;
|
||||
case OP_STATE_ftt:
|
||||
{
|
||||
int self = *pr->globals.self;
|
||||
int nextthink = pr->fields.nextthink + self;
|
||||
int frame = pr->fields.frame + self;
|
||||
int think = pr->fields.think + self;
|
||||
float time = *pr->globals.time + OPC(float);
|
||||
pr->pr_edict_area[nextthink].float_var = time;
|
||||
pr->pr_edict_area[frame].float_var = OPA(float);
|
||||
pr->pr_edict_area[think].func_var = op_b->func_var;
|
||||
}
|
||||
break;
|
||||
// 1 1111
|
||||
case OP_LEA_A:
|
||||
case OP_LEA_C:
|
||||
case OP_LEA_D:
|
||||
mm = pr_address_mode (pr, st, (st_op - OP_LEA_A));
|
||||
op_c->pointer_var = mm - pr->pr_globals;
|
||||
break;
|
||||
case OP_LEA_E:
|
||||
mm = pr_address_mode (pr, st, 4);
|
||||
op_c->pointer_var = mm - pr->pr_globals;
|
||||
break;
|
||||
case OP_QV4MUL_F:
|
||||
OPC(vec4) = qvmulf (OPA(vec4), OPB(vec4));
|
||||
break;
|
||||
case OP_V4QMUL_F:
|
||||
OPC(vec4) = vqmulf (OPA(vec4), OPB(vec4));
|
||||
break;
|
||||
// spare
|
||||
OP_cmp_T (LE, U, long, lvec2, lvec4, <=, ulong, ulvec2, ulvec4);
|
||||
case OP_QV4MUL_D:
|
||||
OPC(dvec4) = qvmuld (OPA(dvec4), OPB(dvec4));
|
||||
break;
|
||||
case OP_V4QMUL_D:
|
||||
OPC(dvec4) = vqmuld (OPA(dvec4), OPB(dvec4));
|
||||
break;
|
||||
// spare
|
||||
// 1 1111
|
||||
// spare
|
||||
// 10nn spare
|
||||
// 1100 spare
|
||||
// 1101 spare
|
||||
// 1110 spare
|
||||
case OP_HOPS:
|
||||
switch (st->b) {
|
||||
default:
|
||||
PR_RunError (pr, "invalid hops code: %04o",
|
||||
st->b);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PR_RunError (pr, "Bad opcode o%03o", st->op & OP_MASK);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ static dstatement_t int_bitop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 24 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 24, -1, 24 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 24 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 24 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 24, 1 },
|
||||
|
||||
|
@ -42,7 +42,7 @@ static dstatement_t int_bitop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 24 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 24, -2, 24 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 24 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 24 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 24, 1 },
|
||||
|
||||
|
@ -107,7 +107,7 @@ static dstatement_t long_bitop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 48 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 48, -2, 48 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 48 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 48 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 48, 1 },
|
||||
|
||||
|
@ -123,7 +123,7 @@ static dstatement_t long_bitop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 48 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 48, -4, 48 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 48 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 48 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 48, 1 },
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ static dstatement_t int_conv_1_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 80, -1, 80 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 81, -2, 81 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 80, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 81, 2 },
|
||||
|
@ -75,7 +75,7 @@ static dstatement_t int_conv_2_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 80, -2, 80 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 81, -4, 81 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 80, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 81, 2 },
|
||||
|
|
|
@ -54,7 +54,7 @@ static dstatement_t float_conv_1_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 80, -1, 80 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 81, -2, 81 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 80, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 81, 2 },
|
||||
|
@ -75,7 +75,7 @@ static dstatement_t float_conv_2_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 80, -2, 80 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 81, -4, 81 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 80, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 81, 2 },
|
||||
|
|
|
@ -70,7 +70,7 @@ static dstatement_t long_conv_1_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 112, -1, 112 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 113, -2, 113 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 112, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 113, 2 },
|
||||
|
@ -91,7 +91,7 @@ static dstatement_t long_conv_2_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 112, -2, 112 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 113, -4, 113 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 112, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 113, 2 },
|
||||
|
|
|
@ -70,7 +70,7 @@ static dstatement_t double_conv_1_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 112, -1, 112 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 113, -2, 113 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 112, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 113, 2 },
|
||||
|
@ -91,7 +91,7 @@ static dstatement_t double_conv_2_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 112, -2, 112 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 113, -4, 113 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 112, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 113, 2 },
|
||||
|
|
|
@ -54,7 +54,7 @@ static dstatement_t uint_conv_1_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 80, -1, 80 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 81, -2, 81 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 80, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 81, 2 },
|
||||
|
@ -75,7 +75,7 @@ static dstatement_t uint_conv_2_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 80, -2, 80 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 81, -4, 81 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 80, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 81, 2 },
|
||||
|
|
|
@ -54,7 +54,7 @@ static dstatement_t bool32_conv_1_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 80, -1, 80 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 81, -2, 81 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 80, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 81, 2 },
|
||||
|
@ -75,7 +75,7 @@ static dstatement_t bool32_conv_2_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 80, -2, 80 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 81, -4, 81 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 80 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 80, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 81, 2 },
|
||||
|
|
|
@ -70,7 +70,7 @@ static dstatement_t ulong_conv_1_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 112, -1, 112 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 113, -2, 113 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 112, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 113, 2 },
|
||||
|
@ -91,7 +91,7 @@ static dstatement_t ulong_conv_2_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 112, -2, 112 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 113, -4, 113 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 112, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 113, 2 },
|
||||
|
|
|
@ -70,7 +70,7 @@ static dstatement_t bool64_conv_1_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 112, -1, 112 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 113, -2, 113 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 112, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 113, 2 },
|
||||
|
@ -91,7 +91,7 @@ static dstatement_t bool64_conv_2_statements[] = {
|
|||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 112, -2, 112 }, // dec index
|
||||
{ OP(0, 0, 0, OP_LEA_C), 113, -4, 113 }, // dec index for 64-bits
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 112 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 112, 1 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 113, 2 },
|
||||
|
|
|
@ -30,7 +30,7 @@ static dstatement_t double_binop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -2, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_MUL_D_1), 0, 8, 16 },
|
||||
|
@ -46,7 +46,7 @@ static dstatement_t double_binop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -4, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_MUL_D_2), 0, 8, 16 },
|
||||
|
@ -129,7 +129,7 @@ static dstatement_t double_cossin_statements[] = {
|
|||
{ OP(0, 0, 0, OP_DIV_D_2), 40, 16, 40 }, // xn /= f
|
||||
{ OP(0, 0, 0, OP_ADD_D_2), 16, 24, 16 }, // f += inc
|
||||
{ OP(0, 0, 0, OP_LT_D_1), 16, 30, 46 }, // f0 < fmax
|
||||
{ OP(0, 0, 0, OP_IFNZ_A), -7, 0, 46 }, // f0 < fmax
|
||||
{ OP(0, 0, 0, OP_IFNZ), -7, 0, 46 }, // f0 < fmax
|
||||
};
|
||||
|
||||
static pr_dvec4_t double_cmpop_init[] = {
|
||||
|
@ -161,7 +161,7 @@ static dstatement_t double_cmpop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -2, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_D_1), 0, 8, 16 },
|
||||
|
@ -177,7 +177,7 @@ static dstatement_t double_cmpop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -4, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_D_2), 0, 8, 16 },
|
||||
|
|
|
@ -30,7 +30,7 @@ static dstatement_t float_binop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -1, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_MUL_F_1), 0, 4, 8 },
|
||||
|
@ -46,7 +46,7 @@ static dstatement_t float_binop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -2, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_MUL_F_2), 0, 4, 8 },
|
||||
|
@ -129,7 +129,7 @@ static dstatement_t float_cossin_statements[] = {
|
|||
{ OP(0, 0, 0, OP_DIV_F_2), 20, 8, 20 }, // xn /= f
|
||||
{ OP(0, 0, 0, OP_ADD_F_2), 8, 12, 8 }, // f += inc
|
||||
{ OP(0, 0, 0, OP_LT_F_1), 8, 15, 23 }, // f0 < fmax
|
||||
{ OP(0, 0, 0, OP_IFNZ_A), -7, 0, 23 }, // f0 < fmax
|
||||
{ OP(0, 0, 0, OP_IFNZ), -7, 0, 23 }, // f0 < fmax
|
||||
};
|
||||
|
||||
static pr_vec4_t float_cmpop_init[] = {
|
||||
|
@ -161,7 +161,7 @@ static dstatement_t float_cmpop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -1, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_F_1), 0, 4, 8 },
|
||||
|
@ -177,7 +177,7 @@ static dstatement_t float_cmpop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -2, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_F_2), 0, 4, 8 },
|
||||
|
|
|
@ -28,7 +28,7 @@ static dstatement_t int_binop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -1, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_MUL_I_1), 0, 4, 8 },
|
||||
|
@ -44,7 +44,7 @@ static dstatement_t int_binop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -2, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_MUL_I_2), 0, 4, 8 },
|
||||
|
@ -121,7 +121,7 @@ static dstatement_t int_cmpop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -1, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_I_1), 0, 4, 8 },
|
||||
|
@ -137,7 +137,7 @@ static dstatement_t int_cmpop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -2, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_I_2), 0, 4, 8 },
|
||||
|
|
|
@ -30,7 +30,7 @@ static dstatement_t long_binop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -2, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_MUL_L_1), 0, 8, 16 },
|
||||
|
@ -46,7 +46,7 @@ static dstatement_t long_binop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -4, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_MUL_L_2), 0, 8, 16 },
|
||||
|
@ -123,7 +123,7 @@ static dstatement_t long_cmpop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -2, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_L_1), 0, 8, 16 },
|
||||
|
@ -139,7 +139,7 @@ static dstatement_t long_cmpop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -4, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_L_2), 0, 8, 16 },
|
||||
|
|
|
@ -36,7 +36,7 @@ static dstatement_t string_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 24, 0, 6 }, // init k
|
||||
// for (i = 4; i-- > 0; ) {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 4 },
|
||||
{ OP(0, 0, 0, OP_IFA_A), 2, 0, 4 },
|
||||
{ OP(0, 0, 0, OP_IFA), 2, 0, 4 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_LEA_C), 4, -1, 4 }, // dec i
|
||||
|
||||
|
@ -45,7 +45,7 @@ static dstatement_t string_statements[] = {
|
|||
// for (j = 4; j-- > 0; ) {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 5 }, // init j
|
||||
|
||||
{ OP(0, 0, 0, OP_IFA_A), 2, 0, 5 },
|
||||
{ OP(0, 0, 0, OP_IFA), 2, 0, 5 },
|
||||
{ OP(0, 0, 0, OP_JUMP_A), -6, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_LEA_C), 5, -1, 5 }, // dec j
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ static dstatement_t uint_cmpop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -1, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
// no unsigned EQ (redundant)
|
||||
|
@ -44,7 +44,7 @@ static dstatement_t uint_cmpop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -2, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
// no unsigned EQ (redundant)
|
||||
|
@ -121,7 +121,7 @@ static dstatement_t ulong_cmpop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -2, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
// no unsigned EQ (redundant)
|
||||
|
@ -137,7 +137,7 @@ static dstatement_t ulong_cmpop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -4, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
// no unsigned EQ (redundant)
|
||||
|
@ -216,7 +216,7 @@ static dstatement_t uint_shiftop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 36 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 36, -1, 36 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 36 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 36 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 36, 1 },
|
||||
{ OP(1, 1, 1, OP_SHL_I_1), 0, 4, 12 },
|
||||
|
@ -232,7 +232,7 @@ static dstatement_t uint_shiftop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 36 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 36, -2, 36 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 36 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 36 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 36, 1 },
|
||||
{ OP(1, 1, 1, OP_SHL_I_2), 0, 4, 12 },
|
||||
|
@ -319,7 +319,7 @@ static dstatement_t ulong_shiftop_1_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 72 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 72, -2, 72 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 72 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 72 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 72, 1 },
|
||||
{ OP(1, 1, 1, OP_SHL_L_1), 0, 8, 24 },
|
||||
|
@ -335,7 +335,7 @@ static dstatement_t ulong_shiftop_2_statements[] = {
|
|||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 72 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 72, -4, 72 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 72 },
|
||||
{ OP(0, 0, 0, OP_IFAE), 2, 0, 72 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 72, 1 },
|
||||
{ OP(1, 1, 1, OP_SHL_L_2), 0, 8, 24 },
|
||||
|
|
Loading…
Reference in a new issue