aboutsummaryrefslogtreecommitdiffstats
path: root/test/c/Makefile
blob: a728d182a84bc668458e25bd91790e2fe76e6779 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
include ../../Makefile.config

CCOMP=../../ccomp
# TODO - temporary
# CCOMPOPTS:=$(CCOMPOPTS) -fall-loads-nontrap -fduplicate 2 -fprepass
CCOMPFLAGS=$(CCOMPOPTS) -stdlib ../../runtime -dc -dclight -dasm

CFLAGS+=-O2 -Wall
EXECUTE:=timeout --signal=SIGTERM 20s $(EXECUTE)

LIBS=$(LIBMATH)

TIME=time >/dev/null
# FIXME - maybe this is better? From v3.6
# TIME=ocaml unix.cma ../../tools/xtime.ml -o /dev/null -mintime 2.0 -minruns 4

PROGS?=fib integr qsort fft fftsp fftw sha1 sha3 aes almabench \
  lists binarytrees fannkuch mandelbrot nbody \
  nsieve nsievebits spectral vmach \
  chomp perlin siphash24

##
# Kalray NOTE :
# * removed knucleotide from PROGS, it is hard to edit the input
#   to modify its size without resulting in a seg fault, and the base input
#   takes a too long time to complete in the simulator.
# * also removed bisect, who is exhibiting different float values on the Kalray
#   architecture than using x86 GCC (for both CompCert and GCC ports) (tested with n=10)
##
ifeq ($(ARCH),kvx)
	PROGS:=$(filter-out knucleotide,$(PROGS))
	PROGS:=$(filter-out bisect,$(PROGS))
endif

all: $(PROGS:%=%.compcert)

all_s: $(PROGS:%=%.s)

all_gcc: $(PROGS:%=%.gcc)

%.compcert: %.c
	$(CCOMP) $(CCOMPFLAGS) -o $*.compcert $*.c $(LIBS)

%.s: %.c
	$(CCOMP) $(CCOMPFLAGS) -S $*.c

%.gcc: %.c
	$(CC) $(CFLAGS) -o $*.gcc $*.c $(LIBS)

test: all
	@for i in $(PROGS); do \
		 SIMU='$(EXECUTE)' ./Runtest $$i ./$$i.compcert;\
         done

test_gcc: all_gcc
	@for i in $(PROGS); do \
	   SIMU='$(EXECUTE)' ./Runtest $$i ./$$i.gcc;\
         done

bench_gcc: all_gcc
	@for i in $(PROGS); do \
	   $(TIME) -name $$i -- ./$$i.gcc; \
         done

bench: all
	@for i in $(PROGS); do \
	   $(TIME) -name $$i -- ./$$i.compcert; \
         done

clean:
	rm -f *.compcert *.gcc
	rm -f *.compcert.c *.light.c *.parsed.c *.s *.o *.sdump *~ 
	rm -f *.out