From 3ca8dd6de1093d67fd9eb76c6c0da823cf39c5a8 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 5 Dec 2015 13:33:56 -0800 Subject: fix signing in wasm2asm comparisons --- src/wasm2asm.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') 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)); -- cgit v1.2.3