diff options
Diffstat (limited to '')
-rw-r--r-- | src/lj_asm_x86.h | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index e9c53a09..5621b616 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h | |||
@@ -551,7 +551,7 @@ static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci) | |||
551 | if (ra_hasreg(dest)) { | 551 | if (ra_hasreg(dest)) { |
552 | ra_free(as, dest); | 552 | ra_free(as, dest); |
553 | ra_modified(as, dest); | 553 | ra_modified(as, dest); |
554 | emit_rmro(as, irt_isnum(ir->t) ? XMM_MOVRM(as) : XO_MOVSS, | 554 | emit_rmro(as, irt_isnum(ir->t) ? XO_MOVSD : XO_MOVSS, |
555 | dest, RID_ESP, ofs); | 555 | dest, RID_ESP, ofs); |
556 | } | 556 | } |
557 | if ((ci->flags & CCI_CASTU64)) { | 557 | if ((ci->flags & CCI_CASTU64)) { |
@@ -662,8 +662,7 @@ static void asm_tointg(ASMState *as, IRIns *ir, Reg left) | |||
662 | asm_guardcc(as, CC_NE); | 662 | asm_guardcc(as, CC_NE); |
663 | emit_rr(as, XO_UCOMISD, left, tmp); | 663 | emit_rr(as, XO_UCOMISD, left, tmp); |
664 | emit_rr(as, XO_CVTSI2SD, tmp, dest); | 664 | emit_rr(as, XO_CVTSI2SD, tmp, dest); |
665 | if (!(as->flags & JIT_F_SPLIT_XMM)) | 665 | emit_rr(as, XO_XORPS, tmp, tmp); /* Avoid partial register stall. */ |
666 | emit_rr(as, XO_XORPS, tmp, tmp); /* Avoid partial register stall. */ | ||
667 | emit_rr(as, XO_CVTTSD2SI, dest, left); | 666 | emit_rr(as, XO_CVTTSD2SI, dest, left); |
668 | /* Can't fuse since left is needed twice. */ | 667 | /* Can't fuse since left is needed twice. */ |
669 | } | 668 | } |
@@ -719,8 +718,7 @@ static void asm_conv(ASMState *as, IRIns *ir) | |||
719 | emit_mrm(as, irt_isnum(ir->t) ? XO_CVTSI2SD : XO_CVTSI2SS, | 718 | emit_mrm(as, irt_isnum(ir->t) ? XO_CVTSI2SD : XO_CVTSI2SS, |
720 | dest|((LJ_64 && (st64 || st == IRT_U32)) ? REX_64 : 0), left); | 719 | dest|((LJ_64 && (st64 || st == IRT_U32)) ? REX_64 : 0), left); |
721 | } | 720 | } |
722 | if (!(as->flags & JIT_F_SPLIT_XMM)) | 721 | emit_rr(as, XO_XORPS, dest, dest); /* Avoid partial register stall. */ |
723 | emit_rr(as, XO_XORPS, dest, dest); /* Avoid partial register stall. */ | ||
724 | } else if (stfp) { /* FP to integer conversion. */ | 722 | } else if (stfp) { /* FP to integer conversion. */ |
725 | if (irt_isguard(ir->t)) { | 723 | if (irt_isguard(ir->t)) { |
726 | /* Checked conversions are only supported from number to int. */ | 724 | /* Checked conversions are only supported from number to int. */ |
@@ -824,8 +822,7 @@ static void asm_conv_fp_int64(ASMState *as, IRIns *ir) | |||
824 | if (ra_hasreg(dest)) { | 822 | if (ra_hasreg(dest)) { |
825 | ra_free(as, dest); | 823 | ra_free(as, dest); |
826 | ra_modified(as, dest); | 824 | ra_modified(as, dest); |
827 | emit_rmro(as, irt_isnum(ir->t) ? XMM_MOVRM(as) : XO_MOVSS, | 825 | emit_rmro(as, irt_isnum(ir->t) ? XO_MOVSD : XO_MOVSS, dest, RID_ESP, ofs); |
828 | dest, RID_ESP, ofs); | ||
829 | } | 826 | } |
830 | emit_rmro(as, irt_isnum(ir->t) ? XO_FSTPq : XO_FSTPd, | 827 | emit_rmro(as, irt_isnum(ir->t) ? XO_FSTPq : XO_FSTPd, |
831 | irt_isnum(ir->t) ? XOg_FSTPq : XOg_FSTPd, RID_ESP, ofs); | 828 | irt_isnum(ir->t) ? XOg_FSTPq : XOg_FSTPd, RID_ESP, ofs); |
@@ -1262,7 +1259,7 @@ static void asm_fxload(ASMState *as, IRIns *ir) | |||
1262 | case IRT_U8: xo = XO_MOVZXb; break; | 1259 | case IRT_U8: xo = XO_MOVZXb; break; |
1263 | case IRT_I16: xo = XO_MOVSXw; break; | 1260 | case IRT_I16: xo = XO_MOVSXw; break; |
1264 | case IRT_U16: xo = XO_MOVZXw; break; | 1261 | case IRT_U16: xo = XO_MOVZXw; break; |
1265 | case IRT_NUM: xo = XMM_MOVRM(as); break; | 1262 | case IRT_NUM: xo = XO_MOVSD; break; |
1266 | case IRT_FLOAT: xo = XO_MOVSS; break; | 1263 | case IRT_FLOAT: xo = XO_MOVSS; break; |
1267 | default: | 1264 | default: |
1268 | if (LJ_64 && irt_is64(ir->t)) | 1265 | if (LJ_64 && irt_is64(ir->t)) |
@@ -1376,7 +1373,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) | |||
1376 | RegSet allow = irt_isnum(ir->t) ? RSET_FPR : RSET_GPR; | 1373 | RegSet allow = irt_isnum(ir->t) ? RSET_FPR : RSET_GPR; |
1377 | Reg dest = ra_dest(as, ir, allow); | 1374 | Reg dest = ra_dest(as, ir, allow); |
1378 | asm_fuseahuref(as, ir->op1, RSET_GPR); | 1375 | asm_fuseahuref(as, ir->op1, RSET_GPR); |
1379 | emit_mrm(as, dest < RID_MAX_GPR ? XO_MOV : XMM_MOVRM(as), dest, RID_MRM); | 1376 | emit_mrm(as, dest < RID_MAX_GPR ? XO_MOV : XO_MOVSD, dest, RID_MRM); |
1380 | } else { | 1377 | } else { |
1381 | asm_fuseahuref(as, ir->op1, RSET_GPR); | 1378 | asm_fuseahuref(as, ir->op1, RSET_GPR); |
1382 | } | 1379 | } |
@@ -1442,7 +1439,7 @@ static void asm_sload(ASMState *as, IRIns *ir) | |||
1442 | Reg left = ra_scratch(as, RSET_FPR); | 1439 | Reg left = ra_scratch(as, RSET_FPR); |
1443 | asm_tointg(as, ir, left); /* Frees dest reg. Do this before base alloc. */ | 1440 | asm_tointg(as, ir, left); /* Frees dest reg. Do this before base alloc. */ |
1444 | base = ra_alloc1(as, REF_BASE, RSET_GPR); | 1441 | base = ra_alloc1(as, REF_BASE, RSET_GPR); |
1445 | emit_rmro(as, XMM_MOVRM(as), left, base, ofs); | 1442 | emit_rmro(as, XO_MOVSD, left, base, ofs); |
1446 | t.irt = IRT_NUM; /* Continue with a regular number type check. */ | 1443 | t.irt = IRT_NUM; /* Continue with a regular number type check. */ |
1447 | #if LJ_64 | 1444 | #if LJ_64 |
1448 | } else if (irt_islightud(t)) { | 1445 | } else if (irt_islightud(t)) { |
@@ -1461,10 +1458,8 @@ static void asm_sload(ASMState *as, IRIns *ir) | |||
1461 | if ((ir->op2 & IRSLOAD_CONVERT)) { | 1458 | if ((ir->op2 & IRSLOAD_CONVERT)) { |
1462 | t.irt = irt_isint(t) ? IRT_NUM : IRT_INT; /* Check for original type. */ | 1459 | t.irt = irt_isint(t) ? IRT_NUM : IRT_INT; /* Check for original type. */ |
1463 | emit_rmro(as, irt_isint(t) ? XO_CVTSI2SD : XO_CVTSD2SI, dest, base, ofs); | 1460 | emit_rmro(as, irt_isint(t) ? XO_CVTSI2SD : XO_CVTSD2SI, dest, base, ofs); |
1464 | } else if (irt_isnum(t)) { | ||
1465 | emit_rmro(as, XMM_MOVRM(as), dest, base, ofs); | ||
1466 | } else { | 1461 | } else { |
1467 | emit_rmro(as, XO_MOV, dest, base, ofs); | 1462 | emit_rmro(as, irt_isnum(t) ? XO_MOVSD : XO_MOV, dest, base, ofs); |
1468 | } | 1463 | } |
1469 | } else { | 1464 | } else { |
1470 | if (!(ir->op2 & IRSLOAD_TYPECHECK)) | 1465 | if (!(ir->op2 & IRSLOAD_TYPECHECK)) |
@@ -1696,7 +1691,7 @@ static void asm_fpmath(ASMState *as, IRIns *ir) | |||
1696 | if (ra_hasreg(dest)) { | 1691 | if (ra_hasreg(dest)) { |
1697 | ra_free(as, dest); | 1692 | ra_free(as, dest); |
1698 | ra_modified(as, dest); | 1693 | ra_modified(as, dest); |
1699 | emit_rmro(as, XMM_MOVRM(as), dest, RID_ESP, ofs); | 1694 | emit_rmro(as, XO_MOVSD, dest, RID_ESP, ofs); |
1700 | } | 1695 | } |
1701 | emit_rmro(as, XO_FSTPq, XOg_FSTPq, RID_ESP, ofs); | 1696 | emit_rmro(as, XO_FSTPq, XOg_FSTPq, RID_ESP, ofs); |
1702 | switch (fpm) { /* st0 = lj_vm_*(st0) */ | 1697 | switch (fpm) { /* st0 = lj_vm_*(st0) */ |