aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-28 09:58:03 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-28 09:58:03 -0300
commit46b84580d6d7890f4ba813f312e52514fffc38a7 (patch)
tree764855657253d0b7d2a83c810d5f3bd3493c5ed1 /testes
parentdf13f259487459f3a28d31d76c890aa6c2d061e0 (diff)
downloadlua-46b84580d6d7890f4ba813f312e52514fffc38a7.tar.gz
lua-46b84580d6d7890f4ba813f312e52514fffc38a7.tar.bz2
lua-46b84580d6d7890f4ba813f312e52514fffc38a7.zip
Use of 'MMBIN' opcodes extended to shift operators
Plus, this commit removes useless 'tm' parameters in 'op_*' macros.
Diffstat (limited to 'testes')
-rw-r--r--testes/code.lua8
-rw-r--r--testes/db.lua3
2 files changed, 5 insertions, 6 deletions
diff --git a/testes/code.lua b/testes/code.lua
index fcb5c309..96560166 100644
--- a/testes/code.lua
+++ b/testes/code.lua
@@ -304,9 +304,9 @@ checkR(function (x) return x // 1 end, 10.0, 10.0,
304 'IDIVI', 'MMBINI', 'RETURN1') 304 'IDIVI', 'MMBINI', 'RETURN1')
305checkR(function (x) return x % (100 - 10) end, 91, 1, 305checkR(function (x) return x % (100 - 10) end, 91, 1,
306 'MODI', 'MMBINI', 'RETURN1') 306 'MODI', 'MMBINI', 'RETURN1')
307checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'RETURN1') 307checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'MMBINI', 'RETURN1')
308checkR(function (x) return x << 2 end, 10, 40, 'SHRI', 'RETURN1') 308checkR(function (x) return x << 2 end, 10, 40, 'SHRI', 'MMBINI', 'RETURN1')
309checkR(function (x) return x >> 2 end, 8, 2, 'SHRI', 'RETURN1') 309checkR(function (x) return x >> 2 end, 8, 2, 'SHRI', 'MMBINI', 'RETURN1')
310checkR(function (x) return x & 1 end, 9, 1, 'BANDK', 'MMBINK', 'RETURN1') 310checkR(function (x) return x & 1 end, 9, 1, 'BANDK', 'MMBINK', 'RETURN1')
311checkR(function (x) return 10 | x end, 1, 11, 'BORK', 'MMBINK', 'RETURN1') 311checkR(function (x) return 10 | x end, 1, 11, 'BORK', 'MMBINK', 'RETURN1')
312checkR(function (x) return -10 ~ x end, -1, 9, 'BXORK', 'MMBINK', 'RETURN1') 312checkR(function (x) return -10 ~ x end, -1, 9, 'BXORK', 'MMBINK', 'RETURN1')
@@ -329,7 +329,7 @@ check(function () return -0.0 end, 'LOADF', 'UNM', 'RETURN1')
329check(function () return k3/0 end, 'LOADI', 'DIVI', 'MMBINI', 'RETURN1') 329check(function () return k3/0 end, 'LOADI', 'DIVI', 'MMBINI', 'RETURN1')
330check(function () return 0%0 end, 'LOADI', 'MODI', 'MMBINI', 'RETURN1') 330check(function () return 0%0 end, 'LOADI', 'MODI', 'MMBINI', 'RETURN1')
331check(function () return -4//0 end, 'LOADI', 'IDIVI', 'MMBINI', 'RETURN1') 331check(function () return -4//0 end, 'LOADI', 'IDIVI', 'MMBINI', 'RETURN1')
332check(function (x) return x >> 2.0 end, 'LOADF', 'SHR', 'RETURN1') 332check(function (x) return x >> 2.0 end, 'LOADF', 'SHR', 'MMBIN', 'RETURN1')
333check(function (x) return x & 2.0 end, 'LOADF', 'BAND', 'MMBIN', 'RETURN1') 333check(function (x) return x & 2.0 end, 'LOADF', 'BAND', 'MMBIN', 'RETURN1')
334 334
335-- basic 'for' loops 335-- basic 'for' loops
diff --git a/testes/db.lua b/testes/db.lua
index c43243a6..074a6d0b 100644
--- a/testes/db.lua
+++ b/testes/db.lua
@@ -806,8 +806,7 @@ assert(a+3 == "add" and 3-a == "sub" and a*3 == "mul" and
806 -a == "unm" and #a == "len" and a&3 == "band") 806 -a == "unm" and #a == "len" and a&3 == "band")
807assert(a + 30000 == "add" and a - 3.0 == "sub" and a * 3.0 == "mul" and 807assert(a + 30000 == "add" and a - 3.0 == "sub" and a * 3.0 == "mul" and
808 -a == "unm" and #a == "len" and a & 3 == "band") 808 -a == "unm" and #a == "len" and a & 3 == "band")
809assert(a|3 == "bor" and 3~a == "bxor" and a<<3 == "shift" and 809assert(a|3 == "bor" and 3~a == "bxor" and a<<3 == "shl" and a>>1 == "shr")
810 a>>1 == "shift")
811assert (a==b and a.op == "eq") 810assert (a==b and a.op == "eq")
812assert (a>=b and a.op == "order") 811assert (a>=b and a.op == "order")
813assert (a>b and a.op == "order") 812assert (a>b and a.op == "order")