|
|
@ -24,7 +24,27 @@
|
|
|
|
#define none c_m3Type_none
|
|
|
|
#define none c_m3Type_none
|
|
|
|
#define any (u8)-1
|
|
|
|
#define any (u8)-1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if d_m3HasFloat
|
|
|
|
|
|
|
|
static const IM3Operation c_preserveSetSlot [] = { NULL, op_PreserveSetSlot_i32, op_PreserveSetSlot_i64, op_PreserveSetSlot_f32, op_PreserveSetSlot_f64 };
|
|
|
|
static const IM3Operation c_setSetOps [] = { NULL, op_SetSlot_i32, op_SetSlot_i64, op_SetSlot_f32, op_SetSlot_f64 };
|
|
|
|
static const IM3Operation c_setSetOps [] = { NULL, op_SetSlot_i32, op_SetSlot_i64, op_SetSlot_f32, op_SetSlot_f64 };
|
|
|
|
|
|
|
|
static const IM3Operation c_setGlobalOps [] = { NULL, op_SetGlobal_i32, op_SetGlobal_i64, op_SetGlobal_f32, op_SetGlobal_f64 };
|
|
|
|
|
|
|
|
static const IM3Operation c_setRegisterOps [] = { NULL, op_SetRegister_i32, op_SetRegister_i64, op_SetRegister_f32, op_SetRegister_f64 };
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static const IM3Operation c_preserveSetSlot [] = { NULL, op_PreserveSetSlot_i32, op_PreserveSetSlot_i64, NULL, NULL };
|
|
|
|
|
|
|
|
static const IM3Operation c_setSetOps [] = { NULL, op_SetSlot_i32, op_SetSlot_i64, NULL, NULL };
|
|
|
|
|
|
|
|
static const IM3Operation c_setGlobalOps [] = { NULL, op_SetGlobal_i32, op_SetGlobal_i64, NULL, NULL };
|
|
|
|
|
|
|
|
static const IM3Operation c_setRegisterOps [] = { NULL, op_SetRegister_i32, op_SetRegister_i64, NULL, NULL };
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const IM3Operation c_intSelectOps [2] [4] = { { op_Select_i32_rss, op_Select_i32_srs, op_Select_i32_ssr, op_Select_i32_sss },
|
|
|
|
|
|
|
|
{ op_Select_i64_rss, op_Select_i64_srs, op_Select_i64_ssr, op_Select_i64_sss } };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if d_m3HasFloat
|
|
|
|
|
|
|
|
static const IM3Operation c_fpSelectOps [2] [2] [3] = { { { op_Select_f32_sss, op_Select_f32_srs, op_Select_f32_ssr }, // selector in slot
|
|
|
|
|
|
|
|
{ op_Select_f32_rss, op_Select_f32_rrs, op_Select_f32_rsr } }, // selector in reg
|
|
|
|
|
|
|
|
{ { op_Select_f64_sss, op_Select_f64_srs, op_Select_f64_ssr }, // selector in slot
|
|
|
|
|
|
|
|
{ op_Select_f64_rss, op_Select_f64_rrs, op_Select_f64_rsr } } }; // selector in reg
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
static const u16 c_m3RegisterUnallocated = 0;
|
|
|
|
static const u16 c_m3RegisterUnallocated = 0;
|
|
|
|
static const u16 c_slotUnused = 0xffff;
|
|
|
|
static const u16 c_slotUnused = 0xffff;
|
|
|
@ -403,6 +423,12 @@ M3Result Push (IM3Compilation o, u8 i_type, u16 i_location)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
M3Result result = m3Err_none;
|
|
|
|
M3Result result = m3Err_none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !d_m3HasFloat
|
|
|
|
|
|
|
|
if (i_type == c_m3Type_f32 || i_type == c_m3Type_f64) {
|
|
|
|
|
|
|
|
return m3Err_unknownOpcode;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
u16 stackIndex = o->stackIndex++; // printf ("push: %d\n", (i32) i);
|
|
|
|
u16 stackIndex = o->stackIndex++; // printf ("push: %d\n", (i32) i);
|
|
|
|
|
|
|
|
|
|
|
|
if (stackIndex < d_m3MaxFunctionStackHeight)
|
|
|
|
if (stackIndex < d_m3MaxFunctionStackHeight)
|
|
|
@ -760,8 +786,6 @@ M3Result PreservedCopyTopSlot (IM3Compilation o, u16 i_destSlot, u16 i_preserv
|
|
|
|
|
|
|
|
|
|
|
|
if (IsStackTopInRegister (o))
|
|
|
|
if (IsStackTopInRegister (o))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const IM3Operation c_preserveSetSlot [] = { NULL, op_PreserveSetSlot_i32, op_PreserveSetSlot_i64, op_PreserveSetSlot_f32, op_PreserveSetSlot_f64 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
op = c_preserveSetSlot [type];
|
|
|
|
op = c_preserveSetSlot [type];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else op = Is64BitType (type) ? op_PreserveCopySlot_64 : op_PreserveCopySlot_32;
|
|
|
|
else op = Is64BitType (type) ? op_PreserveCopySlot_64 : op_PreserveCopySlot_32;
|
|
|
@ -781,8 +805,6 @@ _ (EmitOp (o, op));
|
|
|
|
|
|
|
|
|
|
|
|
M3Result MoveStackTopToRegister (IM3Compilation o)
|
|
|
|
M3Result MoveStackTopToRegister (IM3Compilation o)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static const IM3Operation setRegisterOps [] = { NULL, op_SetRegister_i32, op_SetRegister_i64, op_SetRegister_f32, op_SetRegister_f64 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
M3Result result = m3Err_none;
|
|
|
|
M3Result result = m3Err_none;
|
|
|
|
|
|
|
|
|
|
|
|
if (IsStackTopInSlot (o))
|
|
|
|
if (IsStackTopInSlot (o))
|
|
|
@ -791,7 +813,7 @@ M3Result MoveStackTopToRegister (IM3Compilation o)
|
|
|
|
|
|
|
|
|
|
|
|
_ (PreserveRegisterIfOccupied (o, type));
|
|
|
|
_ (PreserveRegisterIfOccupied (o, type));
|
|
|
|
|
|
|
|
|
|
|
|
IM3Operation op = setRegisterOps [type];
|
|
|
|
IM3Operation op = c_setRegisterOps [type];
|
|
|
|
|
|
|
|
|
|
|
|
_ (EmitOp (o, op));
|
|
|
|
_ (EmitOp (o, op));
|
|
|
|
_ (EmitTopSlotAndPop (o));
|
|
|
|
_ (EmitTopSlotAndPop (o));
|
|
|
@ -907,6 +929,7 @@ _ (PushConst (o, value, c_m3Type_i64)); m3log (compile,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if d_m3HasFloat
|
|
|
|
M3Result Compile_Const_f32 (IM3Compilation o, m3opcode_t i_opcode)
|
|
|
|
M3Result Compile_Const_f32 (IM3Compilation o, m3opcode_t i_opcode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
M3Result result;
|
|
|
|
M3Result result;
|
|
|
@ -931,6 +954,7 @@ _ (PushConst (o, value.u, c_m3Type_f64));
|
|
|
|
|
|
|
|
|
|
|
|
_catch: return result;
|
|
|
|
_catch: return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef d_m3CompileExtendedOpcode
|
|
|
|
#ifdef d_m3CompileExtendedOpcode
|
|
|
|
|
|
|
|
|
|
|
@ -1097,8 +1121,6 @@ M3Result Compile_SetGlobal (IM3Compilation o, M3Global * i_global)
|
|
|
|
|
|
|
|
|
|
|
|
if (IsStackTopInRegister (o))
|
|
|
|
if (IsStackTopInRegister (o))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const IM3Operation c_setGlobalOps [] = { NULL, op_SetGlobal_i32, op_SetGlobal_i64, op_SetGlobal_f32, op_SetGlobal_f64 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
op = c_setGlobalOps [type];
|
|
|
|
op = c_setGlobalOps [type];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else op = Is64BitType (type) ? op_SetGlobal_s64 : op_SetGlobal_s32;
|
|
|
|
else op = Is64BitType (type) ? op_SetGlobal_s64 : op_SetGlobal_s32;
|
|
|
@ -1611,13 +1633,6 @@ _ (CompileElseBlock (o, pc, blockType));
|
|
|
|
|
|
|
|
|
|
|
|
M3Result Compile_Select (IM3Compilation o, m3opcode_t i_opcode)
|
|
|
|
M3Result Compile_Select (IM3Compilation o, m3opcode_t i_opcode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static const IM3Operation intSelectOps [2] [4] = { { op_Select_i32_rss, op_Select_i32_srs, op_Select_i32_ssr, op_Select_i32_sss },
|
|
|
|
|
|
|
|
{ op_Select_i64_rss, op_Select_i64_srs, op_Select_i64_ssr, op_Select_i64_sss } };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const IM3Operation fpSelectOps [2] [2] [3] = { { { op_Select_f32_sss, op_Select_f32_srs, op_Select_f32_ssr }, // selector in slot
|
|
|
|
|
|
|
|
{ op_Select_f32_rss, op_Select_f32_rrs, op_Select_f32_rsr } }, // selector in reg
|
|
|
|
|
|
|
|
{ { op_Select_f64_sss, op_Select_f64_srs, op_Select_f64_ssr }, // selector in slot
|
|
|
|
|
|
|
|
{ op_Select_f64_rss, op_Select_f64_rrs, op_Select_f64_rsr } } }; // selector in reg
|
|
|
|
|
|
|
|
M3Result result = m3Err_none;
|
|
|
|
M3Result result = m3Err_none;
|
|
|
|
|
|
|
|
|
|
|
|
u16 slots [3] = { c_slotUnused, c_slotUnused, c_slotUnused };
|
|
|
|
u16 slots [3] = { c_slotUnused, c_slotUnused, c_slotUnused };
|
|
|
@ -1628,6 +1643,7 @@ M3Result Compile_Select (IM3Compilation o, m3opcode_t i_opcode)
|
|
|
|
|
|
|
|
|
|
|
|
if (IsFpType (type))
|
|
|
|
if (IsFpType (type))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
#if d_m3HasFloat
|
|
|
|
// not consuming a fp reg, so preserve
|
|
|
|
// not consuming a fp reg, so preserve
|
|
|
|
if (not IsStackTopMinus1InRegister (o) and
|
|
|
|
if (not IsStackTopMinus1InRegister (o) and
|
|
|
|
not IsStackTopMinus2InRegister (o))
|
|
|
|
not IsStackTopMinus2InRegister (o))
|
|
|
@ -1651,7 +1667,10 @@ _ (Pop (o));
|
|
|
|
_ (Pop (o));
|
|
|
|
_ (Pop (o));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
op = fpSelectOps [type - c_m3Type_f32] [selectorInReg] [opIndex];
|
|
|
|
op = c_fpSelectOps [type - c_m3Type_f32] [selectorInReg] [opIndex];
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
_throw (m3Err_unknownOpcode);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (IsIntType (type))
|
|
|
|
else if (IsIntType (type))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1675,7 +1694,7 @@ _ (PreserveRegisterIfOccupied (o, type));
|
|
|
|
_ (Pop (o));
|
|
|
|
_ (Pop (o));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
op = intSelectOps [type - c_m3Type_i32] [opIndex];
|
|
|
|
op = c_intSelectOps [type - c_m3Type_i32] [opIndex];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (not IsStackPolymorphic (o))
|
|
|
|
else if (not IsStackPolymorphic (o))
|
|
|
|
_throw (m3Err_functionStackUnderrun);
|
|
|
|
_throw (m3Err_functionStackUnderrun);
|
|
|
@ -1899,8 +1918,8 @@ const M3OpInfo c_operations [] =
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.load", 0, i_32, d_unaryOpList (i32, Load_i32), Compile_Load_Store ), // 0x28
|
|
|
|
M3OP( "i32.load", 0, i_32, d_unaryOpList (i32, Load_i32), Compile_Load_Store ), // 0x28
|
|
|
|
M3OP( "i64.load", 0, i_64, d_unaryOpList (i64, Load_i64), Compile_Load_Store ), // 0x29
|
|
|
|
M3OP( "i64.load", 0, i_64, d_unaryOpList (i64, Load_i64), Compile_Load_Store ), // 0x29
|
|
|
|
M3OP( "f32.load", 0, f_32, d_unaryOpList (f32, Load_f32), Compile_Load_Store ), // 0x2a
|
|
|
|
M3OP_F( "f32.load", 0, f_32, d_unaryOpList (f32, Load_f32), Compile_Load_Store ), // 0x2a
|
|
|
|
M3OP( "f64.load", 0, f_64, d_unaryOpList (f64, Load_f64), Compile_Load_Store ), // 0x2b
|
|
|
|
M3OP_F( "f64.load", 0, f_64, d_unaryOpList (f64, Load_f64), Compile_Load_Store ), // 0x2b
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.load8_s", 0, i_32, d_unaryOpList (i32, Load_i8), Compile_Load_Store ), // 0x2c
|
|
|
|
M3OP( "i32.load8_s", 0, i_32, d_unaryOpList (i32, Load_i8), Compile_Load_Store ), // 0x2c
|
|
|
|
M3OP( "i32.load8_u", 0, i_32, d_unaryOpList (i32, Load_u8), Compile_Load_Store ), // 0x2d
|
|
|
|
M3OP( "i32.load8_u", 0, i_32, d_unaryOpList (i32, Load_u8), Compile_Load_Store ), // 0x2d
|
|
|
@ -1916,8 +1935,8 @@ const M3OpInfo c_operations [] =
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.store", -2, none, d_binOpList (i32, Store_i32), Compile_Load_Store ), // 0x36
|
|
|
|
M3OP( "i32.store", -2, none, d_binOpList (i32, Store_i32), Compile_Load_Store ), // 0x36
|
|
|
|
M3OP( "i64.store", -2, none, d_binOpList (i64, Store_i64), Compile_Load_Store ), // 0x37
|
|
|
|
M3OP( "i64.store", -2, none, d_binOpList (i64, Store_i64), Compile_Load_Store ), // 0x37
|
|
|
|
M3OP( "f32.store", -2, none, d_storeFpOpList (f32, Store_f32), Compile_Load_Store ), // 0x38
|
|
|
|
M3OP_F( "f32.store", -2, none, d_storeFpOpList (f32, Store_f32), Compile_Load_Store ), // 0x38
|
|
|
|
M3OP( "f64.store", -2, none, d_storeFpOpList (f64, Store_f64), Compile_Load_Store ), // 0x39
|
|
|
|
M3OP_F( "f64.store", -2, none, d_storeFpOpList (f64, Store_f64), Compile_Load_Store ), // 0x39
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.store8", -2, none, d_binOpList (i32, Store_u8), Compile_Load_Store ), // 0x3a
|
|
|
|
M3OP( "i32.store8", -2, none, d_binOpList (i32, Store_u8), Compile_Load_Store ), // 0x3a
|
|
|
|
M3OP( "i32.store16", -2, none, d_binOpList (i32, Store_i16), Compile_Load_Store ), // 0x3b
|
|
|
|
M3OP( "i32.store16", -2, none, d_binOpList (i32, Store_i16), Compile_Load_Store ), // 0x3b
|
|
|
@ -1931,8 +1950,8 @@ const M3OpInfo c_operations [] =
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.const", 1, i_32, d_logOp (Const32), Compile_Const_i32 ), // 0x41
|
|
|
|
M3OP( "i32.const", 1, i_32, d_logOp (Const32), Compile_Const_i32 ), // 0x41
|
|
|
|
M3OP( "i64.const", 1, i_64, d_logOp (Const64), Compile_Const_i64 ), // 0x42
|
|
|
|
M3OP( "i64.const", 1, i_64, d_logOp (Const64), Compile_Const_i64 ), // 0x42
|
|
|
|
M3OP( "f32.const", 1, f_32, d_emptyOpList, Compile_Const_f32 ), // 0x43
|
|
|
|
M3OP_F( "f32.const", 1, f_32, d_emptyOpList, Compile_Const_f32 ), // 0x43
|
|
|
|
M3OP( "f64.const", 1, f_64, d_emptyOpList, Compile_Const_f64 ), // 0x44
|
|
|
|
M3OP_F( "f64.const", 1, f_64, d_emptyOpList, Compile_Const_f64 ), // 0x44
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.eqz", 0, i_32, d_unaryOpList (i32, EqualToZero) ), // 0x45
|
|
|
|
M3OP( "i32.eqz", 0, i_32, d_unaryOpList (i32, EqualToZero) ), // 0x45
|
|
|
|
M3OP( "i32.eq", -1, i_32, d_commutativeBinOpList (i32, Equal) ), // 0x46
|
|
|
|
M3OP( "i32.eq", -1, i_32, d_commutativeBinOpList (i32, Equal) ), // 0x46
|
|
|
@ -1958,19 +1977,19 @@ const M3OpInfo c_operations [] =
|
|
|
|
M3OP( "i64.ge_s", -1, i_32, d_binOpList (i64, GreaterThanOrEqual) ), // 0x59
|
|
|
|
M3OP( "i64.ge_s", -1, i_32, d_binOpList (i64, GreaterThanOrEqual) ), // 0x59
|
|
|
|
M3OP( "i64.ge_u", -1, i_32, d_binOpList (u64, GreaterThanOrEqual) ), // 0x5a
|
|
|
|
M3OP( "i64.ge_u", -1, i_32, d_binOpList (u64, GreaterThanOrEqual) ), // 0x5a
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f32.eq", -1, i_32, d_commutativeBinOpList (f32, Equal) ), // 0x5b
|
|
|
|
M3OP_F( "f32.eq", -1, i_32, d_commutativeBinOpList (f32, Equal) ), // 0x5b
|
|
|
|
M3OP( "f32.ne", -1, i_32, d_commutativeBinOpList (f32, NotEqual) ), // 0x5c
|
|
|
|
M3OP_F( "f32.ne", -1, i_32, d_commutativeBinOpList (f32, NotEqual) ), // 0x5c
|
|
|
|
M3OP( "f32.lt", -1, i_32, d_binOpList (f32, LessThan) ), // 0x5d
|
|
|
|
M3OP_F( "f32.lt", -1, i_32, d_binOpList (f32, LessThan) ), // 0x5d
|
|
|
|
M3OP( "f32.gt", -1, i_32, d_binOpList (f32, GreaterThan) ), // 0x5e
|
|
|
|
M3OP_F( "f32.gt", -1, i_32, d_binOpList (f32, GreaterThan) ), // 0x5e
|
|
|
|
M3OP( "f32.le", -1, i_32, d_binOpList (f32, LessThanOrEqual) ), // 0x5f
|
|
|
|
M3OP_F( "f32.le", -1, i_32, d_binOpList (f32, LessThanOrEqual) ), // 0x5f
|
|
|
|
M3OP( "f32.ge", -1, i_32, d_binOpList (f32, GreaterThanOrEqual) ), // 0x60
|
|
|
|
M3OP_F( "f32.ge", -1, i_32, d_binOpList (f32, GreaterThanOrEqual) ), // 0x60
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f64.eq", -1, i_32, d_commutativeBinOpList (f64, Equal) ), // 0x61
|
|
|
|
M3OP_F( "f64.eq", -1, i_32, d_commutativeBinOpList (f64, Equal) ), // 0x61
|
|
|
|
M3OP( "f64.ne", -1, i_32, d_commutativeBinOpList (f64, NotEqual) ), // 0x62
|
|
|
|
M3OP_F( "f64.ne", -1, i_32, d_commutativeBinOpList (f64, NotEqual) ), // 0x62
|
|
|
|
M3OP( "f64.lt", -1, i_32, d_binOpList (f64, LessThan) ), // 0x63
|
|
|
|
M3OP_F( "f64.lt", -1, i_32, d_binOpList (f64, LessThan) ), // 0x63
|
|
|
|
M3OP( "f64.gt", -1, i_32, d_binOpList (f64, GreaterThan) ), // 0x64
|
|
|
|
M3OP_F( "f64.gt", -1, i_32, d_binOpList (f64, GreaterThan) ), // 0x64
|
|
|
|
M3OP( "f64.le", -1, i_32, d_binOpList (f64, LessThanOrEqual) ), // 0x65
|
|
|
|
M3OP_F( "f64.le", -1, i_32, d_binOpList (f64, LessThanOrEqual) ), // 0x65
|
|
|
|
M3OP( "f64.ge", -1, i_32, d_binOpList (f64, GreaterThanOrEqual) ), // 0x66
|
|
|
|
M3OP_F( "f64.ge", -1, i_32, d_binOpList (f64, GreaterThanOrEqual) ), // 0x66
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.clz", 0, i_32, d_unaryOpList (u32, Clz) ), // 0x67
|
|
|
|
M3OP( "i32.clz", 0, i_32, d_unaryOpList (u32, Clz) ), // 0x67
|
|
|
|
M3OP( "i32.ctz", 0, i_32, d_unaryOpList (u32, Ctz) ), // 0x68
|
|
|
|
M3OP( "i32.ctz", 0, i_32, d_unaryOpList (u32, Ctz) ), // 0x68
|
|
|
@ -2012,70 +2031,70 @@ const M3OpInfo c_operations [] =
|
|
|
|
M3OP( "i64.rotl", -1, i_64, d_binOpList (u64, Rotl) ), // 0x89
|
|
|
|
M3OP( "i64.rotl", -1, i_64, d_binOpList (u64, Rotl) ), // 0x89
|
|
|
|
M3OP( "i64.rotr", -1, i_64, d_binOpList (u64, Rotr) ), // 0x8a
|
|
|
|
M3OP( "i64.rotr", -1, i_64, d_binOpList (u64, Rotr) ), // 0x8a
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f32.abs", 0, f_32, d_unaryOpList(f32, Abs) ), // 0x8b
|
|
|
|
M3OP_F( "f32.abs", 0, f_32, d_unaryOpList(f32, Abs) ), // 0x8b
|
|
|
|
M3OP( "f32.neg", 0, f_32, d_unaryOpList(f32, Negate) ), // 0x8c
|
|
|
|
M3OP_F( "f32.neg", 0, f_32, d_unaryOpList(f32, Negate) ), // 0x8c
|
|
|
|
M3OP( "f32.ceil", 0, f_32, d_unaryOpList(f32, Ceil) ), // 0x8d
|
|
|
|
M3OP_F( "f32.ceil", 0, f_32, d_unaryOpList(f32, Ceil) ), // 0x8d
|
|
|
|
M3OP( "f32.floor", 0, f_32, d_unaryOpList(f32, Floor) ), // 0x8e
|
|
|
|
M3OP_F( "f32.floor", 0, f_32, d_unaryOpList(f32, Floor) ), // 0x8e
|
|
|
|
M3OP( "f32.trunc", 0, f_32, d_unaryOpList(f32, Trunc) ), // 0x8f
|
|
|
|
M3OP_F( "f32.trunc", 0, f_32, d_unaryOpList(f32, Trunc) ), // 0x8f
|
|
|
|
M3OP( "f32.nearest", 0, f_32, d_unaryOpList(f32, Nearest) ), // 0x90
|
|
|
|
M3OP_F( "f32.nearest", 0, f_32, d_unaryOpList(f32, Nearest) ), // 0x90
|
|
|
|
M3OP( "f32.sqrt", 0, f_32, d_unaryOpList(f32, Sqrt) ), // 0x91
|
|
|
|
M3OP_F( "f32.sqrt", 0, f_32, d_unaryOpList(f32, Sqrt) ), // 0x91
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f32.add", -1, f_32, d_commutativeBinOpList (f32, Add) ), // 0x92
|
|
|
|
M3OP_F( "f32.add", -1, f_32, d_commutativeBinOpList (f32, Add) ), // 0x92
|
|
|
|
M3OP( "f32.sub", -1, f_32, d_binOpList (f32, Subtract) ), // 0x93
|
|
|
|
M3OP_F( "f32.sub", -1, f_32, d_binOpList (f32, Subtract) ), // 0x93
|
|
|
|
M3OP( "f32.mul", -1, f_32, d_commutativeBinOpList (f32, Multiply) ), // 0x94
|
|
|
|
M3OP_F( "f32.mul", -1, f_32, d_commutativeBinOpList (f32, Multiply) ), // 0x94
|
|
|
|
M3OP( "f32.div", -1, f_32, d_binOpList (f32, Divide) ), // 0x95
|
|
|
|
M3OP_F( "f32.div", -1, f_32, d_binOpList (f32, Divide) ), // 0x95
|
|
|
|
M3OP( "f32.min", -1, f_32, d_commutativeBinOpList (f32, Min) ), // 0x96
|
|
|
|
M3OP_F( "f32.min", -1, f_32, d_commutativeBinOpList (f32, Min) ), // 0x96
|
|
|
|
M3OP( "f32.max", -1, f_32, d_commutativeBinOpList (f32, Max) ), // 0x97
|
|
|
|
M3OP_F( "f32.max", -1, f_32, d_commutativeBinOpList (f32, Max) ), // 0x97
|
|
|
|
M3OP( "f32.copysign", -1, f_32, d_binOpList (f32, CopySign) ), // 0x98
|
|
|
|
M3OP_F( "f32.copysign", -1, f_32, d_binOpList (f32, CopySign) ), // 0x98
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f64.abs", 0, f_64, d_unaryOpList(f64, Abs) ), // 0x99
|
|
|
|
M3OP_F( "f64.abs", 0, f_64, d_unaryOpList(f64, Abs) ), // 0x99
|
|
|
|
M3OP( "f64.neg", 0, f_64, d_unaryOpList(f64, Negate) ), // 0x9a
|
|
|
|
M3OP_F( "f64.neg", 0, f_64, d_unaryOpList(f64, Negate) ), // 0x9a
|
|
|
|
M3OP( "f64.ceil", 0, f_64, d_unaryOpList(f64, Ceil) ), // 0x9b
|
|
|
|
M3OP_F( "f64.ceil", 0, f_64, d_unaryOpList(f64, Ceil) ), // 0x9b
|
|
|
|
M3OP( "f64.floor", 0, f_64, d_unaryOpList(f64, Floor) ), // 0x9c
|
|
|
|
M3OP_F( "f64.floor", 0, f_64, d_unaryOpList(f64, Floor) ), // 0x9c
|
|
|
|
M3OP( "f64.trunc", 0, f_64, d_unaryOpList(f64, Trunc) ), // 0x9d
|
|
|
|
M3OP_F( "f64.trunc", 0, f_64, d_unaryOpList(f64, Trunc) ), // 0x9d
|
|
|
|
M3OP( "f64.nearest", 0, f_64, d_unaryOpList(f64, Nearest) ), // 0x9e
|
|
|
|
M3OP_F( "f64.nearest", 0, f_64, d_unaryOpList(f64, Nearest) ), // 0x9e
|
|
|
|
M3OP( "f64.sqrt", 0, f_64, d_unaryOpList(f64, Sqrt) ), // 0x9f
|
|
|
|
M3OP_F( "f64.sqrt", 0, f_64, d_unaryOpList(f64, Sqrt) ), // 0x9f
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f64.add", -1, f_64, d_commutativeBinOpList (f64, Add) ), // 0xa0
|
|
|
|
M3OP_F( "f64.add", -1, f_64, d_commutativeBinOpList (f64, Add) ), // 0xa0
|
|
|
|
M3OP( "f64.sub", -1, f_64, d_binOpList (f64, Subtract) ), // 0xa1
|
|
|
|
M3OP_F( "f64.sub", -1, f_64, d_binOpList (f64, Subtract) ), // 0xa1
|
|
|
|
M3OP( "f64.mul", -1, f_64, d_commutativeBinOpList (f64, Multiply) ), // 0xa2
|
|
|
|
M3OP_F( "f64.mul", -1, f_64, d_commutativeBinOpList (f64, Multiply) ), // 0xa2
|
|
|
|
M3OP( "f64.div", -1, f_64, d_binOpList (f64, Divide) ), // 0xa3
|
|
|
|
M3OP_F( "f64.div", -1, f_64, d_binOpList (f64, Divide) ), // 0xa3
|
|
|
|
M3OP( "f64.min", -1, f_64, d_commutativeBinOpList (f64, Min) ), // 0xa4
|
|
|
|
M3OP_F( "f64.min", -1, f_64, d_commutativeBinOpList (f64, Min) ), // 0xa4
|
|
|
|
M3OP( "f64.max", -1, f_64, d_commutativeBinOpList (f64, Max) ), // 0xa5
|
|
|
|
M3OP_F( "f64.max", -1, f_64, d_commutativeBinOpList (f64, Max) ), // 0xa5
|
|
|
|
M3OP( "f64.copysign", -1, f_64, d_binOpList (f64, CopySign) ), // 0xa6
|
|
|
|
M3OP_F( "f64.copysign", -1, f_64, d_binOpList (f64, CopySign) ), // 0xa6
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.wrap/i64", 0, i_32, d_unaryOpList (i32, Wrap_i64) ), // 0xa7
|
|
|
|
M3OP( "i32.wrap/i64", 0, i_32, d_unaryOpList (i32, Wrap_i64) ), // 0xa7
|
|
|
|
M3OP( "i32.trunc_s/f32", 0, i_32, d_convertOpList (i32_Trunc_f32), Compile_Convert ), // 0xa8
|
|
|
|
M3OP_F( "i32.trunc_s/f32", 0, i_32, d_convertOpList (i32_Trunc_f32), Compile_Convert ), // 0xa8
|
|
|
|
M3OP( "i32.trunc_u/f32", 0, i_32, d_convertOpList (u32_Trunc_f32), Compile_Convert ), // 0xa9
|
|
|
|
M3OP_F( "i32.trunc_u/f32", 0, i_32, d_convertOpList (u32_Trunc_f32), Compile_Convert ), // 0xa9
|
|
|
|
M3OP( "i32.trunc_s/f64", 0, i_32, d_convertOpList (i32_Trunc_f64), Compile_Convert ), // 0xaa
|
|
|
|
M3OP_F( "i32.trunc_s/f64", 0, i_32, d_convertOpList (i32_Trunc_f64), Compile_Convert ), // 0xaa
|
|
|
|
M3OP( "i32.trunc_u/f64", 0, i_32, d_convertOpList (u32_Trunc_f64), Compile_Convert ), // 0xab
|
|
|
|
M3OP_F( "i32.trunc_u/f64", 0, i_32, d_convertOpList (u32_Trunc_f64), Compile_Convert ), // 0xab
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i64.extend_s/i32", 0, i_64, d_unaryOpList (i64, Extend_i32) ), // 0xac
|
|
|
|
M3OP( "i64.extend_s/i32", 0, i_64, d_unaryOpList (i64, Extend_i32) ), // 0xac
|
|
|
|
M3OP( "i64.extend_u/i32", 0, i_64, d_unaryOpList (i64, Extend_u32) ), // 0xad
|
|
|
|
M3OP( "i64.extend_u/i32", 0, i_64, d_unaryOpList (i64, Extend_u32) ), // 0xad
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i64.trunc_s/f32", 0, i_64, d_convertOpList (i64_Trunc_f32), Compile_Convert ), // 0xae
|
|
|
|
M3OP_F( "i64.trunc_s/f32", 0, i_64, d_convertOpList (i64_Trunc_f32), Compile_Convert ), // 0xae
|
|
|
|
M3OP( "i64.trunc_u/f32", 0, i_64, d_convertOpList (u64_Trunc_f32), Compile_Convert ), // 0xaf
|
|
|
|
M3OP_F( "i64.trunc_u/f32", 0, i_64, d_convertOpList (u64_Trunc_f32), Compile_Convert ), // 0xaf
|
|
|
|
M3OP( "i64.trunc_s/f64", 0, i_64, d_convertOpList (i64_Trunc_f64), Compile_Convert ), // 0xb0
|
|
|
|
M3OP_F( "i64.trunc_s/f64", 0, i_64, d_convertOpList (i64_Trunc_f64), Compile_Convert ), // 0xb0
|
|
|
|
M3OP( "i64.trunc_u/f64", 0, i_64, d_convertOpList (u64_Trunc_f64), Compile_Convert ), // 0xb1
|
|
|
|
M3OP_F( "i64.trunc_u/f64", 0, i_64, d_convertOpList (u64_Trunc_f64), Compile_Convert ), // 0xb1
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f32.convert_s/i32", 0, f_32, d_convertOpList (f32_Convert_i32), Compile_Convert ), // 0xb2
|
|
|
|
M3OP_F( "f32.convert_s/i32",0, f_32, d_convertOpList (f32_Convert_i32), Compile_Convert ), // 0xb2
|
|
|
|
M3OP( "f32.convert_u/i32", 0, f_32, d_convertOpList (f32_Convert_u32), Compile_Convert ), // 0xb3
|
|
|
|
M3OP_F( "f32.convert_u/i32",0, f_32, d_convertOpList (f32_Convert_u32), Compile_Convert ), // 0xb3
|
|
|
|
M3OP( "f32.convert_s/i64", 0, f_32, d_convertOpList (f32_Convert_i64), Compile_Convert ), // 0xb4
|
|
|
|
M3OP_F( "f32.convert_s/i64",0, f_32, d_convertOpList (f32_Convert_i64), Compile_Convert ), // 0xb4
|
|
|
|
M3OP( "f32.convert_u/i64", 0, f_32, d_convertOpList (f32_Convert_u64), Compile_Convert ), // 0xb5
|
|
|
|
M3OP_F( "f32.convert_u/i64",0, f_32, d_convertOpList (f32_Convert_u64), Compile_Convert ), // 0xb5
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f32.demote/f64", 0, f_32, d_unaryOpList (f32, Demote_f64) ), // 0xb6
|
|
|
|
M3OP_F( "f32.demote/f64", 0, f_32, d_unaryOpList (f32, Demote_f64) ), // 0xb6
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f64.convert_s/i32", 0, f_64, d_convertOpList (f64_Convert_i32), Compile_Convert ), // 0xb7
|
|
|
|
M3OP_F( "f64.convert_s/i32",0, f_64, d_convertOpList (f64_Convert_i32), Compile_Convert ), // 0xb7
|
|
|
|
M3OP( "f64.convert_u/i32", 0, f_64, d_convertOpList (f64_Convert_u32), Compile_Convert ), // 0xb8
|
|
|
|
M3OP_F( "f64.convert_u/i32",0, f_64, d_convertOpList (f64_Convert_u32), Compile_Convert ), // 0xb8
|
|
|
|
M3OP( "f64.convert_s/i64", 0, f_64, d_convertOpList (f64_Convert_i64), Compile_Convert ), // 0xb9
|
|
|
|
M3OP_F( "f64.convert_s/i64",0, f_64, d_convertOpList (f64_Convert_i64), Compile_Convert ), // 0xb9
|
|
|
|
M3OP( "f64.convert_u/i64", 0, f_64, d_convertOpList (f64_Convert_u64), Compile_Convert ), // 0xba
|
|
|
|
M3OP_F( "f64.convert_u/i64",0, f_64, d_convertOpList (f64_Convert_u64), Compile_Convert ), // 0xba
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "f64.promote/f32", 0, f_64, d_unaryOpList (f64, Promote_f32) ), // 0xbb
|
|
|
|
M3OP_F( "f64.promote/f32", 0, f_64, d_unaryOpList (f64, Promote_f32) ), // 0xbb
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.reinterpret/f32", 0, i_32, d_convertOpList (i32_Reinterpret_f32), Compile_Convert ), // 0xbc
|
|
|
|
M3OP_F( "i32.reinterpret/f32",0,i_32, d_convertOpList (i32_Reinterpret_f32), Compile_Convert ), // 0xbc
|
|
|
|
M3OP( "i64.reinterpret/f64", 0, i_64, d_convertOpList (i64_Reinterpret_f64), Compile_Convert ), // 0xbd
|
|
|
|
M3OP_F( "i64.reinterpret/f64",0,i_64, d_convertOpList (i64_Reinterpret_f64), Compile_Convert ), // 0xbd
|
|
|
|
M3OP( "f32.reinterpret/i32", 0, f_32, d_convertOpList (f32_Reinterpret_i32), Compile_Convert ), // 0xbe
|
|
|
|
M3OP_F( "f32.reinterpret/i32",0,f_32, d_convertOpList (f32_Reinterpret_i32), Compile_Convert ), // 0xbe
|
|
|
|
M3OP( "f64.reinterpret/i64", 0, f_64, d_convertOpList (f64_Reinterpret_i64), Compile_Convert ), // 0xbf
|
|
|
|
M3OP_F( "f64.reinterpret/i64",0,f_64, d_convertOpList (f64_Reinterpret_i64), Compile_Convert ), // 0xbf
|
|
|
|
|
|
|
|
|
|
|
|
M3OP( "i32.extend8_s", 0, i_32, d_unaryOpList (i32, Extend8_s) ), // 0xc0
|
|
|
|
M3OP( "i32.extend8_s", 0, i_32, d_unaryOpList (i32, Extend8_s) ), // 0xc0
|
|
|
|
M3OP( "i32.extend16_s", 0, i_32, d_unaryOpList (i32, Extend16_s) ), // 0xc1
|
|
|
|
M3OP( "i32.extend16_s", 0, i_32, d_unaryOpList (i32, Extend16_s) ), // 0xc1
|
|
|
@ -2123,14 +2142,14 @@ const M3OpInfo c_operations [] =
|
|
|
|
|
|
|
|
|
|
|
|
const M3OpInfo c_operationsFC [] =
|
|
|
|
const M3OpInfo c_operationsFC [] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
M3OP( "i32.trunc_s:sat/f32",0, i_32, d_convertOpList (i32_TruncSat_f32), Compile_Convert ), // 0x00
|
|
|
|
M3OP_F( "i32.trunc_s:sat/f32",0, i_32, d_convertOpList (i32_TruncSat_f32), Compile_Convert ), // 0x00
|
|
|
|
M3OP( "i32.trunc_u:sat/f32",0, i_32, d_convertOpList (u32_TruncSat_f32), Compile_Convert ), // 0x01
|
|
|
|
M3OP_F( "i32.trunc_u:sat/f32",0, i_32, d_convertOpList (u32_TruncSat_f32), Compile_Convert ), // 0x01
|
|
|
|
M3OP( "i32.trunc_s:sat/f64",0, i_32, d_convertOpList (i32_TruncSat_f64), Compile_Convert ), // 0x02
|
|
|
|
M3OP_F( "i32.trunc_s:sat/f64",0, i_32, d_convertOpList (i32_TruncSat_f64), Compile_Convert ), // 0x02
|
|
|
|
M3OP( "i32.trunc_u:sat/f64",0, i_32, d_convertOpList (u32_TruncSat_f64), Compile_Convert ), // 0x03
|
|
|
|
M3OP_F( "i32.trunc_u:sat/f64",0, i_32, d_convertOpList (u32_TruncSat_f64), Compile_Convert ), // 0x03
|
|
|
|
M3OP( "i64.trunc_s:sat/f32",0, i_64, d_convertOpList (i64_TruncSat_f32), Compile_Convert ), // 0x04
|
|
|
|
M3OP_F( "i64.trunc_s:sat/f32",0, i_64, d_convertOpList (i64_TruncSat_f32), Compile_Convert ), // 0x04
|
|
|
|
M3OP( "i64.trunc_u:sat/f32",0, i_64, d_convertOpList (u64_TruncSat_f32), Compile_Convert ), // 0x05
|
|
|
|
M3OP_F( "i64.trunc_u:sat/f32",0, i_64, d_convertOpList (u64_TruncSat_f32), Compile_Convert ), // 0x05
|
|
|
|
M3OP( "i64.trunc_s:sat/f64",0, i_64, d_convertOpList (i64_TruncSat_f64), Compile_Convert ), // 0x06
|
|
|
|
M3OP_F( "i64.trunc_s:sat/f64",0, i_64, d_convertOpList (i64_TruncSat_f64), Compile_Convert ), // 0x06
|
|
|
|
M3OP( "i64.trunc_u:sat/f64",0, i_64, d_convertOpList (u64_TruncSat_f64), Compile_Convert ), // 0x07
|
|
|
|
M3OP_F( "i64.trunc_u:sat/f64",0, i_64, d_convertOpList (u64_TruncSat_f64), Compile_Convert ), // 0x07
|
|
|
|
|
|
|
|
|
|
|
|
# ifdef DEBUG
|
|
|
|
# ifdef DEBUG
|
|
|
|
M3OP( "termination", 0, c_m3Type_void ) // for find_operation_info
|
|
|
|
M3OP( "termination", 0, c_m3Type_void ) // for find_operation_info
|
|
|
|