diff options
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r-- | src/lj_asm.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index 55bc814e..9cdbcf12 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -1893,9 +1893,8 @@ static void asm_sload(ASMState *as, IRIns *ir) | |||
1893 | IRType1 t = ir->t; | 1893 | IRType1 t = ir->t; |
1894 | Reg base; | 1894 | Reg base; |
1895 | lua_assert(!(ir->op2 & IRSLOAD_PARENT)); /* Handled by asm_head_side(). */ | 1895 | lua_assert(!(ir->op2 & IRSLOAD_PARENT)); /* Handled by asm_head_side(). */ |
1896 | lua_assert(!irt_isguard(ir->t) == | 1896 | lua_assert(irt_isguard(ir->t) || !(ir->op2 & IRSLOAD_TYPECHECK)); |
1897 | !((ir->op2 & IRSLOAD_TYPECHECK) || irt_isint(t))); | 1897 | if (irt_isint(t) && irt_isguard(t)) { |
1898 | if (irt_isint(t)) { | ||
1899 | Reg left = ra_scratch(as, RSET_FPR); | 1898 | Reg left = ra_scratch(as, RSET_FPR); |
1900 | asm_tointg(as, ir, left); /* Frees dest reg. Do this before base alloc. */ | 1899 | asm_tointg(as, ir, left); /* Frees dest reg. Do this before base alloc. */ |
1901 | base = ra_alloc1(as, REF_BASE, RSET_GPR); | 1900 | base = ra_alloc1(as, REF_BASE, RSET_GPR); |
@@ -1904,9 +1903,12 @@ static void asm_sload(ASMState *as, IRIns *ir) | |||
1904 | } else if (ra_used(ir)) { | 1903 | } else if (ra_used(ir)) { |
1905 | RegSet allow = irt_isnum(ir->t) ? RSET_FPR : RSET_GPR; | 1904 | RegSet allow = irt_isnum(ir->t) ? RSET_FPR : RSET_GPR; |
1906 | Reg dest = ra_dest(as, ir, allow); | 1905 | Reg dest = ra_dest(as, ir, allow); |
1907 | lua_assert(irt_isnum(ir->t) || irt_isaddr(ir->t)); | ||
1908 | base = ra_alloc1(as, REF_BASE, RSET_GPR); | 1906 | base = ra_alloc1(as, REF_BASE, RSET_GPR); |
1909 | emit_movrmro(as, dest, base, ofs); | 1907 | lua_assert(irt_isnum(t) || irt_isint(t) || irt_isaddr(t)); |
1908 | if (irt_isint(t)) | ||
1909 | emit_rmro(as, XO_CVTSD2SI, dest, base, ofs); | ||
1910 | else | ||
1911 | emit_movrmro(as, dest, base, ofs); | ||
1910 | } else { | 1912 | } else { |
1911 | if (!(ir->op2 & IRSLOAD_TYPECHECK)) | 1913 | if (!(ir->op2 & IRSLOAD_TYPECHECK)) |
1912 | return; /* No type check: avoid base alloc. */ | 1914 | return; /* No type check: avoid base alloc. */ |