aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-09-10 13:20:03 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-09-10 13:20:03 -0300
commit91dad09f65984048ae43c8894d18acb785c7092b (patch)
treeea6c23c54d8659677da6259047ddd0c8e0b7e643 /testes
parent4518e5df24600cacdb3bab75d640348d28e8b769 (diff)
downloadlua-91dad09f65984048ae43c8894d18acb785c7092b.tar.gz
lua-91dad09f65984048ae43c8894d18acb785c7092b.tar.bz2
lua-91dad09f65984048ae43c8894d18acb785c7092b.zip
Removed arithmetic opcodes with immediate operand
The difference in performance between immediate operands and K operands does not seem to justify all those extra opcodes. We only keep OP_ADDI, due to its ubiquity and because the difference is a little more relevant. (Later, OP_SUBI will be implemented by OP_ADDI, negating the constant.)
Diffstat (limited to 'testes')
-rw-r--r--testes/code.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/testes/code.lua b/testes/code.lua
index 96560166..642dfa68 100644
--- a/testes/code.lua
+++ b/testes/code.lua
@@ -296,14 +296,14 @@ checkR(function (x) return x + k1 end, 10, 11, 'ADDI', 'MMBINI', 'RETURN1')
296checkR(function (x) return 128 + x end, 0.0, 128.0, 296checkR(function (x) return 128 + x end, 0.0, 128.0,
297 'ADDI', 'MMBINI', 'RETURN1') 297 'ADDI', 'MMBINI', 'RETURN1')
298checkR(function (x) return x * -127 end, -1.0, 127.0, 298checkR(function (x) return x * -127 end, -1.0, 127.0,
299 'MULI', 'MMBINI', 'RETURN1') 299 'MULK', 'MMBINK', 'RETURN1')
300checkR(function (x) return 20 * x end, 2, 40, 'MULI', 'MMBINI', 'RETURN1') 300checkR(function (x) return 20 * x end, 2, 40, 'MULK', 'MMBINK', 'RETURN1')
301checkR(function (x) return x ^ -2 end, 2, 0.25, 'POWI', 'MMBINI', 'RETURN1') 301checkR(function (x) return x ^ -2 end, 2, 0.25, 'POWK', 'MMBINK', 'RETURN1')
302checkR(function (x) return x / 40 end, 40, 1.0, 'DIVI', 'MMBINI', 'RETURN1') 302checkR(function (x) return x / 40 end, 40, 1.0, 'DIVK', 'MMBINK', 'RETURN1')
303checkR(function (x) return x // 1 end, 10.0, 10.0, 303checkR(function (x) return x // 1 end, 10.0, 10.0,
304 'IDIVI', 'MMBINI', 'RETURN1') 304 'IDIVK', 'MMBINK', '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 'MODK', 'MMBINK', 'RETURN1')
307checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'MMBINI', 'RETURN1') 307checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'MMBINI', 'RETURN1')
308checkR(function (x) return x << 2 end, 10, 40, 'SHRI', 'MMBINI', 'RETURN1') 308checkR(function (x) return x << 2 end, 10, 40, 'SHRI', 'MMBINI', 'RETURN1')
309checkR(function (x) return x >> 2 end, 8, 2, 'SHRI', 'MMBINI', 'RETURN1') 309checkR(function (x) return x >> 2 end, 8, 2, 'SHRI', 'MMBINI', 'RETURN1')
@@ -326,9 +326,9 @@ checkR(function (x) return x % (100.0 - 10) end, 91, 1.0,
326 326
327-- no foldings (and immediate operands) 327-- no foldings (and immediate operands)
328check(function () return -0.0 end, 'LOADF', 'UNM', 'RETURN1') 328check(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', 'DIVK', 'MMBINK', 'RETURN1')
330check(function () return 0%0 end, 'LOADI', 'MODI', 'MMBINI', 'RETURN1') 330check(function () return 0%0 end, 'LOADI', 'MODK', 'MMBINK', 'RETURN1')
331check(function () return -4//0 end, 'LOADI', 'IDIVI', 'MMBINI', 'RETURN1') 331check(function () return -4//0 end, 'LOADI', 'IDIVK', 'MMBINK', 'RETURN1')
332check(function (x) return x >> 2.0 end, 'LOADF', 'SHR', 'MMBIN', '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