summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm2asm.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h
index faa49be5e..74d905252 100644
--- a/src/wasm2asm.h
+++ b/src/wasm2asm.h
@@ -947,8 +947,20 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) {
case Div: ret = ValueBuilder::makeBinary(left, DIV, right); break;
case Min: ret = ValueBuilder::makeCall(MATH_MIN, left, right); break;
case Max: ret = ValueBuilder::makeCall(MATH_MAX, left, right); break;
- case Eq: return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), EQ, makeSigning(right, ASM_SIGNED));
- case Ne: return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), NE, makeSigning(right, ASM_SIGNED));
+ case Eq: {
+ if (curr->left->type == i32) {
+ return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), EQ, makeSigning(right, ASM_SIGNED));
+ } else {
+ return ValueBuilder::makeBinary(left, EQ, right);
+ }
+ }
+ case Ne: {
+ if (curr->left->type == i32) {
+ return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), NE, makeSigning(right, ASM_SIGNED));
+ } else {
+ return ValueBuilder::makeBinary(left, NE, right);
+ }
+ }
case LtS: return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), LT, makeSigning(right, ASM_SIGNED));
case LtU: return ValueBuilder::makeBinary(makeSigning(left, ASM_UNSIGNED), LT, makeSigning(right, ASM_UNSIGNED));
case LeS: return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), LE, makeSigning(right, ASM_SIGNED));