Subtraction of small constant integers optimized with OP_ADDI

This commit is contained in:
Roberto Ierusalimschy
2019-09-24 14:34:52 -03:00
parent 03cde80b58
commit 6ef366644f
4 changed files with 46 additions and 31 deletions

View File

@@ -293,6 +293,7 @@ checkK(function () return -(border + 1) end, -(sbx + 1.0))
-- immediate operands
checkR(function (x) return x + k1 end, 10, 11, 'ADDI', 'MMBINI', 'RETURN1')
checkR(function (x) return x - 127 end, 10, -117, 'ADDI', 'MMBINI', 'RETURN1')
checkR(function (x) return 128 + x end, 0.0, 128.0,
'ADDI', 'MMBINI', 'RETURN1')
checkR(function (x) return x * -127 end, -1.0, 127.0,