From 8c5935000d2b9bccd6c563b45c6a893f28986ca5 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 3 Jun 2011 18:48:02 +0200 Subject: Add narrowing of modulo operator. --- src/lj_asm_arm.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/lj_asm_arm.h') diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h index 5890b54f..74a3a927 100644 --- a/src/lj_asm_arm.h +++ b/src/lj_asm_arm.h @@ -1110,6 +1110,16 @@ static void asm_intmul(ASMState *as, IRIns *ir) if (ra_hasreg(tmp)) emit_dm(as, ARMI_MOV, tmp, right); } +static void asm_intmod(ASMState *as, IRIns *ir) +{ + const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_vm_modi]; + IRRef args[2]; + args[0] = ir->op1; + args[1] = ir->op2; + asm_setupresult(as, ir, ci); + asm_gencall(as, ci, args); +} + static void asm_bitswap(ASMState *as, IRIns *ir) { Reg dest = ra_dest(as, ir, RSET_GPR); @@ -1652,6 +1662,7 @@ static void asm_ir(ASMState *as, IRIns *ir) case IR_ADD: case IR_ADDOV: asm_arithop(as, ir, ARMI_ADD); break; case IR_SUB: case IR_SUBOV: asm_arithop(as, ir, ARMI_SUB); break; case IR_MUL: case IR_MULOV: asm_intmul(as, ir); break; + case IR_MOD: asm_intmod(as, ir); break; case IR_NEG: asm_intneg(as, ir, ARMI_RSB); break; @@ -1659,7 +1670,7 @@ static void asm_ir(ASMState *as, IRIns *ir) case IR_MAX: asm_intmin_max(as, ir, CC_LT); break; case IR_FPMATH: case IR_ATAN2: case IR_LDEXP: - case IR_DIV: case IR_MOD: case IR_POW: case IR_ABS: case IR_TOBIT: + case IR_DIV: case IR_POW: case IR_ABS: case IR_TOBIT: lua_assert(0); /* Unused for LJ_SOFTFP. */ break; -- cgit v1.2.3-55-g6feb