aboutsummaryrefslogtreecommitdiff
path: root/tools/eliminator
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-12-23 15:43:01 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-12-23 15:43:01 -0800
commitb86abc2ecfea9ccbb93cad2fe4e9f8574beb7ed8 (patch)
treee966f2fd2bc38d15c18fa880098ba5c8b91f07eb /tools/eliminator
parent9b3e1b8d8e948709a9df1a23ea8790c93eb5b82e (diff)
fix bug where close-together tempDoublePtr operations could cross each other
Diffstat (limited to 'tools/eliminator')
-rw-r--r--tools/eliminator/asm-eliminator-test-output.js5
-rw-r--r--tools/eliminator/eliminator-test-output.js11
-rw-r--r--tools/eliminator/eliminator-test.js17
3 files changed, 30 insertions, 3 deletions
diff --git a/tools/eliminator/asm-eliminator-test-output.js b/tools/eliminator/asm-eliminator-test-output.js
index 434fbaf9..c71063cb 100644
--- a/tools/eliminator/asm-eliminator-test-output.js
+++ b/tools/eliminator/asm-eliminator-test-output.js
@@ -280,9 +280,10 @@ function tempDouble2($46, $14, $28, $42, $20, $32, $45) {
$20 = $20 | 0;
$32 = $32 | 0;
$45 = $45 | 0;
- var $_sroa_06_0_insert_insert$1 = 0;
+ var $46 = 0, $_sroa_06_0_insert_insert$1 = 0;
+ $46 = (HEAPF32[tempDoublePtr >> 2] = ($14 < $28 ? $14 : $28) - $42, HEAP32[tempDoublePtr >> 2] | 0);
$_sroa_06_0_insert_insert$1 = (HEAPF32[tempDoublePtr >> 2] = ($20 < $32 ? $20 : $32) - $42, HEAP32[tempDoublePtr >> 2] | 0) | 0;
- HEAP32[$45 >> 2] = 0 | (HEAPF32[tempDoublePtr >> 2] = ($14 < $28 ? $14 : $28) - $42, HEAP32[tempDoublePtr >> 2] | 0);
+ HEAP32[$45 >> 2] = 0 | $46;
HEAP32[$45 + 4 >> 2] = $_sroa_06_0_insert_insert$1;
HEAP32[$45 + 8 >> 2] = $_sroa_06_0_insert_insert$1;
}
diff --git a/tools/eliminator/eliminator-test-output.js b/tools/eliminator/eliminator-test-output.js
index 0171e99b..4551fb34 100644
--- a/tools/eliminator/eliminator-test-output.js
+++ b/tools/eliminator/eliminator-test-output.js
@@ -6122,4 +6122,15 @@ function intoCond() {
function math(a, b, c, d) {
print(Math_imul(d) + (Math_fround(c) + (a + Math_abs(b))));
}
+function td(x, y) {
+ HEAP32[tempDoublePtr >> 2] = x;
+ var xf = HEAPF32[tempDoublePtr >> 2];
+ HEAP32[tempDoublePtr >> 2] = y;
+ func(xf, HEAPF32[tempDoublePtr >> 2]);
+ HEAPF64[tempDoublePtr >> 3] = x;
+ var xl = HEAP32[tempDoublePtr >> 2];
+ var xh = HEAP32[tempDoublePtr >> 2];
+ HEAPF64[tempDoublePtr >> 3] = y;
+ func(xl, xh, HEAP32[tempDoublePtr >> 2], HEAP32[tempDoublePtr >> 2]);
+}
diff --git a/tools/eliminator/eliminator-test.js b/tools/eliminator/eliminator-test.js
index ef17b388..e629d9f0 100644
--- a/tools/eliminator/eliminator-test.js
+++ b/tools/eliminator/eliminator-test.js
@@ -8860,5 +8860,20 @@ function math(a, b, c, d) {
w = Math_imul(d);
print(x + y + z + w);
}
-// EMSCRIPTEN_GENERATED_FUNCTIONS: ["a", "b", "c", "f", "g", "h", "py", "r", "t", "f2", "f3", "llvm3_1", "_inflate", "_malloc", "_mallocNoU", "asm", "phi", "intoCond", "math"]
+function td(x, y) { // tempDoublePtr should invalidate each other
+ HEAP32[tempDoublePtr>>2] = x;
+ var xf = HEAPF32[tempDoublePtr>>2];
+ HEAP32[tempDoublePtr>>2] = y;
+ var yf = HEAPF32[tempDoublePtr>>2];
+ func(xf, yf);
+ //
+ HEAPF64[tempDoublePtr>>3] = x;
+ var xl = HEAP32[tempDoublePtr>>2];
+ var xh = HEAP32[tempDoublePtr>>2];
+ HEAPF64[tempDoublePtr>>3] = y;
+ var yl = HEAP32[tempDoublePtr>>2];
+ var yh = HEAP32[tempDoublePtr>>2];
+ func(xl, xh, yl, yh);
+}
+// EMSCRIPTEN_GENERATED_FUNCTIONS: ["a", "b", "c", "f", "g", "h", "py", "r", "t", "f2", "f3", "llvm3_1", "_inflate", "_malloc", "_mallocNoU", "asm", "phi", "intoCond", "math", "td"]