Subtraction of small constant integers optimized with OP_ADDI
This commit is contained in:
@@ -60,9 +60,9 @@ assert("1234.0" << "5.0" == 1234 * 32)
|
||||
assert("0xffff.0" ~ "0xAAAA" == 0x5555)
|
||||
assert(~"0x0.000p4" == -1)
|
||||
|
||||
assert("7" .. 3 << 1 == 146)
|
||||
assert(10 >> 1 .. "9" == 0)
|
||||
assert(10 | 1 .. "9" == 27)
|
||||
assert(("7" .. 3) << 1 == 146)
|
||||
assert(0xffffffff >> (1 .. "9") == 0x1fff)
|
||||
assert(10 | (1 .. "9") == 27)
|
||||
|
||||
do
|
||||
local st, msg = pcall(function () return 4 & "a" end)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -82,7 +82,7 @@ assert(c.a == nil)
|
||||
f()
|
||||
assert(c.a == 3)
|
||||
|
||||
-- old test for limits for special instructions (now just a generic test)
|
||||
-- old test for limits for special instructions
|
||||
do
|
||||
local i = 2
|
||||
local p = 4 -- p == 2^i
|
||||
|
||||
Reference in New Issue
Block a user