aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm_mips.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_asm_mips.h37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h
index cd32d038..7f7dc6a0 100644
--- a/src/lj_asm_mips.h
+++ b/src/lj_asm_mips.h
@@ -351,19 +351,15 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
351static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci) 351static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
352{ 352{
353 RegSet drop = RSET_SCRATCH; 353 RegSet drop = RSET_SCRATCH;
354#if LJ_32
355 int hiop = ((ir+1)->o == IR_HIOP && !irt_isnil((ir+1)->t)); 354 int hiop = ((ir+1)->o == IR_HIOP && !irt_isnil((ir+1)->t));
356#endif
357#if !LJ_SOFTFP 355#if !LJ_SOFTFP
358 if ((ci->flags & CCI_NOFPRCLOBBER)) 356 if ((ci->flags & CCI_NOFPRCLOBBER))
359 drop &= ~RSET_FPR; 357 drop &= ~RSET_FPR;
360#endif 358#endif
361 if (ra_hasreg(ir->r)) 359 if (ra_hasreg(ir->r))
362 rset_clear(drop, ir->r); /* Dest reg handled below. */ 360 rset_clear(drop, ir->r); /* Dest reg handled below. */
363#if LJ_32
364 if (hiop && ra_hasreg((ir+1)->r)) 361 if (hiop && ra_hasreg((ir+1)->r))
365 rset_clear(drop, (ir+1)->r); /* Dest reg handled below. */ 362 rset_clear(drop, (ir+1)->r); /* Dest reg handled below. */
366#endif
367 ra_evictset(as, drop); /* Evictions must be performed first. */ 363 ra_evictset(as, drop); /* Evictions must be performed first. */
368 if (ra_used(ir)) { 364 if (ra_used(ir)) {
369 lj_assertA(!irt_ispri(ir->t), "PRI dest"); 365 lj_assertA(!irt_ispri(ir->t), "PRI dest");
@@ -392,10 +388,8 @@ static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
392 } else { 388 } else {
393 ra_destreg(as, ir, RID_FPRET); 389 ra_destreg(as, ir, RID_FPRET);
394 } 390 }
395#if LJ_32
396 } else if (hiop) { 391 } else if (hiop) {
397 ra_destpair(as, ir); 392 ra_destpair(as, ir);
398#endif
399 } else { 393 } else {
400 ra_destreg(as, ir, RID_RET); 394 ra_destreg(as, ir, RID_RET);
401 } 395 }
@@ -2393,15 +2387,15 @@ static void asm_comp64eq(ASMState *as, IRIns *ir)
2393} 2387}
2394#endif 2388#endif
2395 2389
2396/* -- Support for 64 bit ops in 32 bit mode ------------------------------- */ 2390/* -- Split register ops -------------------------------------------------- */
2397 2391
2398/* Hiword op of a split 64 bit op. Previous op must be the loword op. */ 2392/* Hiword op of a split 32/32 or 64/64 bit op. Previous op is the loword op. */
2399static void asm_hiop(ASMState *as, IRIns *ir) 2393static void asm_hiop(ASMState *as, IRIns *ir)
2400{ 2394{
2401#if LJ_32 && (LJ_HASFFI || LJ_SOFTFP)
2402 /* HIOP is marked as a store because it needs its own DCE logic. */ 2395 /* HIOP is marked as a store because it needs its own DCE logic. */
2403 int uselo = ra_used(ir-1), usehi = ra_used(ir); /* Loword/hiword used? */ 2396 int uselo = ra_used(ir-1), usehi = ra_used(ir); /* Loword/hiword used? */
2404 if (LJ_UNLIKELY(!(as->flags & JIT_F_OPT_DCE))) uselo = usehi = 1; 2397 if (LJ_UNLIKELY(!(as->flags & JIT_F_OPT_DCE))) uselo = usehi = 1;
2398#if LJ_32 && (LJ_HASFFI || LJ_SOFTFP)
2405 if ((ir-1)->o == IR_CONV) { /* Conversions to/from 64 bit. */ 2399 if ((ir-1)->o == IR_CONV) { /* Conversions to/from 64 bit. */
2406 as->curins--; /* Always skip the CONV. */ 2400 as->curins--; /* Always skip the CONV. */
2407#if LJ_HASFFI && !LJ_SOFTFP 2401#if LJ_HASFFI && !LJ_SOFTFP
@@ -2448,38 +2442,33 @@ static void asm_hiop(ASMState *as, IRIns *ir)
2448 } 2442 }
2449 return; 2443 return;
2450 } 2444 }
2445#endif
2451 if (!usehi) return; /* Skip unused hiword op for all remaining ops. */ 2446 if (!usehi) return; /* Skip unused hiword op for all remaining ops. */
2452 switch ((ir-1)->o) { 2447 switch ((ir-1)->o) {
2453#if LJ_HASFFI 2448#if LJ_32 && LJ_HASFFI
2454 case IR_ADD: as->curins--; asm_add64(as, ir); break; 2449 case IR_ADD: as->curins--; asm_add64(as, ir); break;
2455 case IR_SUB: as->curins--; asm_sub64(as, ir); break; 2450 case IR_SUB: as->curins--; asm_sub64(as, ir); break;
2456 case IR_NEG: as->curins--; asm_neg64(as, ir); break; 2451 case IR_NEG: as->curins--; asm_neg64(as, ir); break;
2452 case IR_CNEWI:
2453 /* Nothing to do here. Handled by lo op itself. */
2454 break;
2457#endif 2455#endif
2458#if LJ_SOFTFP 2456#if LJ_32 && LJ_SOFTFP
2459 case IR_SLOAD: case IR_ALOAD: case IR_HLOAD: case IR_ULOAD: case IR_VLOAD: 2457 case IR_SLOAD: case IR_ALOAD: case IR_HLOAD: case IR_ULOAD: case IR_VLOAD:
2460 case IR_STRTO: 2458 case IR_STRTO:
2461 if (!uselo) 2459 if (!uselo)
2462 ra_allocref(as, ir->op1, RSET_GPR); /* Mark lo op as used. */ 2460 ra_allocref(as, ir->op1, RSET_GPR); /* Mark lo op as used. */
2463 break; 2461 break;
2462 case IR_ASTORE: case IR_HSTORE: case IR_USTORE: case IR_TOSTR: case IR_TMPREF:
2463 /* Nothing to do here. Handled by lo op itself. */
2464 break;
2464#endif 2465#endif
2465 case IR_CALLN: 2466 case IR_CALLN: case IR_CALLL: case IR_CALLS: case IR_CALLXS:
2466 case IR_CALLS:
2467 case IR_CALLXS:
2468 if (!uselo) 2467 if (!uselo)
2469 ra_allocref(as, ir->op1, RID2RSET(RID_RETLO)); /* Mark lo op as used. */ 2468 ra_allocref(as, ir->op1, RID2RSET(RID_RETLO)); /* Mark lo op as used. */
2470 break; 2469 break;
2471#if LJ_SOFTFP
2472 case IR_ASTORE: case IR_HSTORE: case IR_USTORE: case IR_TOSTR: case IR_TMPREF:
2473#endif
2474 case IR_CNEWI:
2475 /* Nothing to do here. Handled by lo op itself. */
2476 break;
2477 default: lj_assertA(0, "bad HIOP for op %d", (ir-1)->o); break; 2470 default: lj_assertA(0, "bad HIOP for op %d", (ir-1)->o); break;
2478 } 2471 }
2479#else
2480 /* Unused on MIPS64 or without SOFTFP or FFI. */
2481 UNUSED(as); UNUSED(ir); lj_assertA(0, "unexpected HIOP");
2482#endif
2483} 2472}
2484 2473
2485/* -- Profiling ----------------------------------------------------------- */ 2474/* -- Profiling ----------------------------------------------------------- */