diff options
-rw-r--r-- | src/wasm2asm.h | 8 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.2asm.js | 2 | ||||
-rw-r--r-- | test/unit.2asm.js | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h index d0c79097f..1898da415 100644 --- a/src/wasm2asm.h +++ b/src/wasm2asm.h @@ -940,10 +940,10 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) { return ValueBuilder::makeBinary(left, MINUS, right); break; } } - case DivS: ret = ValueBuilder::makeBinary(left, DIV, right); break; - case DivU: ret = ValueBuilder::makeBinary(left, DIV, right); break; - case RemS: ret = ValueBuilder::makeBinary(left, MOD, right); break; - case RemU: ret = ValueBuilder::makeBinary(left, MOD, right); break; + case DivS: ret = ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), DIV, makeSigning(right, ASM_SIGNED)); break; + case DivU: ret = ValueBuilder::makeBinary(makeSigning(left, ASM_UNSIGNED), DIV, makeSigning(right, ASM_UNSIGNED)); break; + case RemS: ret = ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), MOD, makeSigning(right, ASM_SIGNED)); break; + case RemU: ret = ValueBuilder::makeBinary(makeSigning(left, ASM_UNSIGNED), MOD, makeSigning(right, ASM_UNSIGNED)); break; case And: ret = ValueBuilder::makeBinary(left, AND, right); break; case Or: ret = ValueBuilder::makeBinary(left, OR, right); break; case Xor: ret = ValueBuilder::makeBinary(left, XOR, right); break; diff --git a/test/emcc_O2_hello_world.2asm.js b/test/emcc_O2_hello_world.2asm.js index 184a6e34e..a6c665d01 100644 --- a/test/emcc_O2_hello_world.2asm.js +++ b/test/emcc_O2_hello_world.2asm.js @@ -2314,7 +2314,7 @@ function asmFunc(global, env, buffer) { i8 = i7; } } else i8 = ___fwritex(i1 | 0, i5 | 0, i4 | 0) | 0; - if ((i8 | 0) == (i5 | 0)) i9 = i3; else i9 = (i8 >>> 0 | 0) / (i2 >>> 0 | 0) | 0; + if ((i8 | 0) == (i5 | 0)) i9 = i3; else i9 = ((i8 >>> 0 | 0) >>> 0) / ((i2 >>> 0 | 0) >>> 0) | 0; wasm2asm_i32$0 = i9; } return wasm2asm_i32$0 | 0; diff --git a/test/unit.2asm.js b/test/unit.2asm.js index 50cc1a866..8e90926b0 100644 --- a/test/unit.2asm.js +++ b/test/unit.2asm.js @@ -165,7 +165,7 @@ function asmFunc(global, env, buffer) { function big_uint_div_u() { var x = 0, wasm2asm_i32$0 = 0; topmost : { - x = (4294967295 / 2 | 0) & 4294967295 | 0; + x = ((4294967295 >>> 0) / (2 >>> 0) | 0) & 4294967295 | 0; wasm2asm_i32$0 = x; } return wasm2asm_i32$0 | 0; |