summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm2asm.h28
-rw-r--r--test/unit.2asm.js18
2 files changed, 23 insertions, 23 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h
index 2b7d6a455..4d5e4f2a8 100644
--- a/src/wasm2asm.h
+++ b/src/wasm2asm.h
@@ -773,20 +773,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: ret = ValueBuilder::makeBinary(left, EQ, right); break;
- case Ne: ret = ValueBuilder::makeBinary(left, NE, right); break;
- case LtS: ret = ValueBuilder::makeBinary(left, LT, right); break;
- case LtU: ret = ValueBuilder::makeBinary(left, LT, right); break;
- case LeS: ret = ValueBuilder::makeBinary(left, LE, right); break;
- case LeU: ret = ValueBuilder::makeBinary(left, LE, right); break;
- case GtS: ret = ValueBuilder::makeBinary(left, GT, right); break;
- case GtU: ret = ValueBuilder::makeBinary(left, GT, right); break;
- case GeS: ret = ValueBuilder::makeBinary(left, GE, right); break;
- case GeU: ret = ValueBuilder::makeBinary(left, GE, right); break;
- case Lt: ret = ValueBuilder::makeBinary(left, LT, right); break;
- case Le: ret = ValueBuilder::makeBinary(left, LE, right); break;
- case Gt: ret = ValueBuilder::makeBinary(left, GT, right); break;
- case Ge: ret = ValueBuilder::makeBinary(left, GE, right); break;
+ case Eq: return ValueBuilder::makeBinary(left, EQ, right);
+ case Ne: 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));
+ case LeU: return ValueBuilder::makeBinary(makeSigning(left, ASM_UNSIGNED), LE, makeSigning(right, ASM_UNSIGNED));
+ case GtS: return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), GT, makeSigning(right, ASM_SIGNED));
+ case GtU: return ValueBuilder::makeBinary(makeSigning(left, ASM_UNSIGNED), GT, makeSigning(right, ASM_UNSIGNED));
+ case GeS: return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), GE, makeSigning(right, ASM_SIGNED));
+ case GeU: return ValueBuilder::makeBinary(makeSigning(left, ASM_UNSIGNED), GE, makeSigning(right, ASM_UNSIGNED));
+ case Lt: return ValueBuilder::makeBinary(left, LT, right);
+ case Le: return ValueBuilder::makeBinary(left, LE, right);
+ case Gt: return ValueBuilder::makeBinary(left, GT, right);
+ case Ge: return ValueBuilder::makeBinary(left, GE, right);
default: abort();
}
return makeAsmCoercion(ret, wasmToAsmType(curr->type));
diff --git a/test/unit.2asm.js b/test/unit.2asm.js
index e85255c64..b913c6957 100644
--- a/test/unit.2asm.js
+++ b/test/unit.2asm.js
@@ -14,11 +14,11 @@ function asmFunc() {
var temp = 0.0, wasm2asm_f64$0 = 0.0;
topmost : {
temp = +(+(+(HEAPF64[8 >> 3] + HEAPF64[16 >> 3]) + -HEAPF64[16 >> 3]) + -HEAPF64[8 >> 3]);
- if (HEAPU32[24 >> 2] > 0 | 0) {
+ if ((HEAPU32[24 >> 2] | 0) > (0 | 0)) {
wasm2asm$noresult = -3.4;
break topmost;
};
- if (HEAPF64[32 >> 3] > 0.0 | 0) {
+ if (HEAPF64[32 >> 3] > 0.0) {
wasm2asm$noresult = 5.6;
break topmost;
};
@@ -32,19 +32,19 @@ function asmFunc() {
y = +y;
var t = 0.0, Int = 0.0, Double = 0, wasm2asm_f64$0 = 0.0;
topmost : {
- if (x > 0.0 | 0) {
+ if (x > 0.0) {
wasm2asm$noresult = 1.2;
break topmost;
};
- if (Int > 0.0 | 0) {
+ if (Int > 0.0) {
wasm2asm$noresult = -3.4;
break topmost;
};
- if (Double > 0 | 0) {
+ if ((Double | 0) > (0 | 0)) {
wasm2asm$noresult = 5.6;
break topmost;
};
- if (x < y | 0) {
+ if (x < y) {
wasm2asm$noresult = x;
break topmost;
};
@@ -55,7 +55,7 @@ function asmFunc() {
function intOps() {
var x = 0;
- return x == 0 | 0;
+ return x == 0;
}
function conversions() {
@@ -134,7 +134,7 @@ function asmFunc() {
{
{
asm2wasm_i32_temp = 0;
- wasm2asm_i32$0 = (wasm2asm_i32$1 = asm2wasm_i32_temp < 0 | 0, wasm2asm_i32$2 = 0 - asm2wasm_i32_temp | 0, wasm2asm_i32$3 = asm2wasm_i32_temp, wasm2asm_i32$1 ? wasm2asm_i32$2 : wasm2asm_i32$3);
+ wasm2asm_i32$0 = (wasm2asm_i32$1 = (asm2wasm_i32_temp | 0) < (0 | 0), wasm2asm_i32$2 = 0 - asm2wasm_i32_temp | 0, wasm2asm_i32$3 = asm2wasm_i32_temp, wasm2asm_i32$1 ? wasm2asm_i32$2 : wasm2asm_i32$3);
x = wasm2asm_i32$0;
}
y = Math_abs(0.0);
@@ -152,7 +152,7 @@ function asmFunc() {
function ___syscall_ret() {
var $0 = 0;
- return ($0 >>> 0 | 0) > 4294963200 | 0;
+ return ($0 >>> 0 | 0) >>> 0 > 4294963200 >>> 0;
}
function z() {