[gamecode] Add single-component float bitop instructions

These add legacy support for basic float bitops (& | ^ ~). Avoiding the
instructions would require tot only the source to be converted, but also
the servers (as they do access those fields), and this seemed to be too
much.
This commit is contained in:
Bill Currie 2022-02-06 19:40:16 +09:00
parent 7c6ef06dfb
commit eba614336d
2 changed files with 32 additions and 2 deletions

View file

@ -31,7 +31,7 @@ bitmap_txt = """
1 1110 c111 stated
1 1111 00mm lea
1 1111 01td vecops2
1 1111 10nn
1 1111 10oo fbitops
1 1111 1100 convert (conversion mode in st->b)
1 1111 1101 with (mode in st->a, value in st->b, reg in st->c)
1 1111 1110
@ -186,6 +186,24 @@ convert_formats = {
"widths": "-1, 0, -1",
"types": "ev_void, ev_short, ev_void",
}
fbitops_formats = {
"opcode": "OP_{op_fbit[oo].upper()}_F",
"mnemonic": "{op_fbit[oo]}.f",
"opname": "{op_fbit[oo]}",
"format": "{fbit_fmt[oo]}",
"widths": "1, 1, 1",
"types": "{fbit_types[0]}, {fbit_types[oo==3]}, {fbit_types[0]}",
"args": {
"op_fbit": ["bitand", "bitor", "bitxor", "bitnot"],
"fbit_types": ["ev_float", "ev_invalid"],
"fbit_fmt": [
"%Ga, %Gb, %gc",
"%Ga, %Gb, %gc",
"%Ga, %Gb, %gc",
"%Ga, %gc",
],
},
}
hops_formats = {
"opcode": "OP_HOPS",
"mnemonic": "hops",
@ -548,6 +566,7 @@ group_map = {
"compare2": compare2_formats,
"constant": constant_formats,
"convert": convert_formats,
"fbitops": fbitops_formats,
"hops": hops_formats,
"jump": jump_formats,
"lea": lea_formats,

View file

@ -3467,7 +3467,18 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth)
case OP_V4QMUL_D:
OPC(dvec4) = vqmuld (OPA(dvec4), OPB(dvec4));
break;
// 10nn spare
case OP_BITAND_F:
OPC(float) = (int) OPA(float) & (int) OPB(float);
break;
case OP_BITOR_F:
OPC(float) = (int) OPA(float) | (int) OPB(float);
break;
case OP_BITXOR_F:
OPC(float) = (int) OPA(float) ^ (int) OPB(float);
break;
case OP_BITNOT_F:
OPC(float) = ~ (int) OPA(float);
break;
case OP_CONV:
switch (st->b) {
#include "libs/gamecode/pr_convert.cinc"