diff options
author | Mike Pall <mike> | 2019-04-29 17:38:05 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2019-04-29 17:38:05 +0200 |
commit | 5802ab56b6435e8ea39616d04751b32b9996bfb7 (patch) | |
tree | d81d9f2363d5ab111db0cc2a6f84c9cb6a5ee474 | |
parent | 61464b0a5b685489bee7b6680c0e9663f2143a84 (diff) | |
download | luajit-5802ab56b6435e8ea39616d04751b32b9996bfb7.tar.gz luajit-5802ab56b6435e8ea39616d04751b32b9996bfb7.tar.bz2 luajit-5802ab56b6435e8ea39616d04751b32b9996bfb7.zip |
ARM: Fix condition code check fusion.
Reported by Qingjun Wei.
-rw-r--r-- | src/lj_asm_arm.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h index 961f7e39..8e0ebd7a 100644 --- a/src/lj_asm_arm.h +++ b/src/lj_asm_arm.h | |||
@@ -1449,19 +1449,10 @@ static void asm_intop(ASMState *as, IRIns *ir, ARMIns ai) | |||
1449 | emit_dn(as, ai^m, dest, left); | 1449 | emit_dn(as, ai^m, dest, left); |
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | static void asm_intop_s(ASMState *as, IRIns *ir, ARMIns ai) | 1452 | /* Try to drop cmp r, #0. */ |
1453 | { | 1453 | static ARMIns asm_drop_cmp0(ASMState *as, ARMIns ai) |
1454 | if (as->flagmcp == as->mcp) { /* Drop cmp r, #0. */ | ||
1455 | as->flagmcp = NULL; | ||
1456 | as->mcp++; | ||
1457 | ai |= ARMI_S; | ||
1458 | } | ||
1459 | asm_intop(as, ir, ai); | ||
1460 | } | ||
1461 | |||
1462 | static void asm_bitop(ASMState *as, IRIns *ir, ARMIns ai) | ||
1463 | { | 1454 | { |
1464 | if (as->flagmcp == as->mcp) { /* Try to drop cmp r, #0. */ | 1455 | if (as->flagmcp == as->mcp) { |
1465 | uint32_t cc = (as->mcp[1] >> 28); | 1456 | uint32_t cc = (as->mcp[1] >> 28); |
1466 | as->flagmcp = NULL; | 1457 | as->flagmcp = NULL; |
1467 | if (cc <= CC_NE) { | 1458 | if (cc <= CC_NE) { |
@@ -1473,8 +1464,19 @@ static void asm_bitop(ASMState *as, IRIns *ir, ARMIns ai) | |||
1473 | } else if (cc == CC_LT) { | 1464 | } else if (cc == CC_LT) { |
1474 | *++as->mcp ^= ((CC_LT^CC_MI) << 28); | 1465 | *++as->mcp ^= ((CC_LT^CC_MI) << 28); |
1475 | ai |= ARMI_S; | 1466 | ai |= ARMI_S; |
1476 | } /* else: other conds don't work with bit ops. */ | 1467 | } /* else: other conds don't work in general. */ |
1477 | } | 1468 | } |
1469 | return ai; | ||
1470 | } | ||
1471 | |||
1472 | static void asm_intop_s(ASMState *as, IRIns *ir, ARMIns ai) | ||
1473 | { | ||
1474 | asm_intop(as, ir, asm_drop_cmp0(as, ai)); | ||
1475 | } | ||
1476 | |||
1477 | static void asm_bitop(ASMState *as, IRIns *ir, ARMIns ai) | ||
1478 | { | ||
1479 | ai = asm_drop_cmp0(as, ai); | ||
1478 | if (ir->op2 == 0) { | 1480 | if (ir->op2 == 0) { |
1479 | Reg dest = ra_dest(as, ir, RSET_GPR); | 1481 | Reg dest = ra_dest(as, ir, RSET_GPR); |
1480 | uint32_t m = asm_fuseopm(as, ai, ir->op1, RSET_GPR); | 1482 | uint32_t m = asm_fuseopm(as, ai, ir->op1, RSET_GPR); |