aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2016-12-08 22:38:35 +0100
committerMike Pall <mike>2016-12-08 22:38:35 +0100
commitec2756ba786cd68a0af37ec8ffe806f3ce392d7d (patch)
treee0a8b5fe5f10559aab66cf91be645a37e1f1b29d /src
parent986854cbb2fa08514e10d9d4d5ded2b7f5f60445 (diff)
downloadluajit-ec2756ba786cd68a0af37ec8ffe806f3ce392d7d.tar.gz
luajit-ec2756ba786cd68a0af37ec8ffe806f3ce392d7d.tar.bz2
luajit-ec2756ba786cd68a0af37ec8ffe806f3ce392d7d.zip
Add missing FOLD rule for 64 bit shift+BAND simplification.
Diffstat (limited to 'src')
-rw-r--r--src/lj_opt_fold.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c
index 5f4b8810..a72aa440 100644
--- a/src/lj_opt_fold.c
+++ b/src/lj_opt_fold.c
@@ -347,6 +347,11 @@ static uint64_t kfold_int64arith(uint64_t k1, uint64_t k2, IROp op)
347 case IR_BAND: k1 &= k2; break; 347 case IR_BAND: k1 &= k2; break;
348 case IR_BOR: k1 |= k2; break; 348 case IR_BOR: k1 |= k2; break;
349 case IR_BXOR: k1 ^= k2; break; 349 case IR_BXOR: k1 ^= k2; break;
350 case IR_BSHL: k1 <<= (k2 & 63); break;
351 case IR_BSHR: k1 = (int32_t)((uint32_t)k1 >> (k2 & 63)); break;
352 case IR_BSAR: k1 >>= (k2 & 63); break;
353 case IR_BROL: k1 = (int32_t)lj_rol((uint32_t)k1, (k2 & 63)); break;
354 case IR_BROR: k1 = (int32_t)lj_ror((uint32_t)k1, (k2 & 63)); break;
350#endif 355#endif
351 default: UNUSED(k2); lua_assert(0); break; 356 default: UNUSED(k2); lua_assert(0); break;
352 } 357 }
@@ -1653,6 +1658,14 @@ LJFOLDF(simplify_shiftk_andk)
1653 fins->op2 = (IRRef1)lj_ir_kint(J, k); 1658 fins->op2 = (IRRef1)lj_ir_kint(J, k);
1654 fins->ot = IRTI(IR_BAND); 1659 fins->ot = IRTI(IR_BAND);
1655 return RETRYFOLD; 1660 return RETRYFOLD;
1661 } else if (irk->o == IR_KINT64) {
1662 uint64_t k = kfold_int64arith(ir_k64(irk)->u64, fright->i, (IROp)fins->o);
1663 IROpT ot = fleft->ot;
1664 fins->op1 = fleft->op1;
1665 fins->op1 = (IRRef1)lj_opt_fold(J);
1666 fins->op2 = (IRRef1)lj_ir_kint64(J, k);
1667 fins->ot = ot;
1668 return RETRYFOLD;
1656 } 1669 }
1657 return NEXTFOLD; 1670 return NEXTFOLD;
1658} 1671}