diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-08-15 16:51:29 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-08-15 16:51:29 -0700 |
commit | 41e7af7eeb7f0d0a3991abd7ff87177308570c54 (patch) | |
tree | 3c0684b6549c0e186032ca38252bc40fc4657273 /src/parseTools.js | |
parent | b1eaf55eefb815e8f3556b59ce64e6d1e0f55d55 (diff) | |
parent | 2e229a560955c07d1b66db27913af3284baa64fb (diff) |
Merge branch 'incoming'
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index b7d3ea91..f11c867a 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -396,12 +396,18 @@ function parseParamTokens(params) { // handle 'byval' and 'byval align X'. We store the alignment in 'byVal' byVal = QUANTUM_SIZE; segment.splice(1, 1); + if (segment[1] && segment[1].text === 'nocapture') { + segment.splice(1, 1); + } if (segment[1] && segment[1].text === 'align') { assert(isNumber(segment[2].text)); byVal = parseInt(segment[2].text); segment.splice(1, 2); } } + if (segment[1] && segment[1].text === 'nocapture') { + segment.splice(1, 1); + } if (segment.length == 1) { if (segment[0].text == '...') { ret.push({ @@ -2014,6 +2020,13 @@ function makeIsNaN(value) { return 'isNaN(' + value + ')'; } +function makeFloat(value, type) { + if (TO_FLOAT32 && type == 'float') { + return 'Math.toFloat32(' + value + ')'; + } + return 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'); @@ -2269,11 +2282,11 @@ function processMathop(item) { return idents[0] + ' >>> ' + idents[1]; } // basic float ops - case 'fadd': return getFastValue(idents[0], '+', idents[1], item.type); - case 'fsub': return getFastValue(idents[0], '-', idents[1], item.type); - case 'fdiv': return getFastValue(idents[0], '/', idents[1], item.type); - case 'fmul': return getFastValue(idents[0], '*', idents[1], item.type); - case 'frem': return getFastValue(idents[0], '%', idents[1], item.type); + case 'fadd': return makeFloat(getFastValue(idents[0], '+', idents[1], item.type), item.type); + case 'fsub': return makeFloat(getFastValue(idents[0], '-', idents[1], item.type), item.type); + case 'fdiv': return makeFloat(getFastValue(idents[0], '/', idents[1], item.type), item.type); + case 'fmul': return makeFloat(getFastValue(idents[0], '*', idents[1], item.type), item.type); + case 'frem': return makeFloat(getFastValue(idents[0], '%', idents[1], item.type), item.type); case 'uitofp': case 'sitofp': return asmCoercion(idents[0], 'double', op[0]); case 'fptoui': case 'fptosi': return makeRounding(idents[0], bitsLeft, op === 'fptosi', true); |