diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-08-28 09:58:03 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-08-28 09:58:03 -0300 |
| commit | 46b84580d6d7890f4ba813f312e52514fffc38a7 (patch) | |
| tree | 764855657253d0b7d2a83c810d5f3bd3493c5ed1 /testes | |
| parent | df13f259487459f3a28d31d76c890aa6c2d061e0 (diff) | |
| download | lua-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.lua | 8 | ||||
| -rw-r--r-- | testes/db.lua | 3 |
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') |
| 305 | checkR(function (x) return x % (100 - 10) end, 91, 1, | 305 | checkR(function (x) return x % (100 - 10) end, 91, 1, |
| 306 | 'MODI', 'MMBINI', 'RETURN1') | 306 | 'MODI', 'MMBINI', 'RETURN1') |
| 307 | checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'RETURN1') | 307 | checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'MMBINI', 'RETURN1') |
| 308 | checkR(function (x) return x << 2 end, 10, 40, 'SHRI', 'RETURN1') | 308 | checkR(function (x) return x << 2 end, 10, 40, 'SHRI', 'MMBINI', 'RETURN1') |
| 309 | checkR(function (x) return x >> 2 end, 8, 2, 'SHRI', 'RETURN1') | 309 | checkR(function (x) return x >> 2 end, 8, 2, 'SHRI', 'MMBINI', 'RETURN1') |
| 310 | checkR(function (x) return x & 1 end, 9, 1, 'BANDK', 'MMBINK', 'RETURN1') | 310 | checkR(function (x) return x & 1 end, 9, 1, 'BANDK', 'MMBINK', 'RETURN1') |
| 311 | checkR(function (x) return 10 | x end, 1, 11, 'BORK', 'MMBINK', 'RETURN1') | 311 | checkR(function (x) return 10 | x end, 1, 11, 'BORK', 'MMBINK', 'RETURN1') |
| 312 | checkR(function (x) return -10 ~ x end, -1, 9, 'BXORK', 'MMBINK', 'RETURN1') | 312 | checkR(function (x) return -10 ~ x end, -1, 9, 'BXORK', 'MMBINK', 'RETURN1') |
| @@ -329,7 +329,7 @@ check(function () return -0.0 end, 'LOADF', 'UNM', 'RETURN1') | |||
| 329 | check(function () return k3/0 end, 'LOADI', 'DIVI', 'MMBINI', 'RETURN1') | 329 | check(function () return k3/0 end, 'LOADI', 'DIVI', 'MMBINI', 'RETURN1') |
| 330 | check(function () return 0%0 end, 'LOADI', 'MODI', 'MMBINI', 'RETURN1') | 330 | check(function () return 0%0 end, 'LOADI', 'MODI', 'MMBINI', 'RETURN1') |
| 331 | check(function () return -4//0 end, 'LOADI', 'IDIVI', 'MMBINI', 'RETURN1') | 331 | check(function () return -4//0 end, 'LOADI', 'IDIVI', 'MMBINI', 'RETURN1') |
| 332 | check(function (x) return x >> 2.0 end, 'LOADF', 'SHR', 'RETURN1') | 332 | check(function (x) return x >> 2.0 end, 'LOADF', 'SHR', 'MMBIN', 'RETURN1') |
| 333 | check(function (x) return x & 2.0 end, 'LOADF', 'BAND', 'MMBIN', 'RETURN1') | 333 | check(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") |
| 807 | assert(a + 30000 == "add" and a - 3.0 == "sub" and a * 3.0 == "mul" and | 807 | assert(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") |
| 809 | assert(a|3 == "bor" and 3~a == "bxor" and a<<3 == "shift" and | 809 | assert(a|3 == "bor" and 3~a == "bxor" and a<<3 == "shl" and a>>1 == "shr") |
| 810 | a>>1 == "shift") | ||
| 811 | assert (a==b and a.op == "eq") | 810 | assert (a==b and a.op == "eq") |
| 812 | assert (a>=b and a.op == "order") | 811 | assert (a>=b and a.op == "order") |
| 813 | assert (a>b and a.op == "order") | 812 | assert (a>b and a.op == "order") |
