aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-11 12:24:11 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-11 12:24:11 -0800
commita8d7c91a6b6228b2d2c9a00d1c0fbfc4671d5511 (patch)
tree46ca2dc1400428bd5be879f44703357b8597c054 /src/parseTools.js
parent26efdc2c8f5e7efd0898e966d58a783fdc7395ac (diff)
fix asm multiply for both floats and ints
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 3b03fdf5..6cb3e776 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1025,7 +1025,7 @@ function asmCoercion(value, type) {
}
}
-function asmMultiply(a, b) {
+function asmMultiplyI32(a, b) {
// special-case: there is no integer multiply in asm, because there is no true integer
// multiply in JS. While we wait for Math.imul, do double multiply
if (USE_MATH_IMUL) {
@@ -1350,8 +1350,8 @@ function getFastValue(a, op, b, type) {
return '(' + a + '<<' + shifts + ')';
}
}
- if (ASM_JS) {
- return asmMultiply(a, b); // unoptimized multiply, do it using asm.js's special multiply operation
+ if (ASM_JS && !(type in Runtime.FLOAT_TYPES)) {
+ return asmMultiplyI32(a, b); // unoptimized multiply, do it using asm.js's special multiply operation
}
} else {
if (a == '0') {
@@ -2022,11 +2022,7 @@ function processMathop(item) {
Types.preciseI64MathUsed = true;
return '(i64Math' + (ASM_JS ? '_' : '.') + 'multiply(' + idents[0] + ',0,' + idents[1] + ',0),' + makeGetValue('tempDoublePtr', 0, 'i32') + ')';
} else {
- var ret = getFastValue(idents[0], '*', idents[1], item.type);
- if (!ASM_JS) {
- ret = handleOverflow(ret, bits); // multiply does not need overflow corrections in asm, since it is special-cased
- }
- return ret;
+ return handleOverflow(getFastValue(idents[0], '*', idents[1], item.type), bits);
}
}
case 'urem': case 'srem': return getFastValue(idents[0], '%', idents[1], item.type);