aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2023-11-14 22:56:09 +0100
committerMike Pall <mike>2023-11-14 22:56:09 +0100
commit536cf8a2715b64902f56a3c01fc4e030c8add93b (patch)
treef0f3754693197d5e33ef6deb97dbc48ddc008919
parent113a168b792cd367822ec04cdc2ef32facd28efa (diff)
parent644723649ea04cb23b72c814b88b72a29e4afed4 (diff)
downloadluajit-536cf8a2715b64902f56a3c01fc4e030c8add93b.tar.gz
luajit-536cf8a2715b64902f56a3c01fc4e030c8add93b.tar.bz2
luajit-536cf8a2715b64902f56a3c01fc4e030c8add93b.zip
Merge branch 'master' into v2.1
-rw-r--r--src/lj_asm_x86.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h
index 955a54a4..9fa411a0 100644
--- a/src/lj_asm_x86.h
+++ b/src/lj_asm_x86.h
@@ -109,7 +109,7 @@ static int asm_isk32(ASMState *as, IRRef ref, int32_t *k)
109/* Check if there's no conflicting instruction between curins and ref. 109/* Check if there's no conflicting instruction between curins and ref.
110** Also avoid fusing loads if there are multiple references. 110** Also avoid fusing loads if there are multiple references.
111*/ 111*/
112static int noconflict(ASMState *as, IRRef ref, IROp conflict, int noload) 112static int noconflict(ASMState *as, IRRef ref, IROp conflict, int check)
113{ 113{
114 IRIns *ir = as->ir; 114 IRIns *ir = as->ir;
115 IRRef i = as->curins; 115 IRRef i = as->curins;
@@ -118,7 +118,9 @@ static int noconflict(ASMState *as, IRRef ref, IROp conflict, int noload)
118 while (--i > ref) { 118 while (--i > ref) {
119 if (ir[i].o == conflict) 119 if (ir[i].o == conflict)
120 return 0; /* Conflict found. */ 120 return 0; /* Conflict found. */
121 else if (!noload && (ir[i].op1 == ref || ir[i].op2 == ref)) 121 else if ((check & 1) && ir[i].o == IR_NEWREF)
122 return 0;
123 else if ((check & 2) && (ir[i].op1 == ref || ir[i].op2 == ref))
122 return 0; 124 return 0;
123 } 125 }
124 return 1; /* Ok, no conflict. */ 126 return 1; /* Ok, no conflict. */
@@ -134,7 +136,7 @@ static IRRef asm_fuseabase(ASMState *as, IRRef ref)
134 lj_assertA(irb->op2 == IRFL_TAB_ARRAY, "expected FLOAD TAB_ARRAY"); 136 lj_assertA(irb->op2 == IRFL_TAB_ARRAY, "expected FLOAD TAB_ARRAY");
135 /* We can avoid the FLOAD of t->array for colocated arrays. */ 137 /* We can avoid the FLOAD of t->array for colocated arrays. */
136 if (ira->o == IR_TNEW && ira->op1 <= LJ_MAX_COLOSIZE && 138 if (ira->o == IR_TNEW && ira->op1 <= LJ_MAX_COLOSIZE &&
137 !neverfuse(as) && noconflict(as, irb->op1, IR_NEWREF, 1)) { 139 !neverfuse(as) && noconflict(as, irb->op1, IR_NEWREF, 0)) {
138 as->mrm.ofs = (int32_t)sizeof(GCtab); /* Ofs to colocated array. */ 140 as->mrm.ofs = (int32_t)sizeof(GCtab); /* Ofs to colocated array. */
139 return irb->op1; /* Table obj. */ 141 return irb->op1; /* Table obj. */
140 } 142 }
@@ -456,7 +458,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
456 RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR; 458 RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR;
457 if (ir->o == IR_SLOAD) { 459 if (ir->o == IR_SLOAD) {
458 if (!(ir->op2 & (IRSLOAD_PARENT|IRSLOAD_CONVERT)) && 460 if (!(ir->op2 & (IRSLOAD_PARENT|IRSLOAD_CONVERT)) &&
459 noconflict(as, ref, IR_RETF, 0) && 461 noconflict(as, ref, IR_RETF, 2) &&
460 !(LJ_GC64 && irt_isaddr(ir->t))) { 462 !(LJ_GC64 && irt_isaddr(ir->t))) {
461 as->mrm.base = (uint8_t)ra_alloc1(as, REF_BASE, xallow); 463 as->mrm.base = (uint8_t)ra_alloc1(as, REF_BASE, xallow);
462 as->mrm.ofs = 8*((int32_t)ir->op1-1-LJ_FR2) + 464 as->mrm.ofs = 8*((int32_t)ir->op1-1-LJ_FR2) +
@@ -467,13 +469,12 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
467 } else if (ir->o == IR_FLOAD) { 469 } else if (ir->o == IR_FLOAD) {
468 /* Generic fusion is only ok for 32 bit operand (but see asm_comp). */ 470 /* Generic fusion is only ok for 32 bit operand (but see asm_comp). */
469 if ((irt_isint(ir->t) || irt_isu32(ir->t) || irt_isaddr(ir->t)) && 471 if ((irt_isint(ir->t) || irt_isu32(ir->t) || irt_isaddr(ir->t)) &&
470 noconflict(as, ref, IR_FSTORE, 0)) { 472 noconflict(as, ref, IR_FSTORE, 2)) {
471 asm_fusefref(as, ir, xallow); 473 asm_fusefref(as, ir, xallow);
472 return RID_MRM; 474 return RID_MRM;
473 } 475 }
474 } else if (ir->o == IR_ALOAD || ir->o == IR_HLOAD || ir->o == IR_ULOAD) { 476 } else if (ir->o == IR_ALOAD || ir->o == IR_HLOAD || ir->o == IR_ULOAD) {
475 if (noconflict(as, ref, ir->o + IRDELTA_L2S, 0) && 477 if (noconflict(as, ref, ir->o + IRDELTA_L2S, 2+(ir->o != IR_ULOAD)) &&
476 noconflict(as, ref, IR_CALLS, 1) && /* Don't cross table.clear. */
477 !(LJ_GC64 && irt_isaddr(ir->t))) { 478 !(LJ_GC64 && irt_isaddr(ir->t))) {
478 asm_fuseahuref(as, ir->op1, xallow); 479 asm_fuseahuref(as, ir->op1, xallow);
479 return RID_MRM; 480 return RID_MRM;
@@ -483,7 +484,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
483 ** Fusing unaligned memory operands is ok on x86 (except for SIMD types). 484 ** Fusing unaligned memory operands is ok on x86 (except for SIMD types).
484 */ 485 */
485 if ((!irt_typerange(ir->t, IRT_I8, IRT_U16)) && 486 if ((!irt_typerange(ir->t, IRT_I8, IRT_U16)) &&
486 noconflict(as, ref, IR_XSTORE, 0)) { 487 noconflict(as, ref, IR_XSTORE, 2)) {
487 asm_fusexref(as, ir->op1, xallow); 488 asm_fusexref(as, ir->op1, xallow);
488 return RID_MRM; 489 return RID_MRM;
489 } 490 }