diff options
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r-- | src/lj_asm.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index 81529a56..e05de41e 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -1595,6 +1595,24 @@ static void asm_tobit(ASMState *as, IRIns *ir) | |||
1595 | ra_left(as, tmp, ir->op1); | 1595 | ra_left(as, tmp, ir->op1); |
1596 | } | 1596 | } |
1597 | 1597 | ||
1598 | static void asm_toi64(ASMState *as, IRIns *ir) | ||
1599 | { | ||
1600 | Reg dest = ra_dest(as, ir, RSET_GPR); | ||
1601 | IRRef lref = ir->op1; | ||
1602 | lua_assert(LJ_64); /* NYI: 32 bit register pairs. */ | ||
1603 | if (ir->op2 == IRTOINT_TRUNCI64) { | ||
1604 | Reg left = asm_fuseload(as, lref, RSET_FPR); | ||
1605 | emit_mrm(as, XO_CVTTSD2SI, dest|REX_64, left); | ||
1606 | } else if (ir->op2 == IRTOINT_ZEXT64) { | ||
1607 | /* Nothing to do. This assumes 32 bit regs are already zero-extended. */ | ||
1608 | ra_left(as, dest, lref); /* But may need to move regs. */ | ||
1609 | } else { | ||
1610 | Reg left = asm_fuseload(as, lref, RSET_GPR); | ||
1611 | emit_mrm(as, XO_MOVSXd, dest|REX_64, left); | ||
1612 | lua_assert(ir->op2 == IRTOINT_SEXT64); | ||
1613 | } | ||
1614 | } | ||
1615 | |||
1598 | static void asm_strto(ASMState *as, IRIns *ir) | 1616 | static void asm_strto(ASMState *as, IRIns *ir) |
1599 | { | 1617 | { |
1600 | /* Force a spill slot for the destination register (if any). */ | 1618 | /* Force a spill slot for the destination register (if any). */ |
@@ -3531,6 +3549,7 @@ static void asm_ir(ASMState *as, IRIns *ir) | |||
3531 | asm_toint(as, ir); break; | 3549 | asm_toint(as, ir); break; |
3532 | break; | 3550 | break; |
3533 | case IR_TOBIT: asm_tobit(as, ir); break; | 3551 | case IR_TOBIT: asm_tobit(as, ir); break; |
3552 | case IR_TOI64: asm_toi64(as, ir); break; | ||
3534 | case IR_TOSTR: asm_tostr(as, ir); break; | 3553 | case IR_TOSTR: asm_tostr(as, ir); break; |
3535 | case IR_STRTO: asm_strto(as, ir); break; | 3554 | case IR_STRTO: asm_strto(as, ir); break; |
3536 | 3555 | ||