We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8f9876 commit ef1dbb5Copy full SHA for ef1dbb5
build/Fibonacci.elf
-217 KB
build/fibonacci.elf
74.6 KB
tests/fibonacci.s
@@ -0,0 +1,43 @@
1
+fib:
2
+ li a5,1
3
+ bleu a0,a5,.L3
4
+ addi sp,sp,-16
5
+ sw ra,12(sp)
6
+ sw s0,8(sp)
7
+ sw s1,4(sp)
8
+ mv s0,a0
9
+ addi a0,a0,-1
10
+ la t0,fib
11
+ jalr ra,0(t0)
12
+ mv s1,a0
13
+ addi a0,s0,-2
14
15
16
+ add a0,s1,a0
17
+ lw ra,12(sp)
18
+ lw s0,8(sp)
19
+ lw s1,4(sp)
20
+ addi sp,sp,16
21
+ jr ra
22
+.L3:
23
+ li a0,1
24
+ ret
25
+.LC0:
26
+ .string "%d\n"
27
+ .text
28
+ .align 1
29
+ .globl main
30
+ .type main, @function
31
+main:
32
33
34
+ li a0,42
35
+ call fib
36
+ mv a1,a0
37
+ lui a0,%hi(.LC0)
38
+ addi a0,a0,%lo(.LC0)
39
+ call printf
40
+ li a0,0
41
42
43
0 commit comments