From d15b2c014daf547e10504278ae42d4651dc71319 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 13 Nov 2018 11:44:56 +0100 Subject: Revamped the instruction testsuite (all instructions work except umodd and udivd) --- test/mppa/Makefile | 161 ++++++++++++++++++++++++++---------------- test/mppa/builtins/clzll.c | 7 ++ test/mppa/builtins/stsud.c | 7 ++ test/mppa/check.sh | 32 --------- test/mppa/general/.gitignore | 1 - test/mppa/general/addw.c | 5 -- test/mppa/general/andd.c | 5 -- test/mppa/general/andw.c | 5 -- test/mppa/general/branch.c | 10 --- test/mppa/general/branchz.c | 10 --- test/mppa/general/branchzu.c | 11 --- test/mppa/general/call.c | 16 ----- test/mppa/general/cb.deqz.c | 10 --- test/mppa/general/cb.dgez.c | 10 --- test/mppa/general/cb.dgtz.c | 10 --- test/mppa/general/cb.dlez.c | 10 --- test/mppa/general/cb.dltz.c | 10 --- test/mppa/general/cb.dnez.c | 10 --- test/mppa/general/cb.wgez.c | 10 --- test/mppa/general/cb.wgtz.c | 10 --- test/mppa/general/cb.wlez.c | 10 --- test/mppa/general/cb.wltz.c | 10 --- test/mppa/general/clzll.c | 7 -- test/mppa/general/compd.eq.c | 7 -- test/mppa/general/compd.geu.c | 7 -- test/mppa/general/compd.gt.c | 7 -- test/mppa/general/compd.gtu.c | 7 -- test/mppa/general/compd.le.c | 7 -- test/mppa/general/compd.leu.c | 7 -- test/mppa/general/compd.lt.c | 7 -- test/mppa/general/compd.ltu.c | 7 -- test/mppa/general/compd.ne.c | 7 -- test/mppa/general/compw.eq.c | 7 -- test/mppa/general/compw.geu.c | 7 -- test/mppa/general/compw.gt.c | 7 -- test/mppa/general/compw.gtu.c | 7 -- test/mppa/general/compw.le.c | 7 -- test/mppa/general/compw.leu.c | 7 -- test/mppa/general/compw.lt.c | 7 -- test/mppa/general/compw.ltu.c | 7 -- test/mppa/general/compw.ne.c | 7 -- test/mppa/general/div2.c | 7 -- test/mppa/general/for.c | 9 --- test/mppa/general/forvar.c | 9 --- test/mppa/general/forvarl.c | 10 --- test/mppa/general/framework.h | 26 ------- test/mppa/general/lbs.c | 9 --- test/mppa/general/lbz.c | 9 --- test/mppa/general/muld.c | 7 -- test/mppa/general/mulw.c | 7 -- test/mppa/general/negd.c | 7 -- test/mppa/general/ord.c | 7 -- test/mppa/general/sbfd.c | 7 -- test/mppa/general/sbfw.c | 7 -- test/mppa/general/simple.c | 7 -- test/mppa/general/sllw.c | 7 -- test/mppa/general/srad.c | 7 -- test/mppa/general/srld.c | 7 -- test/mppa/general/stsud.c | 7 -- test/mppa/general/udivd.c | 7 -- test/mppa/general/umodd.c | 7 -- test/mppa/general/xord.c | 7 -- test/mppa/generate.sh | 17 ----- test/mppa/instr/.gitignore | 1 + test/mppa/instr/addw.c | 5 ++ test/mppa/instr/andd.c | 5 ++ test/mppa/instr/andw.c | 5 ++ test/mppa/instr/branch.c | 10 +++ test/mppa/instr/branchz.c | 10 +++ test/mppa/instr/branchzu.c | 11 +++ test/mppa/instr/call.c | 16 +++++ test/mppa/instr/cb.deqz.c | 10 +++ test/mppa/instr/cb.dgez.c | 10 +++ test/mppa/instr/cb.dgtz.c | 10 +++ test/mppa/instr/cb.dlez.c | 10 +++ test/mppa/instr/cb.dltz.c | 10 +++ test/mppa/instr/cb.dnez.c | 10 +++ test/mppa/instr/cb.wgez.c | 10 +++ test/mppa/instr/cb.wgtz.c | 10 +++ test/mppa/instr/cb.wlez.c | 10 +++ test/mppa/instr/cb.wltz.c | 10 +++ test/mppa/instr/compd.eq.c | 7 ++ test/mppa/instr/compd.geu.c | 7 ++ test/mppa/instr/compd.gt.c | 7 ++ test/mppa/instr/compd.gtu.c | 7 ++ test/mppa/instr/compd.le.c | 7 ++ test/mppa/instr/compd.leu.c | 7 ++ test/mppa/instr/compd.lt.c | 7 ++ test/mppa/instr/compd.ltu.c | 7 ++ test/mppa/instr/compd.ne.c | 7 ++ test/mppa/instr/compw.eq.c | 7 ++ test/mppa/instr/compw.geu.c | 7 ++ test/mppa/instr/compw.gt.c | 7 ++ test/mppa/instr/compw.gtu.c | 7 ++ test/mppa/instr/compw.le.c | 7 ++ test/mppa/instr/compw.leu.c | 7 ++ test/mppa/instr/compw.lt.c | 7 ++ test/mppa/instr/compw.ltu.c | 7 ++ test/mppa/instr/compw.ne.c | 7 ++ test/mppa/instr/div2.c | 7 ++ test/mppa/instr/for.c | 9 +++ test/mppa/instr/forvar.c | 9 +++ test/mppa/instr/forvarl.c | 10 +++ test/mppa/instr/framework.h | 26 +++++++ test/mppa/instr/lbs.c | 9 +++ test/mppa/instr/lbz.c | 9 +++ test/mppa/instr/muld.c | 7 ++ test/mppa/instr/mulw.c | 7 ++ test/mppa/instr/negd.c | 7 ++ test/mppa/instr/ord.c | 7 ++ test/mppa/instr/sbfd.c | 7 ++ test/mppa/instr/sbfw.c | 7 ++ test/mppa/instr/simple.c | 7 ++ test/mppa/instr/sllw.c | 7 ++ test/mppa/instr/srad.c | 7 ++ test/mppa/instr/srld.c | 7 ++ test/mppa/instr/udivd.c | 7 ++ test/mppa/instr/umodd.c | 7 ++ test/mppa/instr/xord.c | 7 ++ 119 files changed, 574 insertions(+), 582 deletions(-) create mode 100644 test/mppa/builtins/clzll.c create mode 100644 test/mppa/builtins/stsud.c delete mode 100644 test/mppa/check.sh delete mode 100644 test/mppa/general/.gitignore delete mode 100644 test/mppa/general/addw.c delete mode 100644 test/mppa/general/andd.c delete mode 100644 test/mppa/general/andw.c delete mode 100644 test/mppa/general/branch.c delete mode 100644 test/mppa/general/branchz.c delete mode 100644 test/mppa/general/branchzu.c delete mode 100644 test/mppa/general/call.c delete mode 100644 test/mppa/general/cb.deqz.c delete mode 100644 test/mppa/general/cb.dgez.c delete mode 100644 test/mppa/general/cb.dgtz.c delete mode 100644 test/mppa/general/cb.dlez.c delete mode 100644 test/mppa/general/cb.dltz.c delete mode 100644 test/mppa/general/cb.dnez.c delete mode 100644 test/mppa/general/cb.wgez.c delete mode 100644 test/mppa/general/cb.wgtz.c delete mode 100644 test/mppa/general/cb.wlez.c delete mode 100644 test/mppa/general/cb.wltz.c delete mode 100644 test/mppa/general/clzll.c delete mode 100644 test/mppa/general/compd.eq.c delete mode 100644 test/mppa/general/compd.geu.c delete mode 100644 test/mppa/general/compd.gt.c delete mode 100644 test/mppa/general/compd.gtu.c delete mode 100644 test/mppa/general/compd.le.c delete mode 100644 test/mppa/general/compd.leu.c delete mode 100644 test/mppa/general/compd.lt.c delete mode 100644 test/mppa/general/compd.ltu.c delete mode 100644 test/mppa/general/compd.ne.c delete mode 100644 test/mppa/general/compw.eq.c delete mode 100644 test/mppa/general/compw.geu.c delete mode 100644 test/mppa/general/compw.gt.c delete mode 100644 test/mppa/general/compw.gtu.c delete mode 100644 test/mppa/general/compw.le.c delete mode 100644 test/mppa/general/compw.leu.c delete mode 100644 test/mppa/general/compw.lt.c delete mode 100644 test/mppa/general/compw.ltu.c delete mode 100644 test/mppa/general/compw.ne.c delete mode 100644 test/mppa/general/div2.c delete mode 100644 test/mppa/general/for.c delete mode 100644 test/mppa/general/forvar.c delete mode 100644 test/mppa/general/forvarl.c delete mode 100644 test/mppa/general/framework.h delete mode 100644 test/mppa/general/lbs.c delete mode 100644 test/mppa/general/lbz.c delete mode 100644 test/mppa/general/muld.c delete mode 100644 test/mppa/general/mulw.c delete mode 100644 test/mppa/general/negd.c delete mode 100644 test/mppa/general/ord.c delete mode 100644 test/mppa/general/sbfd.c delete mode 100644 test/mppa/general/sbfw.c delete mode 100644 test/mppa/general/simple.c delete mode 100644 test/mppa/general/sllw.c delete mode 100644 test/mppa/general/srad.c delete mode 100644 test/mppa/general/srld.c delete mode 100644 test/mppa/general/stsud.c delete mode 100644 test/mppa/general/udivd.c delete mode 100644 test/mppa/general/umodd.c delete mode 100644 test/mppa/general/xord.c delete mode 100644 test/mppa/generate.sh create mode 100644 test/mppa/instr/.gitignore create mode 100644 test/mppa/instr/addw.c create mode 100644 test/mppa/instr/andd.c create mode 100644 test/mppa/instr/andw.c create mode 100644 test/mppa/instr/branch.c create mode 100644 test/mppa/instr/branchz.c create mode 100644 test/mppa/instr/branchzu.c create mode 100644 test/mppa/instr/call.c create mode 100644 test/mppa/instr/cb.deqz.c create mode 100644 test/mppa/instr/cb.dgez.c create mode 100644 test/mppa/instr/cb.dgtz.c create mode 100644 test/mppa/instr/cb.dlez.c create mode 100644 test/mppa/instr/cb.dltz.c create mode 100644 test/mppa/instr/cb.dnez.c create mode 100644 test/mppa/instr/cb.wgez.c create mode 100644 test/mppa/instr/cb.wgtz.c create mode 100644 test/mppa/instr/cb.wlez.c create mode 100644 test/mppa/instr/cb.wltz.c create mode 100644 test/mppa/instr/compd.eq.c create mode 100644 test/mppa/instr/compd.geu.c create mode 100644 test/mppa/instr/compd.gt.c create mode 100644 test/mppa/instr/compd.gtu.c create mode 100644 test/mppa/instr/compd.le.c create mode 100644 test/mppa/instr/compd.leu.c create mode 100644 test/mppa/instr/compd.lt.c create mode 100644 test/mppa/instr/compd.ltu.c create mode 100644 test/mppa/instr/compd.ne.c create mode 100644 test/mppa/instr/compw.eq.c create mode 100644 test/mppa/instr/compw.geu.c create mode 100644 test/mppa/instr/compw.gt.c create mode 100644 test/mppa/instr/compw.gtu.c create mode 100644 test/mppa/instr/compw.le.c create mode 100644 test/mppa/instr/compw.leu.c create mode 100644 test/mppa/instr/compw.lt.c create mode 100644 test/mppa/instr/compw.ltu.c create mode 100644 test/mppa/instr/compw.ne.c create mode 100644 test/mppa/instr/div2.c create mode 100644 test/mppa/instr/for.c create mode 100644 test/mppa/instr/forvar.c create mode 100644 test/mppa/instr/forvarl.c create mode 100644 test/mppa/instr/framework.h create mode 100644 test/mppa/instr/lbs.c create mode 100644 test/mppa/instr/lbz.c create mode 100644 test/mppa/instr/muld.c create mode 100644 test/mppa/instr/mulw.c create mode 100644 test/mppa/instr/negd.c create mode 100644 test/mppa/instr/ord.c create mode 100644 test/mppa/instr/sbfd.c create mode 100644 test/mppa/instr/sbfw.c create mode 100644 test/mppa/instr/simple.c create mode 100644 test/mppa/instr/sllw.c create mode 100644 test/mppa/instr/srad.c create mode 100644 test/mppa/instr/srld.c create mode 100644 test/mppa/instr/udivd.c create mode 100644 test/mppa/instr/umodd.c create mode 100644 test/mppa/instr/xord.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 5b312475..148b16b3 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,70 +1,111 @@ -DIR=general -BINDIR=bin -ASMDIR=asm +K1CC ?= k1-mbr-gcc +CC ?= gcc +CCOMP ?= ccomp +CFLAGS ?= -O2 +SIMU ?= k1-cluster +TIMEOUT ?= 10s + +DIR=instr +SRCDIR=$(DIR) +OUTDIR=$(DIR)/out +BINDIR=$(DIR)/bin +ASMDIR=$(DIR)/asm + +## +# Intended flow : .c -> .gcc.s -> .gcc.bin -> .gcc.out +# -> .ccomp.s -> .ccomp.bin -> .ccomp.out +## + +K1CCPATH=$(shell which $(K1CC)) +CCPATH=$(shell which $(CC)) +CCOMPPATH=$(shell which $(CCOMP)) +SIMUPATH=$(shell which $(SIMU)) + 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))) -CCOMP=../../ccomp -#TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) -ELF=$(addprefix $(DIR)/$(BINDIR)/,$(addsuffix .bin,$(TESTNAMES))) -TOK=$(addprefix $(DIR)/$(BINDIR)/,$(addsuffix .tok,$(TESTNAMES))) -ASM=$(addprefix $(DIR)/$(ASMDIR)/,$(addsuffix .s,$(TESTNAMES))) -DEBUG:=$(if $(DEBUG),"-dall",) +OUT=$(X86_GCC_OUT) $(GCC_OUT) $(CCOMP_OUT) +BIN=$(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.bin,$(TESTNAMES)))\ + $(addprefix $(BINDIR)/,$(addsuffix .gcc.bin,$(TESTNAMES)))\ + $(addprefix $(BINDIR)/,$(addsuffix .ccomp.bin,$(TESTNAMES))) -.PHONY: all -all: $(ELF) +## +# Targets +## -nobin: $(ASM) +all: $(BIN) -$(DIR)/$(BINDIR)/%.bin: $(DIR)/$(ASMDIR)/%.s - @mkdir -p $(@D) - ccomp $< -o $@ +.PHONY: +test: $(X86_GCC_OUT) $(GCC_OUT) + @echo "Comparing x86 gcc output to k1 gcc.." + @for test in $(TESTNAMES); do\ + x86out=$(OUTDIR)/$$test.x86-gcc.out;\ + gccout=$(OUTDIR)/$$test.gcc.out;\ + if ! diff $$x86out $$gccout; then\ + >&2 echo "ERROR: $$x86out and $$gccout differ";\ + else\ + echo "GOOD: $$x86out and $$gccout concur";\ + fi;\ + done + +.PHONY: +check: $(GCC_OUT) $(CCOMP_OUT) + @echo "Comparing k1 gcc output to ccomp.." + @for test in $(TESTNAMES); do\ + gccout=$(OUTDIR)/$$test.gcc.out;\ + ccompout=$(OUTDIR)/$$test.ccomp.out;\ + if ! diff $$ccompout $$gccout; then\ + >&2 echo "ERROR: $$ccompout and $$gccout differ";\ + else\ + echo "GOOD: $$ccompout and $$gccout concur";\ + fi;\ + done + +## +# Rules +## .SECONDARY: -$(DIR)/$(ASMDIR)/%.s: $(DIR)/%.c $(CCOMP) +# Generating output + +$(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin + @mkdir -p $(@D) + timeout $(TIMEOUT) ./$< || { ret=$$?; } > $@; echo $$ret >> $@ + +$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) + @mkdir -p $(@D) + timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ + +$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) + @mkdir -p $(@D) + timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ + +# Assembly to binary + +$(BINDIR)/%.x86-gcc.bin: $(ASMDIR)/%.x86-gcc.s $(CCPATH) + @mkdir -p $(@D) + $(CC) $(CFLAGS) $< -o $@ + +$(BINDIR)/%.gcc.bin: $(ASMDIR)/%.gcc.s $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) $< -o $@ + +$(BINDIR)/%.ccomp.bin: $(ASMDIR)/%.ccomp.s $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) $< -o $@ + +# Source to assembly + +$(ASMDIR)/%.x86-gcc.s: $(SRCDIR)/%.c $(CCPATH) + @mkdir -p $(@D) + $(CC) $(CFLAGS) -S $< -o $@ + +$(ASMDIR)/%.gcc.s: $(SRCDIR)/%.c $(K1CCPATH) @mkdir -p $(@D) - ccomp $(DEBUG) -O0 -v -S $< -o $@ + $(K1CC) $(CFLAGS) -S $< -o $@ -$(DIR)/$(BINDIR)/%.tok: $(DIR)/$(BINDIR)/%.bin $(DIR)/output/%.bin.exp +$(ASMDIR)/%.ccomp.s: $(SRCDIR)/%.c $(CCOMPPATH) @mkdir -p $(@D) - @bash check.sh $< $@ - -$(DIR)/output/%.bin.exp: $(DIR)/%.c - @bash generate.sh $< $@ - -.PHONY: FORCE -FORCE: - -.PHONY: check -check: $(TOK) sort mmult - -.PHONY: coverage -coverage: $(ASM) - bash coverage.sh $(DIR)/$(ASMDIR) - - -.PHONY: sort -sort: FORCE - (cd sort && make compc-check) - -.PHONY: mmult -mmult: FORCE - (cd mmult && make compc-check) - -.PHONY: clean -clean: - rm -f $(DIR)/*.alloctrace - rm -f $(DIR)/*.cm - rm -f $(DIR)/*.compcert.c - rm -f $(DIR)/*.i - rm -f $(DIR)/*.light.c - rm -f $(DIR)/*.ltl - rm -f $(DIR)/*.mach - rm -f $(DIR)/*.parsed.c - rm -f $(DIR)/*.rtl.? - rm -f $(DIR)/$(ASMDIR)/*.s - rm -f $(DIR)/$(BINDIR)/*.bin - rm -f $(DIR)/$(BINDIR)/*.tok - rm -f $(DIR)/output/*.out - rm -f $(DIR)/output/*.exp - rm -rf $(DIR)/profile/ - rm -f $(ELF) + $(CCOMP) $(CFLAGS) -S $< -o $@ diff --git a/test/mppa/builtins/clzll.c b/test/mppa/builtins/clzll.c new file mode 100644 index 00000000..13905cba --- /dev/null +++ b/test/mppa/builtins/clzll.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = __builtin_clzll(a); +} +END_TEST() diff --git a/test/mppa/builtins/stsud.c b/test/mppa/builtins/stsud.c new file mode 100644 index 00000000..81fb6e6d --- /dev/null +++ b/test/mppa/builtins/stsud.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = __builtin_k1_stsud(a, b); +} +END_TEST() diff --git a/test/mppa/check.sh b/test/mppa/check.sh deleted file mode 100644 index dd9691be..00000000 --- a/test/mppa/check.sh +++ /dev/null @@ -1,32 +0,0 @@ -# $1: binary file to check -# $2: output check token - -elffile="$1" -token="$2" - -if [ ! -f $elffile ]; then - >&2 echo "ERROR: $elffile not found" - shift; continue -fi - -dir="$(dirname $elffile)" -elf="$(basename $elffile)" - -exp="$dir/../output/$elf.exp" -out="$dir/../output/$elf.out" -if [ ! -f $exp ]; then - >&2 echo "ERROR: $exp not found" - exit -fi - -k1-cluster -- $elffile > $out -echo $? >> $out - -if ! diff $exp $out; then - >&2 echo "ERROR: $exp and $out differ" - exit -fi - -echo "PASSED: $elf" -touch $token -#shift diff --git a/test/mppa/general/.gitignore b/test/mppa/general/.gitignore deleted file mode 100644 index ea1472ec..00000000 --- a/test/mppa/general/.gitignore +++ /dev/null @@ -1 +0,0 @@ -output/ diff --git a/test/mppa/general/addw.c b/test/mppa/general/addw.c deleted file mode 100644 index be8afc67..00000000 --- a/test/mppa/general/addw.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) - c = a+b; -END_TEST() diff --git a/test/mppa/general/andd.c b/test/mppa/general/andd.c deleted file mode 100644 index 4f503764..00000000 --- a/test/mppa/general/andd.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) - return a&b; -END_TEST() diff --git a/test/mppa/general/andw.c b/test/mppa/general/andw.c deleted file mode 100644 index 99de0049..00000000 --- a/test/mppa/general/andw.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) - c = a&b; -END_TEST() diff --git a/test/mppa/general/branch.c b/test/mppa/general/branch.c deleted file mode 100644 index 72e7e20e..00000000 --- a/test/mppa/general/branch.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - if ((a & 0x1) == 1) - c = 0; - else - c = 1; -} -END_TEST() diff --git a/test/mppa/general/branchz.c b/test/mppa/general/branchz.c deleted file mode 100644 index fb86d357..00000000 --- a/test/mppa/general/branchz.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - if (a & 0x1 == 0) - c = 0; - else - c = 1; -} -END_TEST() diff --git a/test/mppa/general/branchzu.c b/test/mppa/general/branchzu.c deleted file mode 100644 index 97adb605..00000000 --- a/test/mppa/general/branchzu.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - b = !(a & 0x01); - if (!b) - c = 0; - else - c = 1; -} -END_TEST() diff --git a/test/mppa/general/call.c b/test/mppa/general/call.c deleted file mode 100644 index 727cef63..00000000 --- a/test/mppa/general/call.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "framework.h" - -int sum(int a, int b){ - return a+b; -} - -int make(int a){ - return a; -} - -BEGIN_TEST(int) -{ - c = sum(make(a), make(b)); -} -END_TEST() -/* RETURN VALUE: 60 */ diff --git a/test/mppa/general/cb.deqz.c b/test/mppa/general/cb.deqz.c deleted file mode 100644 index c56733f0..00000000 --- a/test/mppa/general/cb.deqz.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - if (0 != (a & 0x1LL)) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.dgez.c b/test/mppa/general/cb.dgez.c deleted file mode 100644 index abb6ec57..00000000 --- a/test/mppa/general/cb.dgez.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - if (0 > (a & 0x1LL)) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.dgtz.c b/test/mppa/general/cb.dgtz.c deleted file mode 100644 index d4271845..00000000 --- a/test/mppa/general/cb.dgtz.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - if (0 >= (a & 0x1LL) - 1) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.dlez.c b/test/mppa/general/cb.dlez.c deleted file mode 100644 index 18e67f06..00000000 --- a/test/mppa/general/cb.dlez.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - if (a & 0x1LL > 0) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.dltz.c b/test/mppa/general/cb.dltz.c deleted file mode 100644 index 366aea49..00000000 --- a/test/mppa/general/cb.dltz.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - if ((a & 0x1LL) - 1 >= 0) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.dnez.c b/test/mppa/general/cb.dnez.c deleted file mode 100644 index 81c2cd29..00000000 --- a/test/mppa/general/cb.dnez.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - if (0 == (a & 0x1LL)) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.wgez.c b/test/mppa/general/cb.wgez.c deleted file mode 100644 index 477f4bc6..00000000 --- a/test/mppa/general/cb.wgez.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - if (0 > (a & 0x1) - 1) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.wgtz.c b/test/mppa/general/cb.wgtz.c deleted file mode 100644 index c9ab9a06..00000000 --- a/test/mppa/general/cb.wgtz.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - if (0 >= (a & 0x1)) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.wlez.c b/test/mppa/general/cb.wlez.c deleted file mode 100644 index c3069fda..00000000 --- a/test/mppa/general/cb.wlez.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - if ((a & 0x1) > 0) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/cb.wltz.c b/test/mppa/general/cb.wltz.c deleted file mode 100644 index 6cf5fcf0..00000000 --- a/test/mppa/general/cb.wltz.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - if ((a & 0x1) - 1 >= 0) - c = 1; - else - c = 0; -} -END_TEST() diff --git a/test/mppa/general/clzll.c b/test/mppa/general/clzll.c deleted file mode 100644 index 13905cba..00000000 --- a/test/mppa/general/clzll.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = __builtin_clzll(a); -} -END_TEST() diff --git a/test/mppa/general/compd.eq.c b/test/mppa/general/compd.eq.c deleted file mode 100644 index d19a4d20..00000000 --- a/test/mppa/general/compd.eq.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = ((a & 0x1LL) == (b & 0x1LL)); -} -END_TEST() diff --git a/test/mppa/general/compd.geu.c b/test/mppa/general/compd.geu.c deleted file mode 100644 index edc31183..00000000 --- a/test/mppa/general/compd.geu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = (a >= b); -} -END_TEST() diff --git a/test/mppa/general/compd.gt.c b/test/mppa/general/compd.gt.c deleted file mode 100644 index 24147779..00000000 --- a/test/mppa/general/compd.gt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = (a > b); -} -END_TEST() diff --git a/test/mppa/general/compd.gtu.c b/test/mppa/general/compd.gtu.c deleted file mode 100644 index 5ce82569..00000000 --- a/test/mppa/general/compd.gtu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = (a > b); -} -END_TEST() diff --git a/test/mppa/general/compd.le.c b/test/mppa/general/compd.le.c deleted file mode 100644 index a84aad97..00000000 --- a/test/mppa/general/compd.le.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = (a <= b); -} -END_TEST() diff --git a/test/mppa/general/compd.leu.c b/test/mppa/general/compd.leu.c deleted file mode 100644 index e386bc27..00000000 --- a/test/mppa/general/compd.leu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = (a <= b); -} -END_TEST() diff --git a/test/mppa/general/compd.lt.c b/test/mppa/general/compd.lt.c deleted file mode 100644 index df07a708..00000000 --- a/test/mppa/general/compd.lt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = (a < b); -} -END_TEST() diff --git a/test/mppa/general/compd.ltu.c b/test/mppa/general/compd.ltu.c deleted file mode 100644 index dfaa8921..00000000 --- a/test/mppa/general/compd.ltu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = (a < b); -} -END_TEST() diff --git a/test/mppa/general/compd.ne.c b/test/mppa/general/compd.ne.c deleted file mode 100644 index 19ce0a69..00000000 --- a/test/mppa/general/compd.ne.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = ((a & 0x1ULL) != (b & 0x1ULL)); -} -END_TEST() diff --git a/test/mppa/general/compw.eq.c b/test/mppa/general/compw.eq.c deleted file mode 100644 index dc7a3ab1..00000000 --- a/test/mppa/general/compw.eq.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = ((a & 0x1) == (b & 0x1)); -} -END_TEST() diff --git a/test/mppa/general/compw.geu.c b/test/mppa/general/compw.geu.c deleted file mode 100644 index d72ca56c..00000000 --- a/test/mppa/general/compw.geu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (a >= b); -} -END_TEST() diff --git a/test/mppa/general/compw.gt.c b/test/mppa/general/compw.gt.c deleted file mode 100644 index 9ad02610..00000000 --- a/test/mppa/general/compw.gt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (a > b); -} -END_TEST() diff --git a/test/mppa/general/compw.gtu.c b/test/mppa/general/compw.gtu.c deleted file mode 100644 index 77f04989..00000000 --- a/test/mppa/general/compw.gtu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (a > b); -} -END_TEST() diff --git a/test/mppa/general/compw.le.c b/test/mppa/general/compw.le.c deleted file mode 100644 index b7a7a432..00000000 --- a/test/mppa/general/compw.le.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (a <= b); -} -END_TEST() diff --git a/test/mppa/general/compw.leu.c b/test/mppa/general/compw.leu.c deleted file mode 100644 index 4892f06c..00000000 --- a/test/mppa/general/compw.leu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (a <= b); -} -END_TEST() diff --git a/test/mppa/general/compw.lt.c b/test/mppa/general/compw.lt.c deleted file mode 100644 index 2cc151bf..00000000 --- a/test/mppa/general/compw.lt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (a < b); -} -END_TEST() diff --git a/test/mppa/general/compw.ltu.c b/test/mppa/general/compw.ltu.c deleted file mode 100644 index b524127f..00000000 --- a/test/mppa/general/compw.ltu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (a < b); -} -END_TEST() diff --git a/test/mppa/general/compw.ne.c b/test/mppa/general/compw.ne.c deleted file mode 100644 index 433b0b86..00000000 --- a/test/mppa/general/compw.ne.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = ((a & 0x1U) != (b & 0x1U)); -} -END_TEST() diff --git a/test/mppa/general/div2.c b/test/mppa/general/div2.c deleted file mode 100644 index 01a4b575..00000000 --- a/test/mppa/general/div2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (a + b) / 2; -} -END_TEST() diff --git a/test/mppa/general/for.c b/test/mppa/general/for.c deleted file mode 100644 index d6870afb..00000000 --- a/test/mppa/general/for.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - int j; - for (j = 0 ; j < 10 ; j++) - c += a; -} -END_TEST() diff --git a/test/mppa/general/forvar.c b/test/mppa/general/forvar.c deleted file mode 100644 index 57548274..00000000 --- a/test/mppa/general/forvar.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - int j; - for (j = 0 ; j < (b & 0x8) ; j++) - c += a; -} -END_TEST() diff --git a/test/mppa/general/forvarl.c b/test/mppa/general/forvarl.c deleted file mode 100644 index 30717a51..00000000 --- a/test/mppa/general/forvarl.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long int) -{ - int j; - - for (j = 0 ; j < (b & 0x8LL) ; j++) - c += a; -} -END_TEST() diff --git a/test/mppa/general/framework.h b/test/mppa/general/framework.h deleted file mode 100644 index 78f2617e..00000000 --- a/test/mppa/general/framework.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __FRAMEWORK_H__ -#define __FRAMEWORK_H__ - -#include "../lib/prng.c" - -#define BEGIN_TEST(type)\ - int main(void){\ - type a, b, c, i, S;\ - srand(0);\ - S = 0;\ - for (i = 0 ; i < 100 ; i++){\ - c = randlong();\ - a = randlong();\ - b = randlong(); - /* END BEGIN_TEST */ - -/* In between BEGIN_TEST and END_TEST : definition of c */ - -#define END_TEST()\ - S += c;\ - }\ - return S;\ - } - /* END END_TEST */ - -#endif diff --git a/test/mppa/general/lbs.c b/test/mppa/general/lbs.c deleted file mode 100644 index f104d62b..00000000 --- a/test/mppa/general/lbs.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - char s[] = "Tome and Cherry at the playa\n"; - - c = s[(a & (sizeof(s)-1))]; -} -END_TEST() diff --git a/test/mppa/general/lbz.c b/test/mppa/general/lbz.c deleted file mode 100644 index 2deeaebe..00000000 --- a/test/mppa/general/lbz.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - unsigned char s[] = "Tim is sorry at the playa\n"; - - c = s[a & (sizeof(s) - 1)]; -} -END_TEST() diff --git a/test/mppa/general/muld.c b/test/mppa/general/muld.c deleted file mode 100644 index 9a40f389..00000000 --- a/test/mppa/general/muld.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a*b; -} -END_TEST() diff --git a/test/mppa/general/mulw.c b/test/mppa/general/mulw.c deleted file mode 100644 index bf517ce8..00000000 --- a/test/mppa/general/mulw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = a * b; -} -END_TEST() diff --git a/test/mppa/general/negd.c b/test/mppa/general/negd.c deleted file mode 100644 index a8e8ff45..00000000 --- a/test/mppa/general/negd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = -a; -} -END_TEST() diff --git a/test/mppa/general/ord.c b/test/mppa/general/ord.c deleted file mode 100644 index eaedcb28..00000000 --- a/test/mppa/general/ord.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a | b; -} -END_TEST() diff --git a/test/mppa/general/sbfd.c b/test/mppa/general/sbfd.c deleted file mode 100644 index 912f1fdb..00000000 --- a/test/mppa/general/sbfd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a-b; -} -END_TEST() diff --git a/test/mppa/general/sbfw.c b/test/mppa/general/sbfw.c deleted file mode 100644 index feffd497..00000000 --- a/test/mppa/general/sbfw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = a-b; -} -END_TEST() diff --git a/test/mppa/general/simple.c b/test/mppa/general/simple.c deleted file mode 100644 index 89bba27e..00000000 --- a/test/mppa/general/simple.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = a+b; -} -END_TEST() diff --git a/test/mppa/general/sllw.c b/test/mppa/general/sllw.c deleted file mode 100644 index df55c9e8..00000000 --- a/test/mppa/general/sllw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = a << (b & 0x8); -} -END_TEST() diff --git a/test/mppa/general/srad.c b/test/mppa/general/srad.c deleted file mode 100644 index b4047bc7..00000000 --- a/test/mppa/general/srad.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a >> (b & 0x8LL); -} -END_TEST() diff --git a/test/mppa/general/srld.c b/test/mppa/general/srld.c deleted file mode 100644 index 71e82b2a..00000000 --- a/test/mppa/general/srld.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = a >> (b & 0x8ULL); -} -END_TEST() diff --git a/test/mppa/general/stsud.c b/test/mppa/general/stsud.c deleted file mode 100644 index 81fb6e6d..00000000 --- a/test/mppa/general/stsud.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = __builtin_k1_stsud(a, b); -} -END_TEST() diff --git a/test/mppa/general/udivd.c b/test/mppa/general/udivd.c deleted file mode 100644 index 52e0d412..00000000 --- a/test/mppa/general/udivd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = a/b; -} -END_TEST() diff --git a/test/mppa/general/umodd.c b/test/mppa/general/umodd.c deleted file mode 100644 index e7dd506f..00000000 --- a/test/mppa/general/umodd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = a%b; -} -END_TEST() diff --git a/test/mppa/general/xord.c b/test/mppa/general/xord.c deleted file mode 100644 index b9d86f06..00000000 --- a/test/mppa/general/xord.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a^b; -} -END_TEST() diff --git a/test/mppa/generate.sh b/test/mppa/generate.sh deleted file mode 100644 index a883b8f5..00000000 --- a/test/mppa/generate.sh +++ /dev/null @@ -1,17 +0,0 @@ -# $1: c file to examine -# $2: write file - -cfile="$1" -writefile="$2" - -if [ ! -f $cfile ]; then - >&2 echo "ERROR: $cfile not found" - shift; continue -fi - -mkdir -p $(dirname $writefile) - -#sed -n "s/^.*\/\*\s*RETURN VALUE:\s*\([0-9]*\)\s*\*\//\1/p" $1 > $2 -tmpbin=/tmp/k1-$(basename $1)-bin -k1-mbr-gcc -O0 $1 -o $tmpbin -(k1-cluster -- $tmpbin; echo $? > $2) diff --git a/test/mppa/instr/.gitignore b/test/mppa/instr/.gitignore new file mode 100644 index 00000000..ea1472ec --- /dev/null +++ b/test/mppa/instr/.gitignore @@ -0,0 +1 @@ +output/ diff --git a/test/mppa/instr/addw.c b/test/mppa/instr/addw.c new file mode 100644 index 00000000..be8afc67 --- /dev/null +++ b/test/mppa/instr/addw.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(int) + c = a+b; +END_TEST() diff --git a/test/mppa/instr/andd.c b/test/mppa/instr/andd.c new file mode 100644 index 00000000..4f503764 --- /dev/null +++ b/test/mppa/instr/andd.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(long long) + return a&b; +END_TEST() diff --git a/test/mppa/instr/andw.c b/test/mppa/instr/andw.c new file mode 100644 index 00000000..99de0049 --- /dev/null +++ b/test/mppa/instr/andw.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(int) + c = a&b; +END_TEST() diff --git a/test/mppa/instr/branch.c b/test/mppa/instr/branch.c new file mode 100644 index 00000000..72e7e20e --- /dev/null +++ b/test/mppa/instr/branch.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if ((a & 0x1) == 1) + c = 0; + else + c = 1; +} +END_TEST() diff --git a/test/mppa/instr/branchz.c b/test/mppa/instr/branchz.c new file mode 100644 index 00000000..fb86d357 --- /dev/null +++ b/test/mppa/instr/branchz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if (a & 0x1 == 0) + c = 0; + else + c = 1; +} +END_TEST() diff --git a/test/mppa/instr/branchzu.c b/test/mppa/instr/branchzu.c new file mode 100644 index 00000000..97adb605 --- /dev/null +++ b/test/mppa/instr/branchzu.c @@ -0,0 +1,11 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + b = !(a & 0x01); + if (!b) + c = 0; + else + c = 1; +} +END_TEST() diff --git a/test/mppa/instr/call.c b/test/mppa/instr/call.c new file mode 100644 index 00000000..727cef63 --- /dev/null +++ b/test/mppa/instr/call.c @@ -0,0 +1,16 @@ +#include "framework.h" + +int sum(int a, int b){ + return a+b; +} + +int make(int a){ + return a; +} + +BEGIN_TEST(int) +{ + c = sum(make(a), make(b)); +} +END_TEST() +/* RETURN VALUE: 60 */ diff --git a/test/mppa/instr/cb.deqz.c b/test/mppa/instr/cb.deqz.c new file mode 100644 index 00000000..c56733f0 --- /dev/null +++ b/test/mppa/instr/cb.deqz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (0 != (a & 0x1LL)) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.dgez.c b/test/mppa/instr/cb.dgez.c new file mode 100644 index 00000000..abb6ec57 --- /dev/null +++ b/test/mppa/instr/cb.dgez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (0 > (a & 0x1LL)) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.dgtz.c b/test/mppa/instr/cb.dgtz.c new file mode 100644 index 00000000..d4271845 --- /dev/null +++ b/test/mppa/instr/cb.dgtz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (0 >= (a & 0x1LL) - 1) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.dlez.c b/test/mppa/instr/cb.dlez.c new file mode 100644 index 00000000..18e67f06 --- /dev/null +++ b/test/mppa/instr/cb.dlez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (a & 0x1LL > 0) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.dltz.c b/test/mppa/instr/cb.dltz.c new file mode 100644 index 00000000..366aea49 --- /dev/null +++ b/test/mppa/instr/cb.dltz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if ((a & 0x1LL) - 1 >= 0) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.dnez.c b/test/mppa/instr/cb.dnez.c new file mode 100644 index 00000000..81c2cd29 --- /dev/null +++ b/test/mppa/instr/cb.dnez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (0 == (a & 0x1LL)) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.wgez.c b/test/mppa/instr/cb.wgez.c new file mode 100644 index 00000000..477f4bc6 --- /dev/null +++ b/test/mppa/instr/cb.wgez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if (0 > (a & 0x1) - 1) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.wgtz.c b/test/mppa/instr/cb.wgtz.c new file mode 100644 index 00000000..c9ab9a06 --- /dev/null +++ b/test/mppa/instr/cb.wgtz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if (0 >= (a & 0x1)) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.wlez.c b/test/mppa/instr/cb.wlez.c new file mode 100644 index 00000000..c3069fda --- /dev/null +++ b/test/mppa/instr/cb.wlez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if ((a & 0x1) > 0) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/cb.wltz.c b/test/mppa/instr/cb.wltz.c new file mode 100644 index 00000000..6cf5fcf0 --- /dev/null +++ b/test/mppa/instr/cb.wltz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if ((a & 0x1) - 1 >= 0) + c = 1; + else + c = 0; +} +END_TEST() diff --git a/test/mppa/instr/compd.eq.c b/test/mppa/instr/compd.eq.c new file mode 100644 index 00000000..d19a4d20 --- /dev/null +++ b/test/mppa/instr/compd.eq.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = ((a & 0x1LL) == (b & 0x1LL)); +} +END_TEST() diff --git a/test/mppa/instr/compd.geu.c b/test/mppa/instr/compd.geu.c new file mode 100644 index 00000000..edc31183 --- /dev/null +++ b/test/mppa/instr/compd.geu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = (a >= b); +} +END_TEST() diff --git a/test/mppa/instr/compd.gt.c b/test/mppa/instr/compd.gt.c new file mode 100644 index 00000000..24147779 --- /dev/null +++ b/test/mppa/instr/compd.gt.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = (a > b); +} +END_TEST() diff --git a/test/mppa/instr/compd.gtu.c b/test/mppa/instr/compd.gtu.c new file mode 100644 index 00000000..5ce82569 --- /dev/null +++ b/test/mppa/instr/compd.gtu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = (a > b); +} +END_TEST() diff --git a/test/mppa/instr/compd.le.c b/test/mppa/instr/compd.le.c new file mode 100644 index 00000000..a84aad97 --- /dev/null +++ b/test/mppa/instr/compd.le.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = (a <= b); +} +END_TEST() diff --git a/test/mppa/instr/compd.leu.c b/test/mppa/instr/compd.leu.c new file mode 100644 index 00000000..e386bc27 --- /dev/null +++ b/test/mppa/instr/compd.leu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = (a <= b); +} +END_TEST() diff --git a/test/mppa/instr/compd.lt.c b/test/mppa/instr/compd.lt.c new file mode 100644 index 00000000..df07a708 --- /dev/null +++ b/test/mppa/instr/compd.lt.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = (a < b); +} +END_TEST() diff --git a/test/mppa/instr/compd.ltu.c b/test/mppa/instr/compd.ltu.c new file mode 100644 index 00000000..dfaa8921 --- /dev/null +++ b/test/mppa/instr/compd.ltu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = (a < b); +} +END_TEST() diff --git a/test/mppa/instr/compd.ne.c b/test/mppa/instr/compd.ne.c new file mode 100644 index 00000000..19ce0a69 --- /dev/null +++ b/test/mppa/instr/compd.ne.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = ((a & 0x1ULL) != (b & 0x1ULL)); +} +END_TEST() diff --git a/test/mppa/instr/compw.eq.c b/test/mppa/instr/compw.eq.c new file mode 100644 index 00000000..dc7a3ab1 --- /dev/null +++ b/test/mppa/instr/compw.eq.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = ((a & 0x1) == (b & 0x1)); +} +END_TEST() diff --git a/test/mppa/instr/compw.geu.c b/test/mppa/instr/compw.geu.c new file mode 100644 index 00000000..d72ca56c --- /dev/null +++ b/test/mppa/instr/compw.geu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (a >= b); +} +END_TEST() diff --git a/test/mppa/instr/compw.gt.c b/test/mppa/instr/compw.gt.c new file mode 100644 index 00000000..9ad02610 --- /dev/null +++ b/test/mppa/instr/compw.gt.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (a > b); +} +END_TEST() diff --git a/test/mppa/instr/compw.gtu.c b/test/mppa/instr/compw.gtu.c new file mode 100644 index 00000000..77f04989 --- /dev/null +++ b/test/mppa/instr/compw.gtu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (a > b); +} +END_TEST() diff --git a/test/mppa/instr/compw.le.c b/test/mppa/instr/compw.le.c new file mode 100644 index 00000000..b7a7a432 --- /dev/null +++ b/test/mppa/instr/compw.le.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (a <= b); +} +END_TEST() diff --git a/test/mppa/instr/compw.leu.c b/test/mppa/instr/compw.leu.c new file mode 100644 index 00000000..4892f06c --- /dev/null +++ b/test/mppa/instr/compw.leu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (a <= b); +} +END_TEST() diff --git a/test/mppa/instr/compw.lt.c b/test/mppa/instr/compw.lt.c new file mode 100644 index 00000000..2cc151bf --- /dev/null +++ b/test/mppa/instr/compw.lt.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (a < b); +} +END_TEST() diff --git a/test/mppa/instr/compw.ltu.c b/test/mppa/instr/compw.ltu.c new file mode 100644 index 00000000..b524127f --- /dev/null +++ b/test/mppa/instr/compw.ltu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (a < b); +} +END_TEST() diff --git a/test/mppa/instr/compw.ne.c b/test/mppa/instr/compw.ne.c new file mode 100644 index 00000000..433b0b86 --- /dev/null +++ b/test/mppa/instr/compw.ne.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = ((a & 0x1U) != (b & 0x1U)); +} +END_TEST() diff --git a/test/mppa/instr/div2.c b/test/mppa/instr/div2.c new file mode 100644 index 00000000..01a4b575 --- /dev/null +++ b/test/mppa/instr/div2.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (a + b) / 2; +} +END_TEST() diff --git a/test/mppa/instr/for.c b/test/mppa/instr/for.c new file mode 100644 index 00000000..d6870afb --- /dev/null +++ b/test/mppa/instr/for.c @@ -0,0 +1,9 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + int j; + for (j = 0 ; j < 10 ; j++) + c += a; +} +END_TEST() diff --git a/test/mppa/instr/forvar.c b/test/mppa/instr/forvar.c new file mode 100644 index 00000000..57548274 --- /dev/null +++ b/test/mppa/instr/forvar.c @@ -0,0 +1,9 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + int j; + for (j = 0 ; j < (b & 0x8) ; j++) + c += a; +} +END_TEST() diff --git a/test/mppa/instr/forvarl.c b/test/mppa/instr/forvarl.c new file mode 100644 index 00000000..30717a51 --- /dev/null +++ b/test/mppa/instr/forvarl.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long int) +{ + int j; + + for (j = 0 ; j < (b & 0x8LL) ; j++) + c += a; +} +END_TEST() diff --git a/test/mppa/instr/framework.h b/test/mppa/instr/framework.h new file mode 100644 index 00000000..f6077c46 --- /dev/null +++ b/test/mppa/instr/framework.h @@ -0,0 +1,26 @@ +#ifndef __FRAMEWORK_H__ +#define __FRAMEWORK_H__ + +#include "../prng/prng.c" + +#define BEGIN_TEST(type)\ + int main(void){\ + type a, b, c, i, S;\ + srand(0);\ + S = 0;\ + for (i = 0 ; i < 100 ; i++){\ + c = randlong();\ + a = randlong();\ + b = randlong(); + /* END BEGIN_TEST */ + +/* In between BEGIN_TEST and END_TEST : definition of c */ + +#define END_TEST()\ + S += c;\ + }\ + return S;\ + } + /* END END_TEST */ + +#endif diff --git a/test/mppa/instr/lbs.c b/test/mppa/instr/lbs.c new file mode 100644 index 00000000..f104d62b --- /dev/null +++ b/test/mppa/instr/lbs.c @@ -0,0 +1,9 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + char s[] = "Tome and Cherry at the playa\n"; + + c = s[(a & (sizeof(s)-1))]; +} +END_TEST() diff --git a/test/mppa/instr/lbz.c b/test/mppa/instr/lbz.c new file mode 100644 index 00000000..2deeaebe --- /dev/null +++ b/test/mppa/instr/lbz.c @@ -0,0 +1,9 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + unsigned char s[] = "Tim is sorry at the playa\n"; + + c = s[a & (sizeof(s) - 1)]; +} +END_TEST() diff --git a/test/mppa/instr/muld.c b/test/mppa/instr/muld.c new file mode 100644 index 00000000..9a40f389 --- /dev/null +++ b/test/mppa/instr/muld.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a*b; +} +END_TEST() diff --git a/test/mppa/instr/mulw.c b/test/mppa/instr/mulw.c new file mode 100644 index 00000000..bf517ce8 --- /dev/null +++ b/test/mppa/instr/mulw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = a * b; +} +END_TEST() diff --git a/test/mppa/instr/negd.c b/test/mppa/instr/negd.c new file mode 100644 index 00000000..a8e8ff45 --- /dev/null +++ b/test/mppa/instr/negd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = -a; +} +END_TEST() diff --git a/test/mppa/instr/ord.c b/test/mppa/instr/ord.c new file mode 100644 index 00000000..eaedcb28 --- /dev/null +++ b/test/mppa/instr/ord.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a | b; +} +END_TEST() diff --git a/test/mppa/instr/sbfd.c b/test/mppa/instr/sbfd.c new file mode 100644 index 00000000..912f1fdb --- /dev/null +++ b/test/mppa/instr/sbfd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a-b; +} +END_TEST() diff --git a/test/mppa/instr/sbfw.c b/test/mppa/instr/sbfw.c new file mode 100644 index 00000000..feffd497 --- /dev/null +++ b/test/mppa/instr/sbfw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = a-b; +} +END_TEST() diff --git a/test/mppa/instr/simple.c b/test/mppa/instr/simple.c new file mode 100644 index 00000000..89bba27e --- /dev/null +++ b/test/mppa/instr/simple.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = a+b; +} +END_TEST() diff --git a/test/mppa/instr/sllw.c b/test/mppa/instr/sllw.c new file mode 100644 index 00000000..df55c9e8 --- /dev/null +++ b/test/mppa/instr/sllw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = a << (b & 0x8); +} +END_TEST() diff --git a/test/mppa/instr/srad.c b/test/mppa/instr/srad.c new file mode 100644 index 00000000..b4047bc7 --- /dev/null +++ b/test/mppa/instr/srad.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a >> (b & 0x8LL); +} +END_TEST() diff --git a/test/mppa/instr/srld.c b/test/mppa/instr/srld.c new file mode 100644 index 00000000..71e82b2a --- /dev/null +++ b/test/mppa/instr/srld.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = a >> (b & 0x8ULL); +} +END_TEST() diff --git a/test/mppa/instr/udivd.c b/test/mppa/instr/udivd.c new file mode 100644 index 00000000..52e0d412 --- /dev/null +++ b/test/mppa/instr/udivd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = a/b; +} +END_TEST() diff --git a/test/mppa/instr/umodd.c b/test/mppa/instr/umodd.c new file mode 100644 index 00000000..e7dd506f --- /dev/null +++ b/test/mppa/instr/umodd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = a%b; +} +END_TEST() diff --git a/test/mppa/instr/xord.c b/test/mppa/instr/xord.c new file mode 100644 index 00000000..b9d86f06 --- /dev/null +++ b/test/mppa/instr/xord.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a^b; +} +END_TEST() -- cgit