codegen.c: allow OP_EXT before OP_ADDI and OP_SUBI.

This is preparation for integer constant folding.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-07-20 11:07:37 +09:00
parent 43f6f765b0
commit cdf54f3159
+3 -3
View File
@@ -584,14 +584,14 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst)
data.b = data.insn - OP_LOADI_0;
/* fall through */
case OP_LOADI:
case OP_LOADI16:
replace:
if (data.b >= 128) goto normal;
s->pc = s->lastpc;
if (op == OP_ADD) {
genop_2(s, OP_ADDI, dst, (uint8_t)data.b);
genop_2(s, OP_ADDI, dst, data.b);
}
else {
genop_2(s, OP_SUBI, dst, (uint8_t)data.b);
genop_2(s, OP_SUBI, dst, data.b);
}
break;
default: