From df4c02fb026e890a3d22af3b95edd6740da83d8d Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 2 May 2020 00:05:35 +0100 Subject: [PATCH] Add instructions for "evm384" --- libevmasm/Instruction.cpp | 8 ++++++++ libevmasm/Instruction.h | 4 ++++ test/tools/yulInterpreter/EVMInstructionInterpreter.cpp | 3 +++ 3 files changed, 15 insertions(+) diff --git a/libevmasm/Instruction.cpp b/libevmasm/Instruction.cpp index 34fef1642..fedc971a9 100644 --- a/libevmasm/Instruction.cpp +++ b/libevmasm/Instruction.cpp @@ -165,6 +165,9 @@ std::map const solidity::evmasm::c_instructions = { "LOG2", Instruction::LOG2 }, { "LOG3", Instruction::LOG3 }, { "LOG4", Instruction::LOG4 }, + { "ADDMOD384", Instruction::ADDMOD384 }, + { "SUBMOD384", Instruction::SUBMOD384 }, + { "MULMODMONT384", Instruction::MULMODMONT384 }, { "CREATE", Instruction::CREATE }, { "CALL", Instruction::CALL }, { "CALLCODE", Instruction::CALLCODE }, @@ -311,6 +314,11 @@ static std::map const c_instructionInfo = { Instruction::LOG2, { "LOG2", 0, 4, 0, true, Tier::Special } }, { Instruction::LOG3, { "LOG3", 0, 5, 0, true, Tier::Special } }, { Instruction::LOG4, { "LOG4", 0, 6, 0, true, Tier::Special } }, + + { Instruction::ADDMOD384, { "ADDMOD384", 0, 3, 0, true, Tier::Low } }, + { Instruction::SUBMOD384, { "SUBMOD384", 0, 3, 0, true, Tier::Low } }, + { Instruction::MULMODMONT384, { "MULMODMONT384", 0, 4, 0, true, Tier::Low } }, + { Instruction::CREATE, { "CREATE", 0, 3, 1, true, Tier::Special } }, { Instruction::CALL, { "CALL", 0, 7, 1, true, Tier::Special } }, { Instruction::CALLCODE, { "CALLCODE", 0, 7, 1, true, Tier::Special } }, diff --git a/libevmasm/Instruction.h b/libevmasm/Instruction.h index 511e3cf1b..3c0ba86a1 100644 --- a/libevmasm/Instruction.h +++ b/libevmasm/Instruction.h @@ -185,6 +185,10 @@ enum class Instruction: uint8_t PUTLOCAL, ///< pop top of stack to local variable -- not part of Instructions.cpp GETLOCAL, ///< push local variable to top of stack -- not part of Instructions.cpp + ADDMOD384 = 0xc0, + SUBMOD384 = 0xc1, + MULMODMONT384 = 0xc2, + CREATE = 0xf0, ///< create a new account with associated code CALL, ///< message-call into an account CALLCODE, ///< message-call with another account's code only diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index d60b63b10..b72ec968b 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -417,6 +417,9 @@ u256 EVMInstructionInterpreter::eval( case Instruction::RETURNSUB: case Instruction::PUTLOCAL: case Instruction::GETLOCAL: + case Instruction::ADDMOD384: + case Instruction::SUBMOD384: + case Instruction::MULMODMONT384: { yulAssert(false, ""); return 0;