From 4a71579b757d3a2eb6902c84391f429838ad4912 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 30 Jan 2020 12:33:44 -0300 Subject: git subrepo clone https://git.savannah.gnu.org/git/lightning.git deps/lightning subrepo: subdir: "deps/lightning" merged: "b0b8eb5" upstream: origin: "https://git.savannah.gnu.org/git/lightning.git" branch: "master" commit: "b0b8eb5" git-subrepo: version: "0.4.1" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "a04d8c2" --- deps/lightning/check/fib.tst | 62 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 deps/lightning/check/fib.tst (limited to 'deps/lightning/check/fib.tst') diff --git a/deps/lightning/check/fib.tst b/deps/lightning/check/fib.tst new file mode 100644 index 0000000..0835323 --- /dev/null +++ b/deps/lightning/check/fib.tst @@ -0,0 +1,62 @@ +.data 32 +format: +.c "nfibs(%d) = %d\n" + +.code + jmpi main + + name nfibs +nfibs: + prolog + arg $in + getarg %r0 $in // R0 = n + beqi ref %r0 0 + movr %r1 %r0 + movi %r0 1 + blei_u ref %r1 2 + subi %r2 %r1 2 + movr %r1 %r0 +loop: + subi %r2 %r2 1 // decr. counter + movr %v0 %r0 // V0 = R0 + addr %r0 %r0 %r1 // R0 = R0 + R1 + movr %r1 %v0 // R1 = V0 + bnei loop %r2 0 // if (R2) goto loop +ref: + retr %r0 // RET = R0 + epilog + + name main +main: + prolog + arg $argc + arg $argv + + getarg_i %r0 $argc + blei default %r0 1 + getarg %r0 $argv + addi %r0 %r0 $(__WORDSIZE >> 3) + ldr %r0 %r0 + prepare + pushargr %r0 + finishi @atoi + retval %r0 + jmpi call + +default: + movi %r0 32 + +call: + movr %v0 %r0 + prepare + pushargr %r0 + finishi nfibs + retval %r0 + prepare + pushargi format + ellipsis + pushargr %v0 + pushargr %r0 + finishi @printf + ret + epilog -- cgit v1.2.3