Removed arithmetic opcodes with immediate operand

The difference in performance between immediate operands and K operands
does not seem to justify all those extra opcodes. We only keep OP_ADDI,
due to its ubiquity and because the difference is a little more relevant.
(Later, OP_SUBI will be implemented by OP_ADDI, negating the constant.)
This commit is contained in:
Roberto Ierusalimschy
2019-09-10 13:20:03 -03:00
parent 4518e5df24
commit 91dad09f65
7 changed files with 17 additions and 65 deletions

24
lvm.c
View File

@@ -1271,30 +1271,6 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
op_arithI(L, l_addi, luai_numadd, TM_ADD, GETARG_k(i));
vmbreak;
}
vmcase(OP_SUBI) {
op_arithI(L, l_subi, luai_numsub, TM_SUB, 0);
vmbreak;
}
vmcase(OP_MULI) {
op_arithI(L, l_muli, luai_nummul, TM_MUL, GETARG_k(i));
vmbreak;
}
vmcase(OP_MODI) {
op_arithI(L, luaV_mod, luaV_modf, TM_MOD, 0);
vmbreak;
}
vmcase(OP_POWI) {
op_arithfI(L, luai_numpow, TM_POW);
vmbreak;
}
vmcase(OP_DIVI) {
op_arithfI(L, luai_numdiv, TM_DIV);
vmbreak;
}
vmcase(OP_IDIVI) {
op_arithI(L, luaV_idiv, luai_numidiv, TM_IDIV, 0);
vmbreak;
}
vmcase(OP_ADDK) {
op_arithK(L, l_addi, luai_numadd, GETARG_k(i));
vmbreak;