projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
e2f37d0
)
fibonacci test program
author
Matthias Braun
<matze@braunis.de>
Mon, 12 Jun 2006 08:27:28 +0000
(08:27 +0000)
committer
Matthias Braun
<matze@braunis.de>
Mon, 12 Jun 2006 08:27:28 +0000
(08:27 +0000)
ir/be/test/fib.c
[new file with mode: 0644]
patch
|
blob
diff --git a/ir/be/test/fib.c
b/ir/be/test/fib.c
new file mode 100644
(file)
index 0000000..
a11e94f
--- /dev/null
+++ b/
ir/be/test/fib.c
@@ -0,0
+1,21
@@
+#include <stdio.h>
+
+unsigned fib(unsigned n)
+{
+ if(n == 0)
+ return 0;
+ if(n == 1)
+ return 1;
+
+ return fib(n-1) + fib(n-2);
+}
+
+int main(int argc, char** argv) {
+ unsigned n = 8;
+ if(argc > 1)
+ n = (unsigned) atoi(argv[1]);
+
+ printf("Fib %u: %u\n", n, fib(n));
+
+ return 0;
+}