Browse Source

fixed implementation of NOT

cl-refactor
artur-zawlocki 10 years ago
parent
commit
01cc09a279
  1. 4
      evmcc/Compiler.cpp
  2. 1
      evmcc/bytecode/when1.evm
  3. 10
      evmcc/lll/when1.asm
  4. 2
      evmcc/lll/when1.lll

4
evmcc/Compiler.cpp

@ -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

@ -0,0 +1 @@
60010f600b59600d608054

10
evmcc/lll/when1.asm

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

2
evmcc/lll/when1.lll

@ -0,0 +1,2 @@
(when (> 1 0) [i] 13)
Loading…
Cancel
Save