diff options
-rw-r--r-- | tools/test-js-optimizer-asm-regs-output.js | 16 | ||||
-rw-r--r-- | tools/test-js-optimizer-asm-regs.js | 19 |
2 files changed, 34 insertions, 1 deletions
diff --git a/tools/test-js-optimizer-asm-regs-output.js b/tools/test-js-optimizer-asm-regs-output.js index bb6a502b..71155410 100644 --- a/tools/test-js-optimizer-asm-regs-output.js +++ b/tools/test-js-optimizer-asm-regs-output.js @@ -22,4 +22,20 @@ function stackRestore(i1) { i1 = i1 | 0; STACKTOP = i1; } +function switchey(d1, i2) { + d1 = +d1; + i2 = i2 | 0; + var i3 = 0, d4 = +0, i5 = 0, d6 = +0; + switch (d1 | 0) { + case 0: + i3 = d1 + d1 | 0; + d4 = d(Math_max(10, Math_min(5, f()))); + i5 = i3 + 2 | 0; + print(i5); + d6 = d4 * 5; + return d6; + case 1: + return 20; + } +} diff --git a/tools/test-js-optimizer-asm-regs.js b/tools/test-js-optimizer-asm-regs.js index 4f7e04d4..64797e38 100644 --- a/tools/test-js-optimizer-asm-regs.js +++ b/tools/test-js-optimizer-asm-regs.js @@ -24,5 +24,22 @@ function stackRestore(top) { top = top|0; STACKTOP = top; } -// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "_doit", "stackRestore"] +function switchey(x, y) { + x = +x; + y = y | 0; + var int1 = 0, int2 = 0; // do not mix the types! + var double1 = +0, double2 = +0; + switch(x|0) { + case 0: + int1 = (x+x)|0; + double1 = d(Math.max(10, Math_min(5, f()))); + int2 = (int1+2)|0; + print(int2); + double2 = double1*5; + return double2; + case 1: + return 20; + } +} +// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "_doit", "stackRestore", "switchey"] |