diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/analyzer.js | 11 | ||||
-rw-r--r-- | src/parseTools.js | 1 |
2 files changed, 3 insertions, 9 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index f9b0c5af..ecb5ea6b 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -122,7 +122,8 @@ function analyzer(data, sidePass) { // Legalization if (USE_TYPED_ARRAYS == 2) { function getLegalVars(base, bits, allowLegal) { - if (allowLegal && bits <= 32) return [{ ident: base, bits: bits }]; + bits = bits || 32; // things like pointers are all i32, but show up as 0 bits from getBits + if (allowLegal && bits <= 32) return [{ ident: base + ('i' + bits in Runtime.INT_TYPES ? '' : '$0'), bits: bits }]; if (isNumber(base)) return getLegalLiterals(base, bits); var ret = new Array(Math.ceil(bits/32)); var i = 0; @@ -647,13 +648,7 @@ function analyzer(data, sidePass) { default: throw 'Invalid mathop for legalization: ' + [value.op, item.lineNum, dump(item)]; } // Do the legalization - var sourceElements; - if (sourceBits <= 32) { - // The input is a legal type - sourceElements = [{ ident: value.params[0].ident, bits: sourceBits }]; - } else { - sourceElements = getLegalVars(value.params[0].ident, sourceBits); - } + var sourceElements = getLegalVars(value.params[0].ident, sourceBits, true); if (!isNumber(shifts)) { // We can't statically legalize this, do the operation at runtime TODO: optimize assert(sourceBits == 64, 'TODO: handle nonconstant shifts on != 64 bits'); diff --git a/src/parseTools.js b/src/parseTools.js index 5d3c0179..7f4f3a18 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -2203,7 +2203,6 @@ function processMathop(item) { case 'ne': case 'eq': { // We must sign them, so we do not compare -1 to 255 (could have unsigned them both too) // since LLVM tells us if <=, >= etc. comparisons are signed, but not == and !=. - assert(paramTypes[0] == paramTypes[1]); idents[0] = makeSignOp(idents[0], paramTypes[0], 're'); idents[1] = makeSignOp(idents[1], paramTypes[1], 're'); return idents[0] + (variant === 'eq' ? '==' : '!=') + idents[1]; |