diff options
Diffstat (limited to 'fibonacci.s')
| -rw-r--r-- | fibonacci.s | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fibonacci.s b/fibonacci.s new file mode 100644 index 0000000..3e8ddd0 --- /dev/null +++ b/fibonacci.s | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | main: addi x3, x0, 0x0 | ||
| 2 | sw x0, 0x0(x3) | ||
| 3 | addi x5, x0, 1 | ||
| 4 | sw x5, 0x4(x3) | ||
| 5 | addi x5, x0, 4 | ||
| 6 | addi x9, x0, 0x3C | ||
| 7 | |||
| 8 | loop: addi x5, x5, 4 | ||
| 9 | addi x6, x5, -4 | ||
| 10 | addi x7, x5, -8 | ||
| 11 | lw x28, 0(x6) | ||
| 12 | lw x29, 0(x7) | ||
| 13 | add x30, x28, x29 | ||
| 14 | sw x30, 0(x5) | ||
| 15 | beq x5, x9, done | ||
| 16 | beq x5, x5 loop | ||
| 17 | done: beq x5, x5 done \ No newline at end of file | ||
