tweeks to the c tests

also figured out hello was caching stopped that to make results
comparable
even wrote a hello assembler version which is just 10% faster than soml
:-)
This commit is contained in:
Torsten Ruger 2015-11-21 16:33:07 +02:00
parent a589df7bf9
commit f865486f1e
6 changed files with 37 additions and 12 deletions

24
stash/prog7a.s Normal file
View File

@ -0,0 +1,24 @@
/* How to use Syscall 4 to write a string */
.global _start
_start:
MOV R5, #100352
SUB R5 , R5 , #352
_loop:
MOV R7, #4 @ Syscall number
MOV R0, #1 @ Stdout is monitor
MOV R2, #19 @ string is 19 chars long
LDR R1,=string @ string located at string:
SWI 0
SUBS R5 , R5 , #1
BNE _loop
_exit:
@ exit syscall
MOV R7, #1
SWI 0
.data
string:
.ascii "Hello World String\n"

View File

@ -17,7 +17,7 @@ int fibo(int n){
int main(void) int main(void)
{ {
int counter = 98304 + 1696; int counter = 100352 - 352;
int counter2 = counter; int counter2 = counter;
int level = 40; int level = 40;
int fib ; int fib ;

View File

@ -2,7 +2,8 @@
int main(void) int main(void)
{ {
int counter = 98304 + 1696; setbuf(stdout, NULL); /* to make it equivalent to the soml, otherwise it caches */
int counter = 100352 - 352;
while(counter--) { while(counter--) {
printf("Hello there\n"); printf("Hello there\n");
} }

View File

@ -4,7 +4,7 @@ int main(void)
{ {
char stringa[20] ; char stringa[20] ;
int counter = 98304 + 1696; int counter = 100352 - 352;
while(counter--) { while(counter--) {
sprintf(stringa, "%i\n" , counter); sprintf(stringa, "%i\n" , counter);
} }

9
test/bench/c/loop.c Normal file
View File

@ -0,0 +1,9 @@
#include<stdio.h>
int main(void)
{
int counter = 100352 - 352;
while(counter) {
counter = counter - 1;
}
}

View File

@ -1,9 +0,0 @@
#include<stdio.h>
int main(void)
{
int counter = 98304 + 1696;
while(counter--) {
counter = counter;
}
}