diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-28 12:04:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-28 12:04:42 -0800 |
commit | 68ec145d73c77b0a7b813aa65f29056de8548e02 (patch) | |
tree | 16994b7e5049c82c92d5a0e85a2774472b786662 /tools/test-js-optimizer-t2.js | |
parent | 970e5bec31f12af53563c56e548ca4673854854f (diff) |
initial work on optimizeShifts pass in js optimizer
Diffstat (limited to 'tools/test-js-optimizer-t2.js')
-rw-r--r-- | tools/test-js-optimizer-t2.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/test-js-optimizer-t2.js b/tools/test-js-optimizer-t2.js new file mode 100644 index 00000000..f69e1aaf --- /dev/null +++ b/tools/test-js-optimizer-t2.js @@ -0,0 +1,21 @@ +// TODO also with >> 1 and >> 3 +// also HEAP*U*, and HEAP8, 16 +function shifty($id) { + // $id is a param, $id2 is a local. both should be replaced with a shifted version + q(HEAP32[$id >> 2]); + q(HEAP32[($id + 40) >> 2]); + q(HEAP32[($id + 80 | 0) >> 2]); + q(HEAP32[(unknown1 + unknown2 + $id) >> 2]); + q(HEAP32[(unknown1 + $id + unknown2) >> 2]); // unknowns should be shifted together + var localUnchanged1 = get(1), localUnchanged2 = get(1); + q(HEAP32[(localUnchanged1 + $id + localUnchanged2) >> 2]); // unknowns should be shifted together + q($id >> _something_); // non-fixed shift + q($id << _somethingElse_); // non-fixed shift + pause(-1); + var $id2; + $id2 = get(54); + q(HEAP32[$id2 >> 1]); + q(HEAP32[($id2 + 40) >> 1]); + q(HEAP32[($id2 + 80 | 0) >> 1]); +} +// EMSCRIPTEN_GENERATED_FUNCTIONS: ["shifty"] |