diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-23 16:48:49 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-23 16:48:49 -0800 |
commit | f23a99a624e51acacb7d38f0e70b2bb12aaf5e73 (patch) | |
tree | 455d4099986376b8948e675e16bb477fcf7fd9f5 /src/parseTools.js | |
parent | ab20c69e046731f722f39016539dc1ffe4040aa1 (diff) |
fix isNaN for asm
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index cceba188..b94d9eaa 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1892,6 +1892,11 @@ function makeRounding(value, bits, signed, floatConversion) { } } +function makeIsNaN(value) { + if (ASM_JS) return makeInlineCalculation('((VALUE) != (VALUE))', value, 'tempDouble'); + return 'isNaN(' + value + ')'; +} + // fptoui and fptosi are not in these, because we need to be careful about what we do there. We can't // just sign/unsign the input first. var UNSIGNED_OP = set('udiv', 'urem', 'uitofp', 'zext', 'lshr'); @@ -2208,8 +2213,8 @@ function processMathop(item) { case 'ult': case 'olt': return idents[0] + ' < ' + idents[1]; case 'une': case 'one': return idents[0] + ' != ' + idents[1]; case 'ueq': case 'oeq': return idents[0] + ' == ' + idents[1]; - case 'ord': return '!isNaN(' + idents[0] + ') && !isNaN(' + idents[1] + ')'; - case 'uno': return 'isNaN(' + idents[0] + ') || isNaN(' + idents[1] + ')'; + case 'ord': return '!' + makeIsNaN(idents[0]) + ' & !' + makeIsNaN(idents[1]); + case 'uno': return makeIsNaN(idents[0]) + ' | ' + makeIsNaN(idents[1]); case 'true': return '1'; default: throw 'Unknown fcmp variant: ' + variant; } |