Merge pull request #6503 from ethereum/inlineAsm-yul

Inline asm yul
This commit is contained in:
chriseth
2019-04-18 17:15:09 +02:00
committed by GitHub
6 changed files with 104 additions and 2 deletions
@@ -0,0 +1,17 @@
contract C {
function f() public pure returns (uint32 x) {
uint32 a;
uint32 b;
uint32 c;
assembly {
a := 1
b := 2
c := 3
}
x = a + b + c;
}
}
// ====
// compileViaYul: true
// ----
// f() -> 6
@@ -0,0 +1,23 @@
contract C {
function f() public pure returns (uint32 x) {
uint32 a;
uint32 b;
uint32 c;
assembly {
function myAwesomeFunction(param) -> returnMe {
let localVar := 10
returnMe := add(localVar, param)
}
let abc := sub(10, a)
let xyz := 20
a := abc
b := myAwesomeFunction(30)
c := xyz
}
x = a + b + c;
}
}
// ====
// compileViaYul: true
// ----
// f() -> 70