diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-03-21 13:04:04 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-03-21 13:04:04 -0700 |
commit | c34ed229b2df8bf4e8d0773917d0301c034980e3 (patch) | |
tree | 4bfe1d6c2ea2e29054e85bb547421d8763faaeb4 /src | |
parent | ff45fb37885b66a60b22e40eca41628b83cdc748 (diff) | |
parent | 7c6be8c282a6a45031768ce7e2f45b47d9f2c742 (diff) | |
download | binaryen-c34ed229b2df8bf4e8d0773917d0301c034980e3.tar.gz binaryen-c34ed229b2df8bf4e8d0773917d0301c034980e3.tar.bz2 binaryen-c34ed229b2df8bf4e8d0773917d0301c034980e3.zip |
Merge pull request #267 from WebAssembly/asm2wasm-eqz
Use eqz in asm2wasm
Diffstat (limited to 'src')
-rw-r--r-- | src/asm2wasm.h | 11 |
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); |