Created
March 14, 2015 13:36
-
-
Save good5dog5/707f83d3ce7231ed292a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.syntax unified | |
.arch armv7-a | |
.text | |
.align 2 | |
.thumb | |
.thumb_func | |
.global fibonacci | |
.type fibonacci, function | |
fibonacci: | |
@ ADD/ MODIFY CODE BELOW | |
@ r3 = previous | |
@ r4 = result | |
@ r6 = sum | |
push {r3, r4, r6, lr} | |
mov r3, #-1 | |
mov r4, #1 | |
mov r6, #0 | |
loop: | |
add r6, r3, r4 @sum = result + previous | |
mov r3, r4 | |
mov r4, r6 | |
subs r0, #1 | |
bge loop | |
mov r0, r6 | |
pop {r3, r4, r6, pc} | |
.size fibonacci, .-fibonacci | |
.end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment