aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-04-05 16:32:27 +0200
committerMike Pall <mike>2011-04-05 16:32:27 +0200
commit66a100617566ee710da85d01c5db21c65ba214b4 (patch)
tree75f20258a8628642e2ea4db7eed5bd42a8329fbc /src
parent3acd4892e96fb73a751852a079537adc3fd2d560 (diff)
downloadluajit-66a100617566ee710da85d01c5db21c65ba214b4.tar.gz
luajit-66a100617566ee710da85d01c5db21c65ba214b4.tar.bz2
luajit-66a100617566ee710da85d01c5db21c65ba214b4.zip
Fuse XLOAD/XSTORE operands more aggressively.
Diffstat (limited to 'src')
-rw-r--r--src/lj_asm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index 8af05e5a..a69f4461 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -97,6 +97,7 @@ typedef struct ASMState {
97#define FUSE_DISABLED (~(IRRef)0) 97#define FUSE_DISABLED (~(IRRef)0)
98#define mayfuse(as, ref) ((ref) > as->fuseref) 98#define mayfuse(as, ref) ((ref) > as->fuseref)
99#define neverfuse(as) (as->fuseref == FUSE_DISABLED) 99#define neverfuse(as) (as->fuseref == FUSE_DISABLED)
100#define canfuse(as, ir) (!neverfuse(as) && !irt_isphi((ir)->t))
100#define opisfusableload(o) \ 101#define opisfusableload(o) \
101 ((o) == IR_ALOAD || (o) == IR_HLOAD || (o) == IR_ULOAD || \ 102 ((o) == IR_ALOAD || (o) == IR_HLOAD || (o) == IR_ULOAD || \
102 (o) == IR_FLOAD || (o) == IR_XLOAD || (o) == IR_SLOAD || (o) == IR_VLOAD) 103 (o) == IR_FLOAD || (o) == IR_XLOAD || (o) == IR_SLOAD || (o) == IR_VLOAD)
@@ -1348,7 +1349,7 @@ static void asm_fusexref(ASMState *as, IRRef ref, RegSet allow)
1348 asm_fusestrref(as, ir, allow); 1349 asm_fusestrref(as, ir, allow);
1349 } else { 1350 } else {
1350 as->mrm.ofs = 0; 1351 as->mrm.ofs = 0;
1351 if (mayfuse(as, ref) && ir->o == IR_ADD && ra_noreg(ir->r)) { 1352 if (canfuse(as, ir) && ir->o == IR_ADD && ra_noreg(ir->r)) {
1352 /* Gather (base+idx*sz)+ofs as emitted by cdata ptr/array indexing. */ 1353 /* Gather (base+idx*sz)+ofs as emitted by cdata ptr/array indexing. */
1353 IRIns *irx; 1354 IRIns *irx;
1354 IRRef idx; 1355 IRRef idx;
@@ -1356,7 +1357,7 @@ static void asm_fusexref(ASMState *as, IRRef ref, RegSet allow)
1356 if (asm_isk32(as, ir->op2, &as->mrm.ofs)) { /* Recognize x+ofs. */ 1357 if (asm_isk32(as, ir->op2, &as->mrm.ofs)) { /* Recognize x+ofs. */
1357 ref = ir->op1; 1358 ref = ir->op1;
1358 ir = IR(ref); 1359 ir = IR(ref);
1359 if (!(ir->o == IR_ADD && mayfuse(as, ref) && ra_noreg(ir->r))) 1360 if (!(ir->o == IR_ADD && canfuse(as, ir) && ra_noreg(ir->r)))
1360 goto noadd; 1361 goto noadd;
1361 } 1362 }
1362 as->mrm.scale = XM_SCALE1; 1363 as->mrm.scale = XM_SCALE1;
@@ -1368,7 +1369,7 @@ static void asm_fusexref(ASMState *as, IRRef ref, RegSet allow)
1368 ref = ir->op1; 1369 ref = ir->op1;
1369 irx = IR(idx); 1370 irx = IR(idx);
1370 } 1371 }
1371 if (mayfuse(as, idx) && ra_noreg(irx->r)) { 1372 if (canfuse(as, irx) && ra_noreg(irx->r)) {
1372 if (irx->o == IR_BSHL && irref_isk(irx->op2) && IR(irx->op2)->i <= 3) { 1373 if (irx->o == IR_BSHL && irref_isk(irx->op2) && IR(irx->op2)->i <= 3) {
1373 /* Recognize idx<<b with b = 0-3, corresponding to sz = (1),2,4,8. */ 1374 /* Recognize idx<<b with b = 0-3, corresponding to sz = (1),2,4,8. */
1374 idx = irx->op1; 1375 idx = irx->op1;