mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
- implemented LT, GT
- new tests for jumps and comparisons
This commit is contained in:
parent
8b625fa954
commit
48d4294d88
5 changed files with 28 additions and 0 deletions
|
|
@ -286,6 +286,26 @@ std::unique_ptr<llvm::Module> Compiler::compile(const dev::bytes& bytecode)
|
|||
break;
|
||||
}
|
||||
|
||||
case Instruction::LT:
|
||||
{
|
||||
auto lhs = stack.pop();
|
||||
auto rhs = stack.pop();
|
||||
auto res1 = builder.CreateICmpULT(lhs, rhs);
|
||||
auto res256 = builder.CreateZExt(res1, Types.word256);
|
||||
stack.push(res256);
|
||||
break;
|
||||
}
|
||||
|
||||
case Instruction::GT:
|
||||
{
|
||||
auto lhs = stack.pop();
|
||||
auto rhs = stack.pop();
|
||||
auto res1 = builder.CreateICmpUGT(lhs, rhs);
|
||||
auto res256 = builder.CreateZExt(res1, Types.word256);
|
||||
stack.push(res256);
|
||||
break;
|
||||
}
|
||||
|
||||
case Instruction::NOT:
|
||||
{
|
||||
auto top = stack.pop();
|
||||
|
|
|
|||
1
evmcc/bytecode/for1.evm
Normal file
1
evmcc/bytecode/for1.evm
Normal file
|
|
@ -0,0 +1 @@
|
|||
600a60805460006080530b0f60255960a0536080530160a054600160805303608054600558
|
||||
1
evmcc/bytecode/for2.evm
Normal file
1
evmcc/bytecode/for2.evm
Normal file
|
|
@ -0,0 +1 @@
|
|||
6000608054600a6080530a0f60255960a0536080530160a054600160805301608054600558
|
||||
3
evmcc/lll/for1.lll
Normal file
3
evmcc/lll/for1.lll
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(for [i]:10 (> @i 0) [i](- @i 1)
|
||||
[j](+ @i @j)
|
||||
)
|
||||
3
evmcc/lll/for2.lll
Normal file
3
evmcc/lll/for2.lll
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(for [i]:0 (< @i 10) [i](+ @i 1)
|
||||
[j](+ @i @j)
|
||||
)
|
||||
Loading…
Reference in a new issue