aboutsummaryrefslogtreecommitdiff
path: root/tools/test-js-optimizer-asm-pre-output.js
diff options
context:
space:
mode:
authorDan Gohman <sunfish@google.com>2013-05-22 14:13:34 -0700
committerDan Gohman <sunfish@google.com>2013-05-22 14:18:23 -0700
commitc5712288646180f9619e6ef4a58819be64526405 (patch)
tree1ed3fd72b920e8d17070ce4ac63de218f34e458d /tools/test-js-optimizer-asm-pre-output.js
parent0d4f492e4dc3d02484028e6428c55fab978c7a8b (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-output.js')
-rw-r--r--tools/test-js-optimizer-asm-pre-output.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/tools/test-js-optimizer-asm-pre-output.js b/tools/test-js-optimizer-asm-pre-output.js
index 72608aa8..ab953e5d 100644
--- a/tools/test-js-optimizer-asm-pre-output.js
+++ b/tools/test-js-optimizer-asm-pre-output.js
@@ -18,7 +18,7 @@ function b($this, $__n) {
}
$4 = $this;
$5 = HEAP8[$4 & 16777215] | 0;
- if (($5 & 1) << 24 >> 24 == 0) {
+ if (($5 & 1) == 0) {
$14 = 10;
$13 = $5;
} else {
@@ -38,14 +38,14 @@ function b($this, $__n) {
} else {
$30 = $13;
}
- if (($30 & 1) << 24 >> 24 == 0) {
+ if (($30 & 1) == 0) {
$38 = $this + 1 | 0;
} else {
$38 = HEAP32[($this + 8 & 16777215) >> 2] | 0;
}
_memset($38 + $23 | 0, 0, $__n | 0, 1, 1213141516);
$40 = $23 + $__n | 0;
- if ((HEAP8[$4 & 16777215] & 1) << 24 >> 24 == 0) {
+ if ((HEAP8[$4 & 16777215] & 1) == 0) {
HEAP8[$4 & 16777215] = $40 << 1 & 255;
} else {
HEAP32[($this + 4 & 16777215) >> 2] = $40;
@@ -93,4 +93,18 @@ function i32_8() {
print(5);
}
}
+function sign_extension_simplification() {
+ if ((HEAP8[$4 & 16777215] & 127) == 0) {
+ print(5);
+ }
+ if ((HEAP8[$4 & 16777215] & 128) << 24 >> 24 == 0) {
+ print(5);
+ }
+ if ((HEAP32[$5 & 16777215] & 32767) == 0) {
+ print(5);
+ }
+ if ((HEAP32[$5 & 16777215] & 32768) << 16 >> 16 == 0) {
+ print(5);
+ }
+}