summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-03-21 12:47:55 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-03-21 12:48:57 -0700
commit7c6be8c282a6a45031768ce7e2f45b47d9f2c742 (patch)
tree4bfe1d6c2ea2e29054e85bb547421d8763faaeb4 /src/asm2wasm.h
parent3dd7f17b10a1c6d0de11f3fa297beb9b18016e38 (diff)
downloadbinaryen-7c6be8c282a6a45031768ce7e2f45b47d9f2c742.tar.gz
binaryen-7c6be8c282a6a45031768ce7e2f45b47d9f2c742.tar.bz2
binaryen-7c6be8c282a6a45031768ce7e2f45b47d9f2c742.zip
use eqz in asm2wasm
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index d6856c7f2..c994d0ef2 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -1058,13 +1058,10 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
ret->type = WasmType::i32;
return ret;
} else if (ast[1] == L_NOT) {
- // no logical unary not, so do == 0
- auto ret = allocator.alloc<Binary>();
- ret->op = Eq;
- ret->left = process(ast[2]);
- ret->right = allocator.alloc<Const>()->set(Literal(0));
- assert(ret->left->type == ret->right->type);
- ret->finalize();
+ auto ret = allocator.alloc<Unary>();
+ ret->op = EqZ;
+ ret->value = process(ast[2]);
+ ret->type = i32;
return ret;
}
abort_on("bad unary", ast);