aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-23 14:34:56 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-23 14:34:56 -0800
commit4802cc7c0b56ac587e1dac849badeb11763ef64f (patch)
tree2ab48e459337113c81a09a800a6e575b46b507e6
parentf5ae1c668553b56efd7c336b36c1d12c4fb07229 (diff)
fix comparison in indirectbr for asm
-rw-r--r--src/jsifier.js2
-rw-r--r--src/parseTools.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 39587c3c..dba2ad51 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1270,7 +1270,7 @@ function JSify(data, functionsOnly, givenFunctions) {
var phiSets = calcPhiSets(item);
var js = 'var ibr = ' + finalizeLLVMParameter(item.value) + ';\n';
for (var targetLabel in phiSets) {
- js += 'if (ibr == ' + targetLabel + ') { ' + getPhiSetsForLabel(phiSets, targetLabel) + ' }\n';
+ js += 'if (' + makeComparison('ibr', targetLabel, 'i32') + ') { ' + getPhiSetsForLabel(phiSets, targetLabel) + ' }\n';
}
return js + makeBranch('ibr', item.currLabelId, true);
});
diff --git a/src/parseTools.js b/src/parseTools.js
index c02bc62a..e3b7ed3c 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1793,7 +1793,7 @@ function finalizeLLVMParameter(param, noIndexizeFunctions) {
function makeComparison(a, b, type) {
if (!isIllegalType(type)) {
- return a + ' == ' + b;
+ return asmCoercion(a, type) + ' == ' + asmCoercion(b, type);
} else {
assert(type == 'i64');
return asmCoercion(a + '$0', 'i32') + ' == ' + asmCoercion(b + '$0', 'i32') + ' & ' +