codegen.c: `ADDI/SUBI` should not be prefixed by `OP_EXT`; fix #5590

As a general principles numeric instructions should not be prefixed by
`OP_EXT` instructions since they are not supported by "mruby/c".
parent 76659a66
...@@ -778,8 +778,8 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst) ...@@ -778,8 +778,8 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst)
struct mrb_insn_data data0 = mrb_decode_insn(mrb_prev_pc(s, data.addr)); struct mrb_insn_data data0 = mrb_decode_insn(mrb_prev_pc(s, data.addr));
mrb_int n0; mrb_int n0;
if (addr_pc(s, data.addr) == s->lastlabel || !get_int_operand(s, &data0, &n0)) { if (addr_pc(s, data.addr) == s->lastlabel || !get_int_operand(s, &data0, &n0)) {
/* OP_ADDI/OP_SUBI takes upto 16bits */ /* OP_ADDI/OP_SUBI takes upto 8bits */
if (n > INT16_MAX || n < INT16_MIN) goto normal; if (n > INT8_MAX || n < INT8_MIN) goto normal;
rewind_pc(s); rewind_pc(s);
if (n == 0) return; if (n == 0) return;
if (n > 0) { if (n > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment