aboutsummaryrefslogtreecommitdiff
path: root/tools/eliminator
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-01 19:21:39 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-07 14:23:22 -0800
commit61a8933a8df57a9bca285f8b14ab68fdf9da2c19 (patch)
tree971dccbbff37ba3d577f4353a1c0a4a2424c218a /tools/eliminator
parente228b6fff29ff3448be4489356ee1c62be1a252b (diff)
add asmEliminator testcase
Diffstat (limited to 'tools/eliminator')
-rw-r--r--tools/eliminator/asm-eliminator-test-output.js19
-rw-r--r--tools/eliminator/asm-eliminator-test.js25
2 files changed, 43 insertions, 1 deletions
diff --git a/tools/eliminator/asm-eliminator-test-output.js b/tools/eliminator/asm-eliminator-test-output.js
index 228915d4..6b15a0cb 100644
--- a/tools/eliminator/asm-eliminator-test-output.js
+++ b/tools/eliminator/asm-eliminator-test-output.js
@@ -5,4 +5,23 @@ function asm(x, y) {
a = cheez(y + ~~x | 0) | 0;
fleefl(a * a | 0, a | 0);
}
+function __Z11printResultPiS_j($needle, $haystack, $len) {
+ $needle = $needle | 0;
+ $haystack = $haystack | 0;
+ $len = $len | 0;
+ var $3 = 0;
+ var __stackBase__ = STACKTOP;
+ $3 = _bsearch($needle, $haystack, $len, 4, 2);
+ if (($3 | 0) == 0) {
+ $puts = _puts(_str | 0);
+ STACKTOP = __stackBase__;
+ return;
+ } else {
+ $7 = $3;
+ $8 = HEAP32[($7 & 16777215) >> 2] | 0;
+ $9 = _printf(__str1 | 0, (tempInt = STACKTOP, STACKTOP = STACKTOP + 4 | 0, HEAP32[(tempInt & 16777215) >> 2] = $8, tempInt));
+ STACKTOP = __stackBase__;
+ return;
+ }
+}
diff --git a/tools/eliminator/asm-eliminator-test.js b/tools/eliminator/asm-eliminator-test.js
index d845b989..963fd9c8 100644
--- a/tools/eliminator/asm-eliminator-test.js
+++ b/tools/eliminator/asm-eliminator-test.js
@@ -7,5 +7,28 @@ function asm(x, y) {
b = a*a;
fleefl(b|0, a|0);
}
-// EMSCRIPTEN_GENERATED_FUNCTIONS: ["a", "b", "c", "f", "g", "h", "py", "r", "t", "f2", "f3", "llvm3_1", "_inflate", "_malloc", "_mallocNoU", "asm"]
+function __Z11printResultPiS_j($needle, $haystack, $len) {
+ $needle = $needle | 0;
+ $haystack = $haystack | 0;
+ $len = $len | 0;
+ var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $puts = 0, $7 = 0, $8 = 0, $9 = 0;
+ var label = 0;
+ var __stackBase__ = STACKTOP;
+ $1 = $needle;
+ $2 = $haystack;
+ $3 = _bsearch($1, $2, $len, 4, 2);
+ $4 = ($3 | 0) == 0;
+ if ($4) {
+ $puts = _puts(_str | 0);
+ STACKTOP = __stackBase__;
+ return;
+ } else {
+ $7 = $3;
+ $8 = HEAP32[($7 & 16777215) >> 2] | 0;
+ $9 = _printf(__str1 | 0, (tempInt = STACKTOP, STACKTOP = STACKTOP + 4 | 0, HEAP32[(tempInt & 16777215) >> 2] = $8, tempInt));
+ STACKTOP = __stackBase__;
+ return;
+ }
+}
+// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "__Z11printResultPiS_j"]