Add support for SIL instructions in DynASM.

This commit is contained in:
Michael Munday 2016-12-13 11:26:53 -05:00
parent 0b120ac64b
commit 3ef1f21531
2 changed files with 28 additions and 1 deletions

View File

@ -308,6 +308,22 @@ static void type(dasm_State *state) {
| br r14
}
static void sil(dasm_State *state) {
dasm_State **Dst = &state;
| lay sp, -16(sp)
| xc 0(16, sp), 0(sp)
| mvghi 0(sp), 5
| mvhi 8(sp), 7
| mvhhi 12(sp), 11
| lghi r2, 0
| ag r2, 0(sp) // r2 += 5
| a r2, 8(sp) // r2 += 7
| ah r2, 12(sp) // r2 += 11
| la sp, 16(sp)
| br r14
}
typedef struct {
int64_t arg1;
int64_t arg2;
@ -335,7 +351,8 @@ test_table test[] = {
// { 2,4, load_test, 4,"load_test"},
{-1, 0, ssa, 65535<<8, "ssa"},
{-1, 0, ssa_act, 65535<<8, "ssa_act"},
{27, 0, type, 27, "type"}
{27, 0, type, 27, "type"},
{ 0, 0, sil, 23, "sil"}
};
static void *jitcode(dasm_State **state, size_t *size)

View File

@ -971,6 +971,9 @@ map_op = {
msfi_2 = "c20100000000n",
msgfi_2 = "c20000000000n",
maer_3 = "0000b32e0000r",
mvhhi_2 = "e54400000000SIL",
mvhi_2 = "e54c00000000SIL",
mvghi_2 = "e54800000000SIL",
o_2 = "000056000000j",
or_2 = "000000001600g",
oy_2 = "e30000000056l",
@ -1219,6 +1222,13 @@ local function parse_template(params, template, nparams, pos)
if d1a then d1a() end
wputhw(op2)
if d2a then d2a() end
elseif p == "SIL" then
wputhw(op0)
local d, b, a = parse_mem_b(params[1])
op1 = op1 + shl(b, 12) + d
wputhw(op1)
if a then a() end
parse_imm16(params[2])
elseif p == "w" then
local mode, n, s = parse_label(params[1])
wputhw(op1)