-
Notifications
You must be signed in to change notification settings - Fork 6.1k
EIP-7939 CLZ for Osaka #16122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
EIP-7939 CLZ for Osaka #16122
Conversation
Thank you for your contribution to the Solidity compiler! A team member will follow up shortly. If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother. If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix. |
@@ -219,6 +220,7 @@ static std::map<Instruction, InstructionInfo> const c_instructionInfo = | |||
{Instruction::SHL, {"SHL", 0, 2, 1, false, Tier::VeryLow}}, | |||
{Instruction::SHR, {"SHR", 0, 2, 1, false, Tier::VeryLow}}, | |||
{Instruction::SAR, {"SAR", 0, 2, 1, false, Tier::VeryLow}}, | |||
{Instruction::CLZ, {"CLZ", 0, 1, 1, false, Tier::Low}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLZ
has the same gas cost as ADD
, which is in the Tier::VeryLow
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was updated. Also it is 5
in geth. Plus in the EIP it mentions:
The cost of the opcode is 5, matching MUL (raised from 3 to avoid under-pricing DoS risk).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Saw-mon-and-Natalie , thanks for the PR!
Looking good.
|
This PR addresses:
By adding a new YUL builtin function
clz
for EVM versions greater than or equal to Osaka.Followed the patterns from #14757 to create these modifications:
Tests
Currently the tests in
semanticTests/inlineAssembly/clz.sol
fail due toevmone
not having implementedCLZ
:solidity/test/EVMHost.cpp
Line 420 in 779daec
In the above line
m_vm.execute(...)
returnsEVMC_UNDEFINED_INSTRUCTION
and them_vm
is:References: