aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2018-12-11 14:26:46 +0100
committerCyril SIX <cyril.six@kalray.eu>2018-12-11 14:26:46 +0100
commit51a27f176b0eb5fb2943807a5cb95f2024420936 (patch)
tree4e1aceadab40427a7a5a80ec9250595a2ed534f3
parenta045315a8d1da5c4f726512b0dd972897afe9971 (diff)
downloadcompcert-kvx-51a27f176b0eb5fb2943807a5cb95f2024420936.tar.gz
compcert-kvx-51a27f176b0eb5fb2943807a5cb95f2024420936.zip
Fixed div64 and mod64
-rw-r--r--mppa_k1c/CBuiltins.ml1
-rw-r--r--runtime/mppa_k1c/Makefile2
-rw-r--r--runtime/mppa_k1c/i64_udivmod.c30
-rw-r--r--test/mppa/instr/Makefile5
-rw-r--r--test/mppa/interop/Makefile40
5 files changed, 27 insertions, 51 deletions
diff --git a/mppa_k1c/CBuiltins.ml b/mppa_k1c/CBuiltins.ml
index a5bdaa28..147bbb55 100644
--- a/mppa_k1c/CBuiltins.ml
+++ b/mppa_k1c/CBuiltins.ml
@@ -59,6 +59,7 @@ let builtins = {
"__builtin_k1_lwzu", (TInt(IUInt, []), [TPtr(TVoid [], [])], false);
(* ALU Instructions *)
+ "__builtin_clzll", (TInt(IULongLong, []), [TInt(IULongLong, [])], false);
(* "__builtin_k1_addhp", (TInt(IInt, []), [TInt(IInt, []); TInt(IInt, [])], false); *)
(* "__builtin_k1_adds", (TInt(IInt, []), [TInt(IInt, []); TInt(IInt, [])], false); *)
(* "__builtin_k1_bwlu", (TInt(IUInt, []),
diff --git a/runtime/mppa_k1c/Makefile b/runtime/mppa_k1c/Makefile
index e10c5086..37e15e94 100644
--- a/runtime/mppa_k1c/Makefile
+++ b/runtime/mppa_k1c/Makefile
@@ -1,4 +1,4 @@
-CCOMP ?= ccomp
+CCOMP ?= ../../ccomp
CFLAGS ?= -O2 -D__K1_TINYK1__
CFILES=$(wildcard *.c)
diff --git a/runtime/mppa_k1c/i64_udivmod.c b/runtime/mppa_k1c/i64_udivmod.c
index 20d8c976..74b39874 100644
--- a/runtime/mppa_k1c/i64_udivmod.c
+++ b/runtime/mppa_k1c/i64_udivmod.c
@@ -1,31 +1,3 @@
-#ifdef __K1_TINYK1__
-unsigned long long
-udivmoddi4(unsigned long long num, unsigned long long den, int modwanted)
-{
- unsigned long long bit = 1;
- unsigned long long res = 0;
-
- while (den < num && bit && !(den & (1L<<31)))
- {
- den <<=1;
- bit <<=1;
- }
- while (bit)
- {
- if (num >= den)
- {
- num -= den;
- res |= bit;
- }
- bit >>=1;
- den >>=1;
- }
- if (modwanted) return num;
- return res;
-}
-
-#else
-
/* THIS IS THE PREVIOUS VERSION, USED ON BOSTAN AND ANDEY */
unsigned long long
udivmoddi4(unsigned long long num, unsigned long long den, int modwanted)
@@ -54,5 +26,3 @@ udivmoddi4(unsigned long long num, unsigned long long den, int modwanted)
return modwanted ? r : q;
}
-#endif /* __K1_TINYK1__ */
-
diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile
index 336f3dcb..66e40365 100644
--- a/test/mppa/instr/Makefile
+++ b/test/mppa/instr/Makefile
@@ -1,7 +1,8 @@
K1CC ?= k1-mbr-gcc
CC ?= gcc
CCOMP ?= ccomp
-CFLAGS ?= -O2 -Wl,--wrap=printf
+OPTIM ?= -O2
+CFLAGS ?= $(OPTIM) -Wl,--wrap=printf
SIMU ?= k1-mppa
TIMEOUT ?= --signal=SIGTERM 120s
@@ -23,7 +24,7 @@ CCPATH=$(shell which $(CC))
CCOMPPATH=$(shell which $(CCOMP))
SIMUPATH=$(shell which $(SIMU))
-TESTNAMES=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c)))
+TESTNAMES?=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c)))
X86_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .x86-gcc.out,$(TESTNAMES)))
GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.out,$(TESTNAMES)))
CCOMP_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.out,$(TESTNAMES)))
diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile
index 78271a4e..e8c88ed8 100644
--- a/test/mppa/interop/Makefile
+++ b/test/mppa/interop/Makefile
@@ -57,6 +57,10 @@ BIN=$(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.bin,$(TESTNAMES)))\
all: $(BIN)
+GREEN=\033[0;32m
+RED=\033[0;31m
+NC=\033[0m
+
.PHONY:
test: $(X86_GCC_OUT) $(GCC_OUT) $(VAARG_X86_GCC_OUT) $(VAARG_GCC_OUT)
@echo "Comparing x86 gcc output to k1 gcc.."
@@ -65,15 +69,15 @@ test: $(X86_GCC_OUT) $(GCC_OUT) $(VAARG_X86_GCC_OUT) $(VAARG_GCC_OUT)
gccout=$(OUTDIR)/$$test.gcc.out;\
vaarg_x86out=$(OUTDIR)/$$test.x86-gcc.vaarg.out;\
vaarg_gccout=$(OUTDIR)/$$test.gcc.vaarg.out;\
- if ! diff $$x86out $$gccout; then\
- >&2 echo "ERROR: $$x86out and $$gccout differ";\
+ if ! diff $$x86out $$gccout > /dev/null; then\
+ >&2 printf "$(RED)ERROR: $$x86out and $$gccout differ$(NC)\n";\
else\
- echo "GOOD: $$x86out and $$gccout concur";\
+ printf "$(GREEN)GOOD: $$x86out and $$gccout concur$(NC)\n";\
fi;\
- if ! diff $$vaarg_x86out $$vaarg_gccout; then\
- >&2 echo "ERROR: $$vaarg_x86out and $$vaarg_gccout differ";\
+ if ! diff $$vaarg_x86out $$vaarg_gccout > /dev/null; then\
+ >&2 printf "$(RED)ERROR: $$vaarg_x86out and $$vaarg_gccout differ$(NC)\n";\
else\
- echo "GOOD: $$vaarg_x86out and $$vaarg_gccout concur";\
+ printf "$(GREEN)GOOD: $$vaarg_x86out and $$vaarg_gccout concur$(NC)\n";\
fi;\
done
@@ -87,25 +91,25 @@ check: $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) $(VAARG_GCC_OUT) $(VAARG_CCOMP_OUT
vaarg_gccout=$(OUTDIR)/$$test.gcc.vaarg.out;\
vaarg_ccompout=$(OUTDIR)/$$test.ccomp.vaarg.out;\
vaarg_gccrevout=$(OUTDIR)/$$test.gcc.rev.vaarg.out;\
- if ! diff $$ccompout $$gccout; then\
- >&2 echo "ERROR: $$ccompout and $$gccout differ";\
+ if ! diff $$ccompout $$gccout > /dev/null; then\
+ >&2 printf "$(RED)ERROR: $$ccompout and $$gccout differ$(NC)\n";\
else\
- echo "GOOD: $$ccompout and $$gccout concur";\
+ printf "$(GREEN)GOOD: $$ccompout and $$gccout concur$(NC)\n";\
fi;\
- if ! diff $$gccrevout $$gccout; then\
- >&2 echo "ERROR: $$gccrevout and $$gccout differ";\
+ if ! diff $$gccrevout $$gccout > /dev/null; then\
+ >&2 printf "$(RED)ERROR: $$gccrevout and $$gccout differ$(NC)\n";\
else\
- echo "GOOD: $$gccrevout and $$gccout concur";\
+ printf "$(GREEN)GOOD: $$gccrevout and $$gccout concur$(NC)\n";\
fi;\
- if ! diff $$vaarg_ccompout $$vaarg_gccout; then\
- >&2 echo "ERROR: $$vaarg_ccompout and $$vaarg_gccout differ";\
+ if ! diff $$vaarg_ccompout $$vaarg_gccout > /dev/null; then\
+ >&2 printf "$(RED)ERROR: $$vaarg_ccompout and $$vaarg_gccout differ$(NC)\n";\
else\
- echo "GOOD: $$vaarg_ccompout and $$vaarg_gccout concur";\
+ printf "$(GREEN)GOOD: $$vaarg_ccompout and $$vaarg_gccout concur$(NC)\n";\
fi;\
- if ! diff $$vaarg_gccrevout $$vaarg_gccout; then\
- >&2 echo "ERROR: $$vaarg_gccrevout and $$vaarg_gccout differ";\
+ if ! diff $$vaarg_gccrevout $$vaarg_gccout > /dev/null; then\
+ >&2 printf "$(RED)ERROR: $$vaarg_gccrevout and $$vaarg_gccout differ$(NC)\n";\
else\
- echo "GOOD: $$vaarg_gccrevout and $$vaarg_gccout concur";\
+ printf "$(GREEN)GOOD: $$vaarg_gccrevout and $$vaarg_gccout concur$(NC)\n";\
fi;\
done