diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-09-24 14:34:52 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-09-24 14:34:52 -0300 |
commit | 6ef366644f7c3c21cfb17434835edf4ebf970d6d (patch) | |
tree | d41df5b79bea32675f740a52d39c0b5ec37eb92b /testes | |
parent | 03cde80b58ea7f112f1b7a35c037893093b59f2e (diff) | |
download | lua-6ef366644f7c3c21cfb17434835edf4ebf970d6d.tar.gz lua-6ef366644f7c3c21cfb17434835edf4ebf970d6d.tar.bz2 lua-6ef366644f7c3c21cfb17434835edf4ebf970d6d.zip |
Subtraction of small constant integers optimized with OP_ADDI
Diffstat (limited to 'testes')
-rw-r--r-- | testes/bitwise.lua | 6 | ||||
-rw-r--r-- | testes/code.lua | 1 | ||||
-rw-r--r-- | testes/locals.lua | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/testes/bitwise.lua b/testes/bitwise.lua index af542e7f..59781f5d 100644 --- a/testes/bitwise.lua +++ b/testes/bitwise.lua | |||
@@ -60,9 +60,9 @@ assert("1234.0" << "5.0" == 1234 * 32) | |||
60 | assert("0xffff.0" ~ "0xAAAA" == 0x5555) | 60 | assert("0xffff.0" ~ "0xAAAA" == 0x5555) |
61 | assert(~"0x0.000p4" == -1) | 61 | assert(~"0x0.000p4" == -1) |
62 | 62 | ||
63 | assert("7" .. 3 << 1 == 146) | 63 | assert(("7" .. 3) << 1 == 146) |
64 | assert(10 >> 1 .. "9" == 0) | 64 | assert(0xffffffff >> (1 .. "9") == 0x1fff) |
65 | assert(10 | 1 .. "9" == 27) | 65 | assert(10 | (1 .. "9") == 27) |
66 | 66 | ||
67 | do | 67 | do |
68 | local st, msg = pcall(function () return 4 & "a" end) | 68 | local st, msg = pcall(function () return 4 & "a" end) |
diff --git a/testes/code.lua b/testes/code.lua index 642dfa68..ab531fa8 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
@@ -293,6 +293,7 @@ checkK(function () return -(border + 1) end, -(sbx + 1.0)) | |||
293 | 293 | ||
294 | -- immediate operands | 294 | -- immediate operands |
295 | checkR(function (x) return x + k1 end, 10, 11, 'ADDI', 'MMBINI', 'RETURN1') | 295 | checkR(function (x) return x + k1 end, 10, 11, 'ADDI', 'MMBINI', 'RETURN1') |
296 | checkR(function (x) return x - 127 end, 10, -117, 'ADDI', 'MMBINI', 'RETURN1') | ||
296 | checkR(function (x) return 128 + x end, 0.0, 128.0, | 297 | checkR(function (x) return 128 + x end, 0.0, 128.0, |
297 | 'ADDI', 'MMBINI', 'RETURN1') | 298 | 'ADDI', 'MMBINI', 'RETURN1') |
298 | checkR(function (x) return x * -127 end, -1.0, 127.0, | 299 | checkR(function (x) return x * -127 end, -1.0, 127.0, |
diff --git a/testes/locals.lua b/testes/locals.lua index 58ad18cc..b769575f 100644 --- a/testes/locals.lua +++ b/testes/locals.lua | |||
@@ -82,7 +82,7 @@ assert(c.a == nil) | |||
82 | f() | 82 | f() |
83 | assert(c.a == 3) | 83 | assert(c.a == 3) |
84 | 84 | ||
85 | -- old test for limits for special instructions (now just a generic test) | 85 | -- old test for limits for special instructions |
86 | do | 86 | do |
87 | local i = 2 | 87 | local i = 2 |
88 | local p = 4 -- p == 2^i | 88 | local p = 4 -- p == 2^i |