diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-08-25 11:26:31 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-08-25 11:26:47 -0700 |
commit | c14a675125a6d94d80561e986549280eee5e958d (patch) | |
tree | f4bca3b6e2cea17cfef0febab0be8544574472da /src/parseTools.js | |
parent | aab3e76b94c09c384e45a98dbb8a95b7b94ca838 (diff) |
PRECISE_I32_MUL option for full precision in 32-bit multiply
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 86e3c643..e37f3a99 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1794,7 +1794,14 @@ function processMathop(item) { case 'add': return handleOverflow(getFastValue(idents[0], '+', idents[1], item.type), bits); case 'sub': return handleOverflow(getFastValue(idents[0], '-', idents[1], item.type), bits); case 'sdiv': case 'udiv': return makeRounding(getFastValue(idents[0], '/', idents[1], item.type), bits, op[0] === 's'); - case 'mul': return handleOverflow(getFastValue(idents[0], '*', idents[1], item.type), bits); + case 'mul': { + if (bits == 32 && PRECISE_I32_MUL) { + preciseI64MathUsed = true; + return '(i64Math.multiply(' + idents[0] + ',0,' + idents[1] + ',0),i64Math.result[0])'; + } else { + return handleOverflow(getFastValue(idents[0], '*', idents[1], item.type), bits); + } + } case 'urem': case 'srem': return getFastValue(idents[0], '%', idents[1], item.type); case 'or': { if (bits > 32) { |