diff options
Diffstat (limited to 'test/c')
-rw-r--r-- | test/c/Makefile | 27 | ||||
-rw-r--r-- | test/c/aes.c | 2 | ||||
-rw-r--r-- | test/c/fib.c | 4 |
3 files changed, 19 insertions, 14 deletions
diff --git a/test/c/Makefile b/test/c/Makefile index 51a8f105..14c856ff 100644 --- a/test/c/Makefile +++ b/test/c/Makefile @@ -3,17 +3,18 @@ include ../../Makefile.config CCOMP=../../ccomp CCOMPFLAGS=$(CCOMPOPTS) -stdlib ../../runtime -dc -dclight -dasm -CFLAGS=-O1 -Wall +CFLAGS+=-O1 -Wall LIBS=$(LIBMATH) -TIME=xtime -o /dev/null -mintime 2.0 # Xavier's hack -#TIME=time >/dev/null # Otherwise +#TIME=xtime -o /dev/null -mintime 2.0 # Xavier's hack +TIME=time >/dev/null # Otherwise -PROGS=fib integr qsort fft fftsp fftw sha1 sha3 aes almabench \ - lists binarytrees fannkuch knucleotide mandelbrot nbody \ - nsieve nsievebits spectral vmach \ - bisect chomp perlin siphash24 +PROGS?=fib qsort fftw sha1 sha3 aes \ + lists binarytrees fannkuch \ + nsieve nsievebits vmach \ + chomp perlin siphash24\ + integr fft fftsp almabench knucleotide mandelbrot nbody spectral bisect all: $(PROGS:%=%.compcert) @@ -30,28 +31,28 @@ all_gcc: $(PROGS:%=%.gcc) %.gcc: %.c $(CC) $(CFLAGS) -o $*.gcc $*.c $(LIBS) -test: +test: all @for i in $(PROGS); do \ - if $(SIMU) ./$$i.compcert | cmp -s - Results/$$i; \ + if $(EXECUTE) ./$$i.compcert | cmp -s - Results/$$i; \ then echo "$$i: passed"; \ else echo "$$i: FAILED"; exit 2; \ fi; \ done -test_gcc: +test_gcc: all_gcc @for i in $(PROGS); do \ - if ./$$i.gcc | cmp -s - Results/$$i; \ + if $(EXECUTE) ./$$i.gcc | cmp -s - Results/$$i; \ then echo "$$i: passed"; \ else echo "$$i: FAILED"; \ fi; \ done -bench_gcc: +bench_gcc: all_gcc @for i in $(PROGS); do \ echo -n "$$i: "; $(TIME) ./$$i.gcc; \ done -bench: +bench: all @for i in $(PROGS); do \ echo -n "$$i: "; $(TIME) ./$$i.compcert; \ done diff --git a/test/c/aes.c b/test/c/aes.c index 0aa02595..28d51a78 100644 --- a/test/c/aes.c +++ b/test/c/aes.c @@ -39,7 +39,7 @@ typedef unsigned int u32; #if defined(__ppc__) || defined(__PPC__) || defined(__ARMEB__) #define ARCH_BIG_ENDIAN #elif defined(__i386__) || defined(__x86_64__) || defined(__ARMEL__) \ - || defined(__riscv) + || defined(__riscv) || defined(__K1C__) #undef ARCH_BIG_ENDIAN #else #error "unknown endianness" diff --git a/test/c/fib.c b/test/c/fib.c index e4c7d095..19548415 100644 --- a/test/c/fib.c +++ b/test/c/fib.c @@ -12,7 +12,11 @@ int fib(int n) int main(int argc, char ** argv) { int n, r; +#ifdef __K1C_COS__ + if (argc >= 2) n = atoi(argv[1]); else n = 26; +#else if (argc >= 2) n = atoi(argv[1]); else n = 35; +#endif r = fib(n); printf("fib(%d) = %d\n", n, r); return 0; |