fixed implementation of NOT

This commit is contained in:
artur-zawlocki 2014-10-02 12:36:12 +02:00
parent fa76d7a4a0
commit 8b625fa954
4 changed files with 15 additions and 2 deletions

View file

@ -290,8 +290,8 @@ std::unique_ptr<llvm::Module> Compiler::compile(const dev::bytes& bytecode)
{
auto top = stack.pop();
auto zero = ConstantInt::get(Types.word256, 0);
auto nonzero = builder.CreateICmpNE(top, zero, "nonzero");
auto result = builder.CreateZExt(nonzero, Types.word256);
auto iszero = builder.CreateICmpEQ(top, zero, "iszero");
auto result = builder.CreateZExt(iszero, Types.word256);
stack.push(result);
break;
}

1
evmcc/bytecode/when1.evm Normal file
View file

@ -0,0 +1 @@
60010f600b59600d608054

10
evmcc/lll/when1.asm Normal file
View file

@ -0,0 +1,10 @@
.code:
PUSH 1
NOT
PUSH [tag0]
JUMPI
PUSH 13
PUSH 128
MSTORE
tag0:

2
evmcc/lll/when1.lll Normal file
View file

@ -0,0 +1,2 @@
(when (> 1 0) [i] 13)