-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ std::map<std::string, Instruction, std::less<>> const solidity::evmasm::c_instru | |
{ "SHL", Instruction::SHL }, | ||
{ "SHR", Instruction::SHR }, | ||
{ "SAR", Instruction::SAR }, | ||
{ "CLZ", Instruction::CLZ }, | ||
{ "ADDMOD", Instruction::ADDMOD }, | ||
{ "MULMOD", Instruction::MULMOD }, | ||
{ "SIGNEXTEND", Instruction::SIGNEXTEND }, | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it was updated. Also it is
|
||
{Instruction::ADDMOD, {"ADDMOD", 0, 3, 1, false, Tier::Mid}}, | ||
{Instruction::MULMOD, {"MULMOD", 0, 3, 1, false, Tier::Mid}}, | ||
{Instruction::SIGNEXTEND, {"SIGNEXTEND", 0, 2, 1, false, Tier::Low}}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
contract C { | ||
function f() public view returns (bytes32 ret) { | ||
assembly { | ||
ret := clz(0) | ||
} | ||
} | ||
|
||
function g() public view returns (bytes32 ret) { | ||
assembly { | ||
ret := clz(1) | ||
} | ||
} | ||
|
||
function h() public view returns (bytes32 ret) { | ||
assembly { | ||
ret := clz(0x4000000000000000000000000000000000000000000000000000000000000000) | ||
} | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=osaka | ||
// ---- | ||
// f() -> 256 | ||
// g() -> 255 | ||
// h() -> 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
contract C { | ||
function f() public pure returns (uint ret) { | ||
assembly { | ||
let clz := 1 | ||
ret := clz | ||
} | ||
} | ||
function g() public pure returns (uint ret) { | ||
assembly { | ||
function clz() -> r { | ||
r := 1000 | ||
} | ||
ret := clz() | ||
} | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: <osaka | ||
// ---- | ||
// f() -> 1 | ||
// g() -> 1000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
contract C { | ||
function f(uint256 x) public pure returns (bytes32 ret) { | ||
assembly { | ||
ret := clz(x) | ||
} | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=osaka | ||
// ---- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
contract C { | ||
function f(uint256 x) public pure returns (bytes32 ret) { | ||
assembly { | ||
ret := clz(x) | ||
} | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: =prague | ||
// ---- | ||
// TypeError 4948: (113-116): The "clz" instruction is only available for Osaka-compatible VMs (you are currently compiling for "prague"). | ||
// DeclarationError 8678: (106-119): Variable count for assignment to "ret" does not match number of values (1 vs. 0) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
contract C { | ||
function f() public pure returns (uint ret) { | ||
assembly { | ||
function clz() -> r { | ||
r := 1000 | ||
} | ||
ret := clz() | ||
} | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=osaka | ||
// ---- | ||
// ParserError 5568: (103-106): Cannot use builtin function name "clz" as identifier name. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
sstore(0, clz(0)) | ||
sstore(1, clz(1)) | ||
sstore(2, clz(0xff)) | ||
} | ||
// ==== | ||
// EVMVersion: >=osaka | ||
// ---- | ||
// Trace: | ||
// Memory dump: | ||
// Storage dump: | ||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000100 | ||
// 0000000000000000000000000000000000000000000000000000000000000001: 00000000000000000000000000000000000000000000000000000000000000ff | ||
// 0000000000000000000000000000000000000000000000000000000000000002: 00000000000000000000000000000000000000000000000000000000000000f8 | ||
// Transient storage dump: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
{ | ||
let clz := 1 | ||
} | ||
|
||
{ | ||
function clz() {} | ||
clz() | ||
} | ||
} | ||
|
||
// ==== | ||
// EVMVersion: >=osaka | ||
// ---- | ||
// ParserError 5568: (20-23): Cannot use builtin function name "clz" as identifier name. | ||
// ParserError 5568: (59-62): Cannot use builtin function name "clz" as identifier name. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
{ | ||
let clz := 1 | ||
} | ||
|
||
{ | ||
function clz() {} | ||
clz() | ||
} | ||
} | ||
|
||
// ==== | ||
// EVMVersion: <osaka | ||
// ---- |
Uh oh!
There was an error while loading. Please reload this page.