[gamecode] Clean up some opcode names

While working on the new opcode table, I decided a lot of the names were
not to my liking.  Part of the problem was the earlier clash with the
v6p opcode names, but that has been resolved via the v6p tag.
This commit is contained in:
Bill Currie 2022-01-05 19:04:43 +09:00
parent 6d9c63999c
commit 0b674f5ed4
3 changed files with 70 additions and 70 deletions

View file

@ -464,10 +464,10 @@ typedef enum {
// C complex
// V vector (3d)
// Q quaternion
OP_DOT_CC_F, OP_DOT_VV_F, OP_DOT_QQ_F, OP_CROSS_VV_F,
OP_MUL_CC_F, OP_MUL_QV_F, OP_MUL_VQ_F, OP_MUL_QQ_F,
OP_DOT_CC_D, OP_DOT_VV_D, OP_DOT_QQ_D, OP_CROSS_VV_D,
OP_MUL_CC_D, OP_MUL_QV_D, OP_MUL_VQ_D, OP_MUL_QQ_D,
OP_CDOT_F, OP_VDOT_F, OP_QDOT_F, OP_CROSS_F,
OP_CMUL_F, OP_QVMUL_F, OP_VQMUL_F, OP_QMUL_F,
OP_CDOT_D, OP_VDOT_D, OP_QDOT_D, OP_CROSS_D,
OP_CMUL_D, OP_QVMUL_D, OP_VQMUL_D, OP_QMUL_D,
// comparison
// 0 1000 ==
OP_EQ_I_1, OP_EQ_I_2, OP_EQ_I_3, OP_EQ_I_4,
@ -547,9 +547,9 @@ typedef enum {
OP_SHL_L_1, OP_SHL_L_2, OP_SHL_L_3, OP_SHL_L_4,
OP_CMP_S, OP_GE_S, OP_LE_S, OP_NOT_S, //OP_CMP_S doubles as NE
// 1 0111 c = a >> b
OP_SHR_I_1, OP_SHR_I_2, OP_SHR_I_3, OP_SHR_I_4,
OP_ASR_I_1, OP_ASR_I_2, OP_ASR_I_3, OP_ASR_I_4,
OP_SHR_u_1, OP_SHR_u_2, OP_SHR_u_3, OP_SHR_u_4,
OP_SHR_L_1, OP_SHR_L_2, OP_SHR_L_3, OP_SHR_L_4,
OP_ASR_L_1, OP_ASR_L_2, OP_ASR_L_3, OP_ASR_L_4,
OP_SHR_U_1, OP_SHR_U_2, OP_SHR_U_3, OP_SHR_U_4,
// 1 1000 c = a (& | ^) b or ~a (bitwise ops)
OP_BITAND_I_1, OP_BITAND_I_2, OP_BITAND_I_3, OP_BITAND_I_4,
@ -563,14 +563,14 @@ typedef enum {
OP_SWIZZLE_D, OP_SCALE_D_2, OP_SCALE_D_3, OP_SCALE_D_4,
// 1 1010 > unsigned and conversions
OP_GT_u_1, OP_GT_u_2, OP_GT_u_3, OP_GT_u_4,
OP_CONV_IF_1, OP_CONV_LD_1, OP_CONV_uF_1, OP_CONV_UD_1,
OP_CONV_IF, OP_CONV_LD, OP_CONV_uF, OP_CONV_UD,
OP_GT_U_1, OP_GT_U_2, OP_GT_U_3, OP_GT_U_4,
OP_CONV_FI_1, OP_CONV_DL_1, OP_CONV_Fu_1, OP_CONV_DU_1,
OP_CONV_FI, OP_CONV_DL, OP_CONV_Fu, OP_CONV_DU,
// 1 1011 lea, with, etc
OP_LEA_A, OP_LEA_B, OP_LEA_C, OP_LEA_D,
OP_LEA_E, OP_ANY_2, OP_ANY_3, OP_ANY_4,
OP_PUSHREG, OP_ALL_2, OP_ALL_3, OP_ALL_4,
OP_POPREG, OP_NONE_2, OP_NONE_3, OP_NONE_4,
OP_PUSHREGS, OP_ALL_2, OP_ALL_3, OP_ALL_4,
OP_POPREGS, OP_NONE_2, OP_NONE_3, OP_NONE_4,
// 1 1100 c = a (&& || ^^) b or !a (logical ops (no short circuit))
OP_AND_I_1, OP_AND_I_2, OP_AND_I_3, OP_AND_I_4,
OP_OR_I_1, OP_OR_I_2, OP_OR_I_3, OP_OR_I_4,
@ -578,14 +578,14 @@ typedef enum {
OP_NOT_I_1, OP_NOT_I_2, OP_NOT_I_3, OP_NOT_I_4,
// 1 1101 >= unsigned with q v4 mul and moves mixed in
OP_GE_u_1, OP_GE_u_2, OP_GE_u_3, OP_GE_u_4,
OP_MUL_QV4_F, OP_MOVE_I, OP_MOVE_P, OP_MOVE_PI,
OP_QV4MUL_F, OP_MOVE_I, OP_MOVE_P, OP_MOVE_PI,
OP_GE_U_1, OP_GE_U_2, OP_GE_U_3, OP_GE_U_4,
OP_MUL_QV4_D, OP_MEMSET_I, OP_MEMSET_P, OP_MEMSET_PI,
OP_QV4MUL_D, OP_MEMSET_I, OP_MEMSET_P, OP_MEMSET_PI,
// 1 1110 <= unsigned with v4 q mul and conversion mixed in
OP_LE_u_1, OP_LE_u_2, OP_LE_u_3, OP_LE_u_4,
OP_MUL_V4Q_F, OP_CONV_IL_1, OP_CONV_uU_1, OP_CONV_FD_1,
OP_V4QMUL_F, OP_CONV_IL_1, OP_CONV_uU_1, OP_CONV_FD_1,
OP_LE_U_1, OP_LE_U_2, OP_LE_U_3, OP_LE_U_4,
OP_MUL_V4Q_D, OP_CONV_LI_1, OP_CONV_Uu_1, OP_CONV_DF_1,
OP_V4QMUL_D, OP_CONV_LI_1, OP_CONV_Uu_1, OP_CONV_DF_1,
// 1 1111
OP_spare_33, OP_spare_34, OP_spare_35, OP_spare_36,
OP_spare_37, OP_spare_38, OP_spare_39, OP_spare_40,

View file

@ -2953,20 +2953,20 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
}
break;
// 0 0111
case OP_DOT_CC_F:
case OP_CDOT_F:
OPC(vec2) = dot2f (OPA(vec2), OPB(vec2));
break;
case OP_DOT_VV_F:
case OP_VDOT_F:
{
vec_t d = DotProduct (&OPA(float),
&OPB(float));
VectorSet (d, d, d, &OPC(float));
}
break;
case OP_DOT_QQ_F:
case OP_QDOT_F:
OPC(vec4) = dotf (OPA(vec4), OPB(vec4));
break;
case OP_CROSS_VV_F:
case OP_CROSS_F:
{
pr_vec4_t a = loadvec3f (&OPA(float));
pr_vec4_t b = loadvec3f (&OPB(float));
@ -2974,40 +2974,40 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
storevec3f (&OPC(float), c);
}
break;
case OP_MUL_CC_F:
case OP_CMUL_F:
OPC(vec2) = cmulf (OPA(vec2), OPB(vec2));
break;
case OP_MUL_QV_F:
case OP_QVMUL_F:
{
pr_vec4_t v = loadvec3f (&OPB(float));
v = qvmulf (OPA(vec4), v);
storevec3f (&OPC(float), v);
}
break;
case OP_MUL_VQ_F:
case OP_VQMUL_F:
{
pr_vec4_t v = loadvec3f (&OPA(float));
v = vqmulf (v, OPB(vec4));
storevec3f (&OPC(float), v);
}
break;
case OP_MUL_QQ_F:
case OP_QMUL_F:
OPC(vec4) = qmulf (OPA(vec4), OPB(vec4));
break;
case OP_DOT_CC_D:
case OP_CDOT_D:
OPC(dvec2) = dot2d (OPA(dvec2), OPB(dvec2));
break;
case OP_DOT_VV_D:
case OP_VDOT_D:
{
double d = DotProduct (&OPA(double),
&OPB(double));
VectorSet (d, d, d, &OPC(double));
}
break;
case OP_DOT_QQ_D:
case OP_QDOT_D:
OPC(dvec4) = dotd (OPA(dvec4), OPB(dvec4));
break;
case OP_CROSS_VV_D:
case OP_CROSS_D:
{
pr_dvec4_t a = loadvec3d (&OPA(double));
pr_dvec4_t b = loadvec3d (&OPB(double));
@ -3015,24 +3015,24 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
storevec3d (&OPC(double), c);
}
break;
case OP_MUL_CC_D:
case OP_CMUL_D:
OPC(dvec2) = cmuld (OPA(dvec2), OPB(dvec2));
break;
case OP_MUL_QV_D:
case OP_QVMUL_D:
{
pr_dvec4_t v = loadvec3d (&OPB(double));
v = qvmuld (OPA(dvec4), v);
storevec3d (&OPC(double), v);
}
break;
case OP_MUL_VQ_D:
case OP_VQMUL_D:
{
pr_dvec4_t v = loadvec3d (&OPA(double));
v = vqmuld (v, OPB(dvec4));
storevec3d (&OPC(double), v);
}
break;
case OP_MUL_QQ_D:
case OP_QMUL_D:
OPC(dvec4) = qmuld (OPA(dvec4), OPB(dvec4));
break;
@ -3239,9 +3239,9 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
OPC(int) = !OPA(string) || !*PR_GetString (pr, OPA(string));
break;
// 1 0111
OP_op_T (SHR, I, int, ivec2, ivec4, >>);
OP_op_T (ASR, I, int, ivec2, ivec4, >>);
OP_op_T (SHR, u, uint, uivec2, uivec4, >>);
OP_op_T (SHR, L, long, lvec2, lvec4, >>);
OP_op_T (ASR, L, long, lvec2, lvec4, >>);
OP_op_T (SHR, U, ulong, ulvec2, ulvec4, >>);
// 1 1000
OP_op_T (BITAND, I, int, ivec2, ivec4, &);
@ -3293,7 +3293,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
case OP_ANY_4:
OPC(int) = any4i (OPA(ivec4));
break;
case OP_PUSHREG:
case OP_PUSHREGS:
stk = pr_stack_push (pr);
STK(uivec4) = pr->pr_bases;
break;
@ -3310,7 +3310,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
case OP_ALL_4:
OPC(int) = all4i (OPA(ivec4));
break;
case OP_POPREG:
case OP_POPREGS:
stk = pr_stack_pop (pr);
pr->pr_bases = STK(uivec4);
break;
@ -3365,7 +3365,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
OP_not_n (NOT, ivec4, 4, +);
// 1 1101
OP_op_T (GE, u, uint, uivec2, uivec4, >=);
case OP_MUL_QV4_F:
case OP_QV4MUL_F:
OPC(vec4) = qvmulf (OPA(vec4), OPB(vec4));
break;
case OP_MOVE_I:
@ -3380,7 +3380,7 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
st->b * sizeof (pr_type_t));
break;
OP_op_T (GE, U, ulong, ulvec2, ulvec4, >=);
case OP_MUL_QV4_D:
case OP_QV4MUL_D:
OPC(dvec4) = qvmuld (OPA(dvec4), OPB(dvec4));
break;
case OP_MEMSET_I:
@ -3394,12 +3394,12 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
break;
// 1 1110
OP_op_T (LE, u, uint, uivec2, uivec4, <=);
case OP_MUL_V4Q_F:
case OP_V4QMUL_F:
OPC(vec4) = vqmulf (OPA(vec4), OPB(vec4));
break;
OP_op_T (LE, U, ulong, ulvec2, ulvec4, <=);
case OP_MUL_V4Q_D:
case OP_V4QMUL_D:
OPC(dvec4) = vqmuld (OPA(dvec4), OPB(dvec4));
break;

View file

@ -53,25 +53,25 @@ static pr_vec4_t float_globals_expect[] = {
};
static dstatement_t float_vector_statements[] = {
{ OP(0, 0, 0, OP_DOT_CC_F), 0, 2, 4 },
{ OP(0, 0, 0, OP_MUL_CC_F), 0, 2, 6 },
{ OP(0, 0, 0, OP_DOT_VV_F), 8, 12, 16 },
{ OP(0, 0, 0, OP_CROSS_VV_F), 8, 12, 20 },
{ OP(0, 0, 0, OP_DOT_QQ_F), 24, 28, 36 },
{ OP(0, 0, 0, OP_MUL_QQ_F), 24, 28, 40 },
{ OP(0, 0, 0, OP_MUL_QV_F), 24, 32, 44 },
{ OP(0, 0, 0, OP_MUL_VQ_F), 32, 24, 48 },
{ OP(0, 0, 0, OP_CDOT_F), 0, 2, 4 },
{ OP(0, 0, 0, OP_CMUL_F), 0, 2, 6 },
{ OP(0, 0, 0, OP_VDOT_F), 8, 12, 16 },
{ OP(0, 0, 0, OP_CROSS_F), 8, 12, 20 },
{ OP(0, 0, 0, OP_QDOT_F), 24, 28, 36 },
{ OP(0, 0, 0, OP_QMUL_F), 24, 28, 40 },
{ OP(0, 0, 0, OP_QVMUL_F), 24, 32, 44 },
{ OP(0, 0, 0, OP_VQMUL_F), 32, 24, 48 },
{ OP(0, 0, 0, OP_MUL_QQ_F), 24, 32, 52 },
{ OP(0, 0, 0, OP_QMUL_F), 24, 32, 52 },
{ OP(0, 0, 0, OP_SWIZZLE_F), 24, 0x07e4, 60 },
{ OP(0, 0, 0, OP_MUL_QQ_F), 52, 60, 52 },
{ OP(0, 0, 0, OP_QMUL_F), 52, 60, 52 },
{ OP(0, 0, 0, OP_SWIZZLE_F), 24, 0x07e4, 64 },
{ OP(0, 0, 0, OP_MUL_QQ_F), 64, 32, 56 },
{ OP(0, 0, 0, OP_MUL_QQ_F), 56, 24, 56 },
{ OP(0, 0, 0, OP_QMUL_F), 64, 32, 56 },
{ OP(0, 0, 0, OP_QMUL_F), 56, 24, 56 },
{ OP(0, 0, 0, OP_MUL_QV4_F), 24, 32, 68 },
{ OP(0, 0, 0, OP_MUL_V4Q_F), 32, 24, 72 },
{ OP(0, 0, 0, OP_QV4MUL_F), 24, 32, 68 },
{ OP(0, 0, 0, OP_V4QMUL_F), 32, 24, 72 },
};
static pr_dvec4_t double_globals_init[] = {
@ -127,25 +127,25 @@ static pr_dvec4_t double_globals_expect[] = {
};
static dstatement_t double_vector_statements[] = {
{ OP(0, 0, 0, OP_DOT_CC_D), 0, 4, 8 },
{ OP(0, 0, 0, OP_MUL_CC_D), 0, 4, 12 },
{ OP(0, 0, 0, OP_DOT_VV_D), 16, 24, 32 },
{ OP(0, 0, 0, OP_CROSS_VV_D), 16, 24, 40 },
{ OP(0, 0, 0, OP_DOT_QQ_D), 48, 56, 72 },
{ OP(0, 0, 0, OP_MUL_QQ_D), 48, 56, 80 },
{ OP(0, 0, 0, OP_MUL_QV_D), 48, 64, 88 },
{ OP(0, 0, 0, OP_MUL_VQ_D), 64, 48, 96 },
{ OP(0, 0, 0, OP_CDOT_D), 0, 4, 8 },
{ OP(0, 0, 0, OP_CMUL_D), 0, 4, 12 },
{ OP(0, 0, 0, OP_VDOT_D), 16, 24, 32 },
{ OP(0, 0, 0, OP_CROSS_D), 16, 24, 40 },
{ OP(0, 0, 0, OP_QDOT_D), 48, 56, 72 },
{ OP(0, 0, 0, OP_QMUL_D), 48, 56, 80 },
{ OP(0, 0, 0, OP_QVMUL_D), 48, 64, 88 },
{ OP(0, 0, 0, OP_VQMUL_D), 64, 48, 96 },
{ OP(0, 0, 0, OP_MUL_QQ_D), 48, 64, 104 },
{ OP(0, 0, 0, OP_QMUL_D), 48, 64, 104 },
{ OP(0, 0, 0, OP_SWIZZLE_D), 48, 0x07e4, 120 },
{ OP(0, 0, 0, OP_MUL_QQ_D), 104, 120, 104 },
{ OP(0, 0, 0, OP_QMUL_D), 104, 120, 104 },
{ OP(0, 0, 0, OP_SWIZZLE_D), 48, 0x07e4, 128 },
{ OP(0, 0, 0, OP_MUL_QQ_D), 128, 64, 112 },
{ OP(0, 0, 0, OP_MUL_QQ_D), 112, 48, 112 },
{ OP(0, 0, 0, OP_QMUL_D), 128, 64, 112 },
{ OP(0, 0, 0, OP_QMUL_D), 112, 48, 112 },
{ OP(0, 0, 0, OP_MUL_QV4_D), 48, 64, 136 },
{ OP(0, 0, 0, OP_MUL_V4Q_D), 64, 48, 144 },
{ OP(0, 0, 0, OP_QV4MUL_D), 48, 64, 136 },
{ OP(0, 0, 0, OP_V4QMUL_D), 64, 48, 144 },
};
test_t tests[] = {