]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Add missing FOLD rule for integer NEG of constants.
authorMike Pall <mike>
Mon, 17 Oct 2011 15:21:09 +0000 (17:21 +0200)
committerMike Pall <mike>
Mon, 17 Oct 2011 15:21:09 +0000 (17:21 +0200)
src/lj_opt_fold.c

index 43685cdb467b1f1408928ab9116883177604f550..1aed8cd2aecdc1ffd2e81729969424716f5f5afd 100644 (file)
@@ -232,6 +232,7 @@ static int32_t kfold_intop(int32_t k1, int32_t k2, IROp op)
   case IR_SUB: k1 -= k2; break;
   case IR_MUL: k1 *= k2; break;
   case IR_MOD: k1 = lj_vm_modi(k1, k2); break;
+  case IR_NEG: k1 = -k1; break;
   case IR_BAND: k1 &= k2; break;
   case IR_BOR: k1 |= k2; break;
   case IR_BXOR: k1 ^= k2; break;
@@ -251,6 +252,7 @@ LJFOLD(ADD KINT KINT)
 LJFOLD(SUB KINT KINT)
 LJFOLD(MUL KINT KINT)
 LJFOLD(MOD KINT KINT)
+LJFOLD(NEG KINT KINT)
 LJFOLD(BAND KINT KINT)
 LJFOLD(BOR KINT KINT)
 LJFOLD(BXOR KINT KINT)