]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Strength-reduce 32 to 64 bit widening for XLOAD U8/U16 inputs.
authorMike Pall <mike>
Sat, 5 Feb 2011 23:45:39 +0000 (00:45 +0100)
committerMike Pall <mike>
Sat, 5 Feb 2011 23:45:39 +0000 (00:45 +0100)
src/lj_opt_fold.c

index 1172f4fcad581af39a401193937c655f35ca22ed..f4872046cfe60b2f53b67d794e5f8547c79c203a 100644 (file)
@@ -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;