diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jsifier.js | 8 | ||||
-rw-r--r-- | src/parseTools.js | 12 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 21ffa7e9..b3701112 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1046,10 +1046,14 @@ function JSify(data, functionsOnly, givenFunctions) { makeFuncLineActor('mathop', processMathop); makeFuncLineActor('bitcast', function(item) { - return processMathop({ + var temp = { op: 'bitcast', variant: null, type: item.type, + assignTo: item.assignTo, param1: item.params[0] - }); + }; + var ret = processMathop(temp); + if (!temp.assignTo) item.assignTo = null; // If the assign was stolen, propagate that + return ret; }); function makeFunctionCall(ident, params, funcData, type) { diff --git a/src/parseTools.js b/src/parseTools.js index 5a92335e..d3cb7795 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1699,9 +1699,17 @@ function processMathop(item) { var inType = item.param1.type; var outType = item.type; if (inType in Runtime.INT_TYPES && outType in Runtime.FLOAT_TYPES) { - return makeInlineCalculation('tempDoubleI32[0]=VALUE[0],tempDoubleI32[1]=VALUE[1],tempDoubleF64[0]', ident1, 'tempI64'); + if (legalizedI64s) { + return '(tempDoubleI32[0]=' + ident1 + '$0, tempDoubleI32[1]=' + ident1 + '$1, tempDoubleF64[0])'; + } else { + return makeInlineCalculation('tempDoubleI32[0]=VALUE[0],tempDoubleI32[1]=VALUE[1],tempDoubleF64[0]', ident1, 'tempI64'); + } } else if (inType in Runtime.FLOAT_TYPES && outType in Runtime.INT_TYPES) { - return '(tempDoubleF64[0]=' + ident1 + ',[tempDoubleI32[0],tempDoubleI32[1]])'; + if (legalizedI64s) { + return 'tempDoubleF64[0]=' + ident1 + '; ' + finish(['tempDoubleI32[0]','tempDoubleI32[1]']); + } else { + return '(tempDoubleF64[0]=' + ident1 + ',[tempDoubleI32[0],tempDoubleI32[1]])'; + } } else { throw 'Invalid I64_MODE1 bitcast: ' + dump(item) + ' : ' + item.param1.type; } |