diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-10-26 23:39:36 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-10-26 23:39:36 -0700 |
commit | a3f73278b198d0366c590ec8bd7fb8cad5c2931d (patch) | |
tree | 1b4868e06faa11a5bd1fc09555afe78d60dfbe8b /tutorial/task9-solution.mu | |
parent | 0ccfd0156f8129df0959b51593bf2a9116e03a37 (diff) | |
download | mu-a3f73278b198d0366c590ec8bd7fb8cad5c2931d.tar.gz |
task: juggling function outputs between registers
Diffstat (limited to 'tutorial/task9-solution.mu')
-rw-r--r-- | tutorial/task9-solution.mu | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tutorial/task9-solution.mu b/tutorial/task9-solution.mu new file mode 100644 index 00000000..9ecf0ee8 --- /dev/null +++ b/tutorial/task9-solution.mu @@ -0,0 +1,23 @@ +fn f -> _/eax: int { + return 2 +} + +fn g -> _/eax: int { + return 3 +} + +fn add-f-and-g -> _/eax: int { + var _x/eax: int <- f + var x/ecx: int <- copy _x + var y/eax: int <- g + x <- add y + return x +} + +fn test-add-f-and-g { + var result/eax: int <- add-f-and-g + check-ints-equal result, 5, "F - test-add-f-and-g\n" +} + +fn main { +} |