diff options
author | Dan Gohman <sunfish@google.com> | 2013-05-22 14:13:34 -0700 |
---|---|---|
committer | Dan Gohman <sunfish@google.com> | 2013-05-22 14:18:23 -0700 |
commit | c5712288646180f9619e6ef4a58819be64526405 (patch) | |
tree | 1ed3fd72b920e8d17070ce4ac63de218f34e458d /tools/test-js-optimizer-asm-pre.js | |
parent | 0d4f492e4dc3d02484028e6428c55fab978c7a8b (diff) |
Optimize (x&A)<<B>>B.
Add an optimization to simplifyExpressionsPre to replace (x&A)<<B>>B with X&A
if possible. This comes up frequently in C++ with bool variables.
Diffstat (limited to 'tools/test-js-optimizer-asm-pre.js')
-rw-r--r-- | tools/test-js-optimizer-asm-pre.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/test-js-optimizer-asm-pre.js b/tools/test-js-optimizer-asm-pre.js index f2ffaef4..264587d2 100644 --- a/tools/test-js-optimizer-asm-pre.js +++ b/tools/test-js-optimizer-asm-pre.js @@ -95,4 +95,18 @@ function i32_8() { print(5); } } +function sign_extension_simplification() { + if ((HEAP8[$4 & 16777215] & 127) << 24 >> 24 == 0) { + print(5); + } + if ((HEAP8[$4 & 16777215] & 128) << 24 >> 24 == 0) { + print(5); + } + if ((HEAP32[$5 & 16777215] & 32767) << 16 >> 16 == 0) { + print(5); + } + if ((HEAP32[$5 & 16777215] & 32768) << 16 >> 16 == 0) { + print(5); + } +} // EMSCRIPTEN_GENERATED_FUNCTIONS: ["a", "b", "rett", "ret2t", "retf", "i32_8"] |