浏览代码

Strength-reduce 32 to 64 bit widening for XLOAD U8/U16 inputs.

Mike Pall 14 年之前
父节点
当前提交
4c74f70464
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/lj_opt_fold.c

+ 3 - 0
src/lj_opt_fold.c

@@ -917,6 +917,8 @@ LJFOLDF(simplify_conv_sext)
   if (!(fins->op2 & IRCONV_SEXT))
     return NEXTFOLD;
   PHIBARRIER(fleft);
+  if (fleft->o == IR_XLOAD && (irt_isu8(fleft->t) || irt_isu16(fleft->t)))
+    goto ok_reduce;
   if (fleft->o == IR_ADD && irref_isk(fleft->op2)) {
     ofs = (int64_t)IR(fleft->op2)->i;
     ref = fleft->op1;
@@ -926,6 +928,7 @@ LJFOLDF(simplify_conv_sext)
     IRRef lo = J->scev.dir ? J->scev.start : J->scev.stop;
     lua_assert(irt_isint(J->scev.t));
     if (lo && IR(lo)->i + ofs >= 0) {
+    ok_reduce:
 #if LJ_TARGET_X64
       /* Eliminate widening. All 32 bit ops do an implicit zero-extension. */
       return LEFTFOLD;