aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-25 16:07:55 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-02-25 16:07:55 -0500
commit87961191d46590e485cb1ab97b4cd95e692a5794 (patch)
treeafcca3ade18c9fb102327a2415d746e67ec1389c
parent6475478ff1ff227aea169fdb9a33ea87a5c52082 (diff)
always replace Math.imul in non-precise i32 mul mode, and disable test for that in asm since asm alaways assumes precision
-rw-r--r--src/preamble.js6
-rwxr-xr-xtests/runner.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 05269c6e..a7731e7f 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -742,17 +742,19 @@ Module['writeArrayToMemory'] = writeArrayToMemory;
{{{ unSign }}}
{{{ reSign }}}
-if (!Math.imul) Math.imul = function(a, b) {
#if PRECISE_I32_MUL
+if (!Math.imul) Math.imul = function(a, b) {
var ah = a >>> 16;
var al = a & 0xffff;
var bh = b >>> 16;
var bl = b & 0xffff;
return (al*bl + ((ah*bl + al*bh) << 16))|0;
+};
#else
+Math.imul = function(a, b) {
return (a*b)|0; // fast but imprecise
-#endif
};
+#endif
// A counter of dependencies for calling run(). If we need to
// do asynchronous work before running, increment this and
diff --git a/tests/runner.py b/tests/runner.py
index 46d040e1..7417524a 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1153,6 +1153,8 @@ m_divisor is 1091269979
self.do_run(src, '3217489085')
def test_i32_mul_semiprecise(self):
+ if Settings.ASM_JS: return self.skip('asm is always fully precise')
+
Settings.PRECISE_I32_MUL = 0 # we want semiprecise here
src = r'''