From f677664f63ca17c0a514c449f62ad958b5f9eb68 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 15 Mar 2018 12:05:57 +0100 Subject: MPPA - The project compiles. Supports very simple programs that load integer immediates. It starts the main, loads integer in registers, and return correctly. Addition in Mach not yet supported, but should not be hard to add them. Function calls are not yet supported. The ABI for now is the same as the RiscV, with a small twist: $ra is first loaded in a user register, then this user register is pushed (instead of pushing $ra straight away). --- test/mppa/Makefile | 26 ++++++++++++++++++++++++++ test/mppa/simple.c | 6 ++++++ 2 files changed, 32 insertions(+) create mode 100644 test/mppa/Makefile create mode 100644 test/mppa/simple.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile new file mode 100644 index 00000000..6481af5e --- /dev/null +++ b/test/mppa/Makefile @@ -0,0 +1,26 @@ +ELF=simple.bin +DEBUG:=$(if $(DEBUG),"-dall",) + +all: $(ELF) + +%.bin: %.s + k1-gcc $< -o $@ + +.SECONDARY: +%.s: %.c + ccomp $(DEBUG) -v -S $< -o $@ + +.PHONY: +clean: + rm -f *.alloctrace + rm -f *.cm + rm -f *.compcert.c + rm -f *.i + rm -f *.light.c + rm -f *.ltl + rm -f *.mach + rm -f *.parsed.c + rm -f *.rtl.? + rm -f *.s + rm -rf profile/ + rm -f $(ELF) diff --git a/test/mppa/simple.c b/test/mppa/simple.c new file mode 100644 index 00000000..5a54b3d8 --- /dev/null +++ b/test/mppa/simple.c @@ -0,0 +1,6 @@ +int main(void){ + int a = 4; + int b = 3; + + return (a+b); +} -- cgit From 348aa9268bb3f7f2fe4357586a4e1d3181e0c9b3 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 16 Mar 2018 15:06:28 +0100 Subject: MPPA - code cleaning --- test/mppa/simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/mppa') diff --git a/test/mppa/simple.c b/test/mppa/simple.c index 5a54b3d8..725aff68 100644 --- a/test/mppa/simple.c +++ b/test/mppa/simple.c @@ -1,6 +1,6 @@ int main(void){ int a = 4; int b = 3; - + return (a+b); } -- cgit From 447ceed8642e2ed000a20036298adb8448ac594b Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 21 Mar 2018 17:46:45 +0100 Subject: MPPA - Added Msetstack + bunch of store --> on a des call ! --- test/mppa/Makefile | 2 +- test/mppa/call.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/mppa/call.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 6481af5e..9078bdb9 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,4 +1,4 @@ -ELF=simple.bin +ELF=simple.bin call.bin DEBUG:=$(if $(DEBUG),"-dall",) all: $(ELF) diff --git a/test/mppa/call.c b/test/mppa/call.c new file mode 100644 index 00000000..3f58b756 --- /dev/null +++ b/test/mppa/call.c @@ -0,0 +1,16 @@ +int sum(int a, int b){ + return a + b; +} + +int make_42(void){ + return 42; +} + +int make_18(void){ + return 18; +} + +int main(void){ + return sum(make_42(), make_18()); + //return make_42() + make_18(); +} -- cgit From 69813ed0107cd76caa322db5e1df1b7b969b7012 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 3 Apr 2018 17:07:09 +0200 Subject: MPPA - 32-bits immediate eq/neq branches --- test/mppa/Makefile | 4 ++-- test/mppa/branch.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 test/mppa/branch.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 9078bdb9..e73dcb38 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,4 +1,4 @@ -ELF=simple.bin call.bin +ELF=simple.bin call.bin branch.bin DEBUG:=$(if $(DEBUG),"-dall",) all: $(ELF) @@ -8,7 +8,7 @@ all: $(ELF) .SECONDARY: %.s: %.c - ccomp $(DEBUG) -v -S $< -o $@ + ccomp $(DEBUG) -O0 -v -S $< -o $@ .PHONY: clean: diff --git a/test/mppa/branch.c b/test/mppa/branch.c new file mode 100644 index 00000000..dee15568 --- /dev/null +++ b/test/mppa/branch.c @@ -0,0 +1,12 @@ +int main(void){ + int a=1; + int b; + + if(a){ + b = a+4; + } else { + b = a+2; + } + + return b; +} -- cgit From 36076263491312d634bd0d39f8de718f32462da2 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 4 Apr 2018 11:40:16 +0200 Subject: MPPA - Added signed immediate comparison --- test/mppa/Makefile | 5 ++++- test/mppa/for.c | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/mppa/for.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index e73dcb38..b1f25ef1 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,8 +1,11 @@ -ELF=simple.bin call.bin branch.bin +ELF=simple.bin call.bin branch.bin for.bin +ASM=$(subst .bin,.s,$(ELF)) DEBUG:=$(if $(DEBUG),"-dall",) all: $(ELF) +nobin: $(ASM) + %.bin: %.s k1-gcc $< -o $@ diff --git a/test/mppa/for.c b/test/mppa/for.c new file mode 100644 index 00000000..6a3a6cc8 --- /dev/null +++ b/test/mppa/for.c @@ -0,0 +1,9 @@ +int main(void){ + int a = 4; + int i; + + for (i = 0 ; i < 12 ; i++) + a++; + + return a; +} -- cgit From ca090744f399788a81f103206947d4d56cba9d87 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 4 Apr 2018 13:58:10 +0200 Subject: MPPA - Added non immediate comparison --- test/mppa/Makefile | 6 ++++-- test/mppa/forvar.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 test/mppa/forvar.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index b1f25ef1..be8eaab2 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,5 +1,7 @@ -ELF=simple.bin call.bin branch.bin for.bin -ASM=$(subst .bin,.s,$(ELF)) +TESTS=simple call branch for forvar + +ELF=$(addsuffix .bin,$(TESTS)) +ASM=$(addsuffix .s,$(TESTS)) DEBUG:=$(if $(DEBUG),"-dall",) all: $(ELF) diff --git a/test/mppa/forvar.c b/test/mppa/forvar.c new file mode 100644 index 00000000..1a075734 --- /dev/null +++ b/test/mppa/forvar.c @@ -0,0 +1,10 @@ +int main(void){ + int i; + int a = 4; + int b = 12; + + for (i = 0 ; i < b ; i++) + a++; + + return a; +} -- cgit From 17c38f7c4a01cbe5cf20a4f8d5f5d8c0ca888855 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 4 Apr 2018 16:21:02 +0200 Subject: MPPA - added test forvarl.c --- test/mppa/Makefile | 2 +- test/mppa/forvarl.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/mppa/forvarl.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index be8eaab2..07224dc8 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,4 +1,4 @@ -TESTS=simple call branch for forvar +TESTS=simple call branch for forvar forvarl ELF=$(addsuffix .bin,$(TESTS)) ASM=$(addsuffix .s,$(TESTS)) diff --git a/test/mppa/forvarl.c b/test/mppa/forvarl.c new file mode 100644 index 00000000..90de7411 --- /dev/null +++ b/test/mppa/forvarl.c @@ -0,0 +1,11 @@ +int main(void) +{ + long long int a = 42; + long long int b = 84; + long long int i; + + for (i = 0 ; i < a ; i++) + b++; + + return 0; +} -- cgit From ebf476c1c9bebaf9b108302ed4c1a5a8da0243a3 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 5 Apr 2018 11:53:42 +0200 Subject: MPPA - Added regression tests --- test/mppa/Makefile | 35 +++++++++++++++++++------------- test/mppa/branch.c | 12 ----------- test/mppa/call.c | 16 --------------- test/mppa/for.c | 9 -------- test/mppa/forvar.c | 10 --------- test/mppa/forvarl.c | 11 ---------- test/mppa/general/branch.c | 12 +++++++++++ test/mppa/general/call.c | 16 +++++++++++++++ test/mppa/general/for.c | 9 ++++++++ test/mppa/general/forvar.c | 10 +++++++++ test/mppa/general/forvarl.c | 11 ++++++++++ test/mppa/general/output/branch.bin.exp | 1 + test/mppa/general/output/call.bin.exp | 1 + test/mppa/general/output/for.bin.exp | 1 + test/mppa/general/output/forvar.bin.exp | 1 + test/mppa/general/output/forvarl.bin.exp | 1 + test/mppa/general/output/simple.bin.exp | 1 + test/mppa/general/simple.c | 6 ++++++ test/mppa/simple.c | 6 ------ 19 files changed, 91 insertions(+), 78 deletions(-) delete mode 100644 test/mppa/branch.c delete mode 100644 test/mppa/call.c delete mode 100644 test/mppa/for.c delete mode 100644 test/mppa/forvar.c delete mode 100644 test/mppa/forvarl.c create mode 100644 test/mppa/general/branch.c create mode 100644 test/mppa/general/call.c create mode 100644 test/mppa/general/for.c create mode 100644 test/mppa/general/forvar.c create mode 100644 test/mppa/general/forvarl.c create mode 100644 test/mppa/general/output/branch.bin.exp create mode 100644 test/mppa/general/output/call.bin.exp create mode 100644 test/mppa/general/output/for.bin.exp create mode 100644 test/mppa/general/output/forvar.bin.exp create mode 100644 test/mppa/general/output/forvarl.bin.exp create mode 100644 test/mppa/general/output/simple.bin.exp create mode 100644 test/mppa/general/simple.c delete mode 100644 test/mppa/simple.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 07224dc8..60433f03 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,5 +1,7 @@ -TESTS=simple call branch for forvar forvarl +DIR=general +TESTNAMES=simple call branch for forvar forvarl +TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) ELF=$(addsuffix .bin,$(TESTS)) ASM=$(addsuffix .s,$(TESTS)) DEBUG:=$(if $(DEBUG),"-dall",) @@ -8,24 +10,29 @@ all: $(ELF) nobin: $(ASM) -%.bin: %.s +$(DIR)/%.bin: $(DIR)/%.s k1-gcc $< -o $@ .SECONDARY: -%.s: %.c +$(DIR)/%.s: $(DIR)/%.c ccomp $(DEBUG) -O0 -v -S $< -o $@ +.PHONY: +check: $(ELF) + bash check.sh $(ELF) + .PHONY: clean: - rm -f *.alloctrace - rm -f *.cm - rm -f *.compcert.c - rm -f *.i - rm -f *.light.c - rm -f *.ltl - rm -f *.mach - rm -f *.parsed.c - rm -f *.rtl.? - rm -f *.s - rm -rf profile/ + 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)/*.s + rm -f $(DIR)/output/*.out + rm -rf $(DIR)/profile/ rm -f $(ELF) diff --git a/test/mppa/branch.c b/test/mppa/branch.c deleted file mode 100644 index dee15568..00000000 --- a/test/mppa/branch.c +++ /dev/null @@ -1,12 +0,0 @@ -int main(void){ - int a=1; - int b; - - if(a){ - b = a+4; - } else { - b = a+2; - } - - return b; -} diff --git a/test/mppa/call.c b/test/mppa/call.c deleted file mode 100644 index 3f58b756..00000000 --- a/test/mppa/call.c +++ /dev/null @@ -1,16 +0,0 @@ -int sum(int a, int b){ - return a + b; -} - -int make_42(void){ - return 42; -} - -int make_18(void){ - return 18; -} - -int main(void){ - return sum(make_42(), make_18()); - //return make_42() + make_18(); -} diff --git a/test/mppa/for.c b/test/mppa/for.c deleted file mode 100644 index 6a3a6cc8..00000000 --- a/test/mppa/for.c +++ /dev/null @@ -1,9 +0,0 @@ -int main(void){ - int a = 4; - int i; - - for (i = 0 ; i < 12 ; i++) - a++; - - return a; -} diff --git a/test/mppa/forvar.c b/test/mppa/forvar.c deleted file mode 100644 index 1a075734..00000000 --- a/test/mppa/forvar.c +++ /dev/null @@ -1,10 +0,0 @@ -int main(void){ - int i; - int a = 4; - int b = 12; - - for (i = 0 ; i < b ; i++) - a++; - - return a; -} diff --git a/test/mppa/forvarl.c b/test/mppa/forvarl.c deleted file mode 100644 index 90de7411..00000000 --- a/test/mppa/forvarl.c +++ /dev/null @@ -1,11 +0,0 @@ -int main(void) -{ - long long int a = 42; - long long int b = 84; - long long int i; - - for (i = 0 ; i < a ; i++) - b++; - - return 0; -} diff --git a/test/mppa/general/branch.c b/test/mppa/general/branch.c new file mode 100644 index 00000000..dee15568 --- /dev/null +++ b/test/mppa/general/branch.c @@ -0,0 +1,12 @@ +int main(void){ + int a=1; + int b; + + if(a){ + b = a+4; + } else { + b = a+2; + } + + return b; +} diff --git a/test/mppa/general/call.c b/test/mppa/general/call.c new file mode 100644 index 00000000..3f58b756 --- /dev/null +++ b/test/mppa/general/call.c @@ -0,0 +1,16 @@ +int sum(int a, int b){ + return a + b; +} + +int make_42(void){ + return 42; +} + +int make_18(void){ + return 18; +} + +int main(void){ + return sum(make_42(), make_18()); + //return make_42() + make_18(); +} diff --git a/test/mppa/general/for.c b/test/mppa/general/for.c new file mode 100644 index 00000000..6a3a6cc8 --- /dev/null +++ b/test/mppa/general/for.c @@ -0,0 +1,9 @@ +int main(void){ + int a = 4; + int i; + + for (i = 0 ; i < 12 ; i++) + a++; + + return a; +} diff --git a/test/mppa/general/forvar.c b/test/mppa/general/forvar.c new file mode 100644 index 00000000..1a075734 --- /dev/null +++ b/test/mppa/general/forvar.c @@ -0,0 +1,10 @@ +int main(void){ + int i; + int a = 4; + int b = 12; + + for (i = 0 ; i < b ; i++) + a++; + + return a; +} diff --git a/test/mppa/general/forvarl.c b/test/mppa/general/forvarl.c new file mode 100644 index 00000000..90de7411 --- /dev/null +++ b/test/mppa/general/forvarl.c @@ -0,0 +1,11 @@ +int main(void) +{ + long long int a = 42; + long long int b = 84; + long long int i; + + for (i = 0 ; i < a ; i++) + b++; + + return 0; +} diff --git a/test/mppa/general/output/branch.bin.exp b/test/mppa/general/output/branch.bin.exp new file mode 100644 index 00000000..7ed6ff82 --- /dev/null +++ b/test/mppa/general/output/branch.bin.exp @@ -0,0 +1 @@ +5 diff --git a/test/mppa/general/output/call.bin.exp b/test/mppa/general/output/call.bin.exp new file mode 100644 index 00000000..abdfb053 --- /dev/null +++ b/test/mppa/general/output/call.bin.exp @@ -0,0 +1 @@ +60 diff --git a/test/mppa/general/output/for.bin.exp b/test/mppa/general/output/for.bin.exp new file mode 100644 index 00000000..b6a7d89c --- /dev/null +++ b/test/mppa/general/output/for.bin.exp @@ -0,0 +1 @@ +16 diff --git a/test/mppa/general/output/forvar.bin.exp b/test/mppa/general/output/forvar.bin.exp new file mode 100644 index 00000000..b6a7d89c --- /dev/null +++ b/test/mppa/general/output/forvar.bin.exp @@ -0,0 +1 @@ +16 diff --git a/test/mppa/general/output/forvarl.bin.exp b/test/mppa/general/output/forvarl.bin.exp new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/mppa/general/output/forvarl.bin.exp @@ -0,0 +1 @@ +0 diff --git a/test/mppa/general/output/simple.bin.exp b/test/mppa/general/output/simple.bin.exp new file mode 100644 index 00000000..7f8f011e --- /dev/null +++ b/test/mppa/general/output/simple.bin.exp @@ -0,0 +1 @@ +7 diff --git a/test/mppa/general/simple.c b/test/mppa/general/simple.c new file mode 100644 index 00000000..725aff68 --- /dev/null +++ b/test/mppa/general/simple.c @@ -0,0 +1,6 @@ +int main(void){ + int a = 4; + int b = 3; + + return (a+b); +} diff --git a/test/mppa/simple.c b/test/mppa/simple.c deleted file mode 100644 index 725aff68..00000000 --- a/test/mppa/simple.c +++ /dev/null @@ -1,6 +0,0 @@ -int main(void){ - int a = 4; - int b = 3; - - return (a+b); -} -- cgit From a724c959659d94425b8dd4a0dc2e343ecdba3edc Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 5 Apr 2018 11:54:13 +0200 Subject: MPPA - forgot check.sh in last commit --- test/mppa/check.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/mppa/check.sh (limited to 'test/mppa') diff --git a/test/mppa/check.sh b/test/mppa/check.sh new file mode 100644 index 00000000..813796d9 --- /dev/null +++ b/test/mppa/check.sh @@ -0,0 +1,29 @@ + +while [ $# -gt 0 ]; do + elffile="$1" + + 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" + shift; continue + fi + + k1-cluster -- $elffile > $out + echo $? >> $out + + if ! diff $exp $out; then + >&2 echo "ERROR: $exp and $out differ" + shift; continue + fi + + echo "PASSED: $elf" + shift +done -- cgit From e20c07dddf528ce50951a59cb92f98b4bca8da77 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Mon, 9 Apr 2018 13:55:44 +0200 Subject: MPPA - Optimized branch generation for word compare to 0 --- test/mppa/Makefile | 2 +- test/mppa/general/branchz.c | 12 ++++++++++++ test/mppa/general/branchzu.c | 12 ++++++++++++ test/mppa/general/output/branchz.exp | 1 + test/mppa/general/output/branchzu.exp | 1 + 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 test/mppa/general/branchz.c create mode 100644 test/mppa/general/branchzu.c create mode 100644 test/mppa/general/output/branchz.exp create mode 100644 test/mppa/general/output/branchzu.exp (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 60433f03..36bd49bc 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,5 +1,5 @@ DIR=general -TESTNAMES=simple call branch for forvar forvarl +TESTNAMES=simple call branch for forvar forvarl branchz branchzu TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) ELF=$(addsuffix .bin,$(TESTS)) diff --git a/test/mppa/general/branchz.c b/test/mppa/general/branchz.c new file mode 100644 index 00000000..5e3226d5 --- /dev/null +++ b/test/mppa/general/branchz.c @@ -0,0 +1,12 @@ +int main(void){ + int a=1; + int b; + + if(a==0){ + b = a+4; + } else { + b = a+2; + } + + return b; +} diff --git a/test/mppa/general/branchzu.c b/test/mppa/general/branchzu.c new file mode 100644 index 00000000..0ff25763 --- /dev/null +++ b/test/mppa/general/branchzu.c @@ -0,0 +1,12 @@ +int main(void){ + int a=1; + int b; + + if(!a){ + b = a+4; + } else { + b = a+2; + } + + return b; +} diff --git a/test/mppa/general/output/branchz.exp b/test/mppa/general/output/branchz.exp new file mode 100644 index 00000000..00750edc --- /dev/null +++ b/test/mppa/general/output/branchz.exp @@ -0,0 +1 @@ +3 diff --git a/test/mppa/general/output/branchzu.exp b/test/mppa/general/output/branchzu.exp new file mode 100644 index 00000000..00750edc --- /dev/null +++ b/test/mppa/general/output/branchzu.exp @@ -0,0 +1 @@ +3 -- cgit From 38b906f983a685af967b51bae2f8038c47d87b91 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 10 Apr 2018 09:56:52 +0200 Subject: MPPA - fixed wrong extension in test files --- test/mppa/general/output/branchz.bin.exp | 1 + test/mppa/general/output/branchz.exp | 1 - test/mppa/general/output/branchzu.bin.exp | 1 + test/mppa/general/output/branchzu.exp | 1 - 4 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 test/mppa/general/output/branchz.bin.exp delete mode 100644 test/mppa/general/output/branchz.exp create mode 100644 test/mppa/general/output/branchzu.bin.exp delete mode 100644 test/mppa/general/output/branchzu.exp (limited to 'test/mppa') diff --git a/test/mppa/general/output/branchz.bin.exp b/test/mppa/general/output/branchz.bin.exp new file mode 100644 index 00000000..00750edc --- /dev/null +++ b/test/mppa/general/output/branchz.bin.exp @@ -0,0 +1 @@ +3 diff --git a/test/mppa/general/output/branchz.exp b/test/mppa/general/output/branchz.exp deleted file mode 100644 index 00750edc..00000000 --- a/test/mppa/general/output/branchz.exp +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/mppa/general/output/branchzu.bin.exp b/test/mppa/general/output/branchzu.bin.exp new file mode 100644 index 00000000..00750edc --- /dev/null +++ b/test/mppa/general/output/branchzu.bin.exp @@ -0,0 +1 @@ +3 diff --git a/test/mppa/general/output/branchzu.exp b/test/mppa/general/output/branchzu.exp deleted file mode 100644 index 00750edc..00000000 --- a/test/mppa/general/output/branchzu.exp +++ /dev/null @@ -1 +0,0 @@ -3 -- cgit From 5541fb2f156aa314e26cac65546458e47ba03264 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 10 Apr 2018 10:35:09 +0200 Subject: MPPA - Running tests in parallel --- test/mppa/Makefile | 11 +++++++++-- test/mppa/check.sh | 56 +++++++++++++++++++++++++++++++----------------------- 2 files changed, 41 insertions(+), 26 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 36bd49bc..6f7ea55a 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -3,6 +3,7 @@ TESTNAMES=simple call branch for forvar forvarl branchz branchzu TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) ELF=$(addsuffix .bin,$(TESTS)) +TOK=$(addsuffix .tok,$(TESTS)) ASM=$(addsuffix .s,$(TESTS)) DEBUG:=$(if $(DEBUG),"-dall",) @@ -17,9 +18,14 @@ $(DIR)/%.bin: $(DIR)/%.s $(DIR)/%.s: $(DIR)/%.c ccomp $(DEBUG) -O0 -v -S $< -o $@ +$(DIR)/%.tok: $(DIR)/%.bin FORCE + @bash check.sh $< $@ + +.PHONY: FORCE +FORCE: + .PHONY: -check: $(ELF) - bash check.sh $(ELF) +check: $(TOK) .PHONY: clean: @@ -33,6 +39,7 @@ clean: rm -f $(DIR)/*.parsed.c rm -f $(DIR)/*.rtl.? rm -f $(DIR)/*.s + rm -f $(DIR)/*.tok rm -f $(DIR)/output/*.out rm -rf $(DIR)/profile/ rm -f $(ELF) diff --git a/test/mppa/check.sh b/test/mppa/check.sh index 813796d9..8e889175 100644 --- a/test/mppa/check.sh +++ b/test/mppa/check.sh @@ -1,29 +1,37 @@ +# $1: binary file to check +# $2: output check token -while [ $# -gt 0 ]; do - elffile="$1" - - if [ ! -f $elffile ]; then - >&2 echo "ERROR: $elffile not found" - shift; continue - fi +elffile="$1" +token="$2" - 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" - shift; continue - fi +if [ ! -f $elffile ]; then + >&2 echo "ERROR: $elffile not found" + shift; continue +fi - k1-cluster -- $elffile > $out - echo $? >> $out +if [ -f $token ]; then + echo "ALREADY PASSED: $elffile" + exit +fi - if ! diff $exp $out; then - >&2 echo "ERROR: $exp and $out differ" - 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" + shift; continue +fi - echo "PASSED: $elf" - shift -done +k1-cluster -- $elffile > $out +echo $? >> $out + +if ! diff $exp $out; then + >&2 echo "ERROR: $exp and $out differ" + exit + #shift; continue +fi + +echo "PASSED: $elf" +touch $token +#shift -- cgit From 9862e89118492e6ab530b2e2992161dd4eb52d0a Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 10 Apr 2018 13:51:50 +0200 Subject: MPPA - Onegl + Pnegl --- test/mppa/Makefile | 5 +++-- test/mppa/check.sh | 5 ----- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 6f7ea55a..c02f8d94 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,6 +1,7 @@ DIR=general TESTNAMES=simple call branch for forvar forvarl branchz branchzu +CCOMP=../../ccomp TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) ELF=$(addsuffix .bin,$(TESTS)) TOK=$(addsuffix .tok,$(TESTS)) @@ -15,10 +16,10 @@ $(DIR)/%.bin: $(DIR)/%.s k1-gcc $< -o $@ .SECONDARY: -$(DIR)/%.s: $(DIR)/%.c +$(DIR)/%.s: $(DIR)/%.c $(CCOMP) ccomp $(DEBUG) -O0 -v -S $< -o $@ -$(DIR)/%.tok: $(DIR)/%.bin FORCE +$(DIR)/%.tok: $(DIR)/%.bin @bash check.sh $< $@ .PHONY: FORCE diff --git a/test/mppa/check.sh b/test/mppa/check.sh index 8e889175..f38d3f0d 100644 --- a/test/mppa/check.sh +++ b/test/mppa/check.sh @@ -9,11 +9,6 @@ if [ ! -f $elffile ]; then shift; continue fi -if [ -f $token ]; then - echo "ALREADY PASSED: $elffile" - exit -fi - dir="$(dirname $elffile)" elf="$(basename $elffile)" exp="$dir/output/$elf.exp" -- cgit From 5e35117f8dd7cc4c548ecd704e11f3ca8845dedd Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 11 Apr 2018 10:54:56 +0200 Subject: MPPA - reorganized the test directory --- test/mppa/Makefile | 23 ++++++++++++++--------- test/mppa/check.sh | 8 ++++---- 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index c02f8d94..f8b3f68c 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,25 +1,30 @@ DIR=general +BINDIR=bin +ASMDIR=asm TESTNAMES=simple call branch for forvar forvarl branchz branchzu CCOMP=../../ccomp -TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) -ELF=$(addsuffix .bin,$(TESTS)) -TOK=$(addsuffix .tok,$(TESTS)) -ASM=$(addsuffix .s,$(TESTS)) +#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",) all: $(ELF) nobin: $(ASM) -$(DIR)/%.bin: $(DIR)/%.s +$(DIR)/$(BINDIR)/%.bin: $(DIR)/$(ASMDIR)/%.s + @mkdir -p $(@D) k1-gcc $< -o $@ .SECONDARY: -$(DIR)/%.s: $(DIR)/%.c $(CCOMP) +$(DIR)/$(ASMDIR)/%.s: $(DIR)/%.c $(CCOMP) + @mkdir -p $(@D) ccomp $(DEBUG) -O0 -v -S $< -o $@ -$(DIR)/%.tok: $(DIR)/%.bin +$(DIR)/$(BINDIR)/%.tok: $(DIR)/$(BINDIR)/%.bin + @mkdir -p $(@D) @bash check.sh $< $@ .PHONY: FORCE @@ -39,8 +44,8 @@ clean: rm -f $(DIR)/*.mach rm -f $(DIR)/*.parsed.c rm -f $(DIR)/*.rtl.? - rm -f $(DIR)/*.s - rm -f $(DIR)/*.tok + rm -f $(DIR)/$(ASMDIR)/*.s + rm -f $(DIR)/$(BINDIR)/*.[bin,tok] rm -f $(DIR)/output/*.out rm -rf $(DIR)/profile/ rm -f $(ELF) diff --git a/test/mppa/check.sh b/test/mppa/check.sh index f38d3f0d..dd9691be 100644 --- a/test/mppa/check.sh +++ b/test/mppa/check.sh @@ -11,11 +11,12 @@ fi dir="$(dirname $elffile)" elf="$(basename $elffile)" -exp="$dir/output/$elf.exp" -out="$dir/output/$elf.out" + +exp="$dir/../output/$elf.exp" +out="$dir/../output/$elf.out" if [ ! -f $exp ]; then >&2 echo "ERROR: $exp not found" - shift; continue + exit fi k1-cluster -- $elffile > $out @@ -24,7 +25,6 @@ echo $? >> $out if ! diff $exp $out; then >&2 echo "ERROR: $exp and $out differ" exit - #shift; continue fi echo "PASSED: $elf" -- cgit From d407e23fe62ce837082820f777564c0050cf66c1 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 11 Apr 2018 16:28:49 +0200 Subject: MPPA - Automatic generation of expected value for tests --- test/mppa/Makefile | 9 +++++++-- test/mppa/general/branch.c | 1 + test/mppa/general/branchz.c | 1 + test/mppa/general/branchzu.c | 1 + test/mppa/general/call.c | 2 ++ test/mppa/general/for.c | 2 ++ test/mppa/general/forvar.c | 2 ++ test/mppa/general/forvarl.c | 2 ++ test/mppa/general/output/branch.bin.exp | 1 - test/mppa/general/output/branchz.bin.exp | 1 - test/mppa/general/output/branchzu.bin.exp | 1 - test/mppa/general/output/call.bin.exp | 1 - test/mppa/general/output/for.bin.exp | 1 - test/mppa/general/output/forvar.bin.exp | 1 - test/mppa/general/output/forvarl.bin.exp | 1 - test/mppa/general/output/simple.bin.exp | 1 - test/mppa/general/simple.c | 2 ++ test/mppa/generate.sh | 12 ++++++++++++ 18 files changed, 32 insertions(+), 10 deletions(-) delete mode 100644 test/mppa/general/output/branch.bin.exp delete mode 100644 test/mppa/general/output/branchz.bin.exp delete mode 100644 test/mppa/general/output/branchzu.bin.exp delete mode 100644 test/mppa/general/output/call.bin.exp delete mode 100644 test/mppa/general/output/for.bin.exp delete mode 100644 test/mppa/general/output/forvar.bin.exp delete mode 100644 test/mppa/general/output/forvarl.bin.exp delete mode 100644 test/mppa/general/output/simple.bin.exp create mode 100644 test/mppa/generate.sh (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index f8b3f68c..0e0b2eb2 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -23,10 +23,13 @@ $(DIR)/$(ASMDIR)/%.s: $(DIR)/%.c $(CCOMP) @mkdir -p $(@D) ccomp $(DEBUG) -O0 -v -S $< -o $@ -$(DIR)/$(BINDIR)/%.tok: $(DIR)/$(BINDIR)/%.bin +$(DIR)/$(BINDIR)/%.tok: $(DIR)/$(BINDIR)/%.bin $(DIR)/output/%.bin.exp @mkdir -p $(@D) @bash check.sh $< $@ +$(DIR)/output/%.bin.exp: $(DIR)/%.c + @bash generate.sh $< $@ + .PHONY: FORCE FORCE: @@ -45,7 +48,9 @@ clean: rm -f $(DIR)/*.parsed.c rm -f $(DIR)/*.rtl.? rm -f $(DIR)/$(ASMDIR)/*.s - rm -f $(DIR)/$(BINDIR)/*.[bin,tok] + 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) diff --git a/test/mppa/general/branch.c b/test/mppa/general/branch.c index dee15568..c9bb3865 100644 --- a/test/mppa/general/branch.c +++ b/test/mppa/general/branch.c @@ -10,3 +10,4 @@ int main(void){ return b; } +/* RETURN VALUE: 5 */ diff --git a/test/mppa/general/branchz.c b/test/mppa/general/branchz.c index 5e3226d5..685d3961 100644 --- a/test/mppa/general/branchz.c +++ b/test/mppa/general/branchz.c @@ -10,3 +10,4 @@ int main(void){ return b; } +/* RETURN VALUE: 3 */ diff --git a/test/mppa/general/branchzu.c b/test/mppa/general/branchzu.c index 0ff25763..16bbc4c1 100644 --- a/test/mppa/general/branchzu.c +++ b/test/mppa/general/branchzu.c @@ -10,3 +10,4 @@ int main(void){ return b; } +/* RETURN VALUE: 3 */ diff --git a/test/mppa/general/call.c b/test/mppa/general/call.c index 3f58b756..f35473b6 100644 --- a/test/mppa/general/call.c +++ b/test/mppa/general/call.c @@ -14,3 +14,5 @@ int main(void){ return sum(make_42(), make_18()); //return make_42() + make_18(); } + +/* RETURN VALUE: 60 */ diff --git a/test/mppa/general/for.c b/test/mppa/general/for.c index 6a3a6cc8..41669146 100644 --- a/test/mppa/general/for.c +++ b/test/mppa/general/for.c @@ -7,3 +7,5 @@ int main(void){ return a; } + +/* RETURN VALUE: 16 */ diff --git a/test/mppa/general/forvar.c b/test/mppa/general/forvar.c index 1a075734..5ada4357 100644 --- a/test/mppa/general/forvar.c +++ b/test/mppa/general/forvar.c @@ -8,3 +8,5 @@ int main(void){ return a; } + +/* RETURN VALUE: 16 */ diff --git a/test/mppa/general/forvarl.c b/test/mppa/general/forvarl.c index 90de7411..0ab31998 100644 --- a/test/mppa/general/forvarl.c +++ b/test/mppa/general/forvarl.c @@ -9,3 +9,5 @@ int main(void) return 0; } + +/* RETURN VALUE: 0 */ diff --git a/test/mppa/general/output/branch.bin.exp b/test/mppa/general/output/branch.bin.exp deleted file mode 100644 index 7ed6ff82..00000000 --- a/test/mppa/general/output/branch.bin.exp +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/mppa/general/output/branchz.bin.exp b/test/mppa/general/output/branchz.bin.exp deleted file mode 100644 index 00750edc..00000000 --- a/test/mppa/general/output/branchz.bin.exp +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/mppa/general/output/branchzu.bin.exp b/test/mppa/general/output/branchzu.bin.exp deleted file mode 100644 index 00750edc..00000000 --- a/test/mppa/general/output/branchzu.bin.exp +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/mppa/general/output/call.bin.exp b/test/mppa/general/output/call.bin.exp deleted file mode 100644 index abdfb053..00000000 --- a/test/mppa/general/output/call.bin.exp +++ /dev/null @@ -1 +0,0 @@ -60 diff --git a/test/mppa/general/output/for.bin.exp b/test/mppa/general/output/for.bin.exp deleted file mode 100644 index b6a7d89c..00000000 --- a/test/mppa/general/output/for.bin.exp +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/mppa/general/output/forvar.bin.exp b/test/mppa/general/output/forvar.bin.exp deleted file mode 100644 index b6a7d89c..00000000 --- a/test/mppa/general/output/forvar.bin.exp +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/mppa/general/output/forvarl.bin.exp b/test/mppa/general/output/forvarl.bin.exp deleted file mode 100644 index 573541ac..00000000 --- a/test/mppa/general/output/forvarl.bin.exp +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/mppa/general/output/simple.bin.exp b/test/mppa/general/output/simple.bin.exp deleted file mode 100644 index 7f8f011e..00000000 --- a/test/mppa/general/output/simple.bin.exp +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/mppa/general/simple.c b/test/mppa/general/simple.c index 725aff68..451522fc 100644 --- a/test/mppa/general/simple.c +++ b/test/mppa/general/simple.c @@ -4,3 +4,5 @@ int main(void){ return (a+b); } + +/* RETURN VALUE: 7 */ diff --git a/test/mppa/generate.sh b/test/mppa/generate.sh new file mode 100644 index 00000000..cfe6f7bb --- /dev/null +++ b/test/mppa/generate.sh @@ -0,0 +1,12 @@ +# $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 + +sed -n "s/^.*\/\*\s*RETURN VALUE:\s*\([0-9]*\)\s*\*\//\1/p" $1 > $2 -- cgit From b26424165aa5ae75099792232eca9ea08e09d5a1 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Mon, 16 Apr 2018 17:31:27 +0200 Subject: MPPA - added PRNG generator in the tests --- test/mppa/lib/Makefile | 18 ++++++++++++++++++ test/mppa/lib/prng.c | 40 ++++++++++++++++++++++++++++++++++++++++ test/mppa/lib/prng.h | 8 ++++++++ 3 files changed, 66 insertions(+) create mode 100644 test/mppa/lib/Makefile create mode 100644 test/mppa/lib/prng.c create mode 100644 test/mppa/lib/prng.h (limited to 'test/mppa') diff --git a/test/mppa/lib/Makefile b/test/mppa/lib/Makefile new file mode 100644 index 00000000..10f40f23 --- /dev/null +++ b/test/mppa/lib/Makefile @@ -0,0 +1,18 @@ +prng-test-x86: prng.c + gcc -D__UNIT_TEST__ -O2 -std=c99 $< -o $@ + +.PHONY: +test: test-x86 + +.PHONY: +test-x86: prng-test-x86 + @if ! ./$<; then\ + >&2 echo "ERROR: $< failed";\ + exit;\ + else\ + echo "Test Succeeded";\ + fi + +.PHONY: +clean: + rm -f prng-test-x86 diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c new file mode 100644 index 00000000..5846038c --- /dev/null +++ b/test/mppa/lib/prng.c @@ -0,0 +1,40 @@ +// https://en.wikipedia.org/wiki/Linear_congruential_generator -> MMIX Donald Knuth +// modulo 2^64 = no need to do it explicitly + +#define MULTIPLIER 6364136223846793005LL +#define INCREMENT 1442695040888963407LL + +static unsigned long long current; + +void srand(long long seed){ + seed = current; +} + +unsigned long long randlong(void){ + return (current = MULTIPLIER * current + INCREMENT); +} + +#ifdef __UNIT_TEST__ +char bytewise_sum(unsigned long long to_check){ + char sum = 0; + + for (int i = 0 ; i < 8 ; i++) + sum += (to_check & (unsigned long long)(0xFFULL << i*8)) >> i*8; + + return sum; +} + +int main(void){ + srand(42); + + if (bytewise_sum(0xdeadbeefb00b1355ULL) != 91) + return 1; + + for (int i = 0 ; i < 1000 ; i++) + randlong(); + + unsigned long long last = randlong(); + + return !((unsigned char)bytewise_sum(last) == 251); +} +#endif // __UNIT_TEST__ diff --git a/test/mppa/lib/prng.h b/test/mppa/lib/prng.h new file mode 100644 index 00000000..fee8c865 --- /dev/null +++ b/test/mppa/lib/prng.h @@ -0,0 +1,8 @@ +#ifndef __PRNG_H__ +#define __PRNG_H__ + +void srand(long long seed); + +long long randlong(void); + +#endif // __PRNG_H__ -- cgit From c740492e7a5c14a524c31bbc769a07af2e2ac6be Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 09:59:42 +0200 Subject: MPPA - Added uint64_t types to the tests + k1c test --- test/mppa/lib/Makefile | 18 +++++++++++++++--- test/mppa/lib/prng.c | 14 ++++++++------ test/mppa/lib/prng.h | 6 ++++-- test/mppa/lib/types.h | 7 +++++++ 4 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 test/mppa/lib/types.h (limited to 'test/mppa') diff --git a/test/mppa/lib/Makefile b/test/mppa/lib/Makefile index 10f40f23..e6a75707 100644 --- a/test/mppa/lib/Makefile +++ b/test/mppa/lib/Makefile @@ -1,8 +1,11 @@ prng-test-x86: prng.c gcc -D__UNIT_TEST__ -O2 -std=c99 $< -o $@ +prng-test-k1c: prng.c + k1-gcc -D__UNIT_TEST__ -O2 -std=c99 $< -o $@ + .PHONY: -test: test-x86 +test: test-x86 test-k1c .PHONY: test-x86: prng-test-x86 @@ -10,9 +13,18 @@ test-x86: prng-test-x86 >&2 echo "ERROR: $< failed";\ exit;\ else\ - echo "Test Succeeded";\ + echo "x86: Test Succeeded";\ + fi + +.PHONY: +test-k1c: prng-test-k1c + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR: $< failed";\ + exit;\ + else\ + echo "k1c: Test Succeeded";\ fi .PHONY: clean: - rm -f prng-test-x86 + rm -f prng-test-x86 prng-test-k1c diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c index 5846038c..bfc38678 100644 --- a/test/mppa/lib/prng.c +++ b/test/mppa/lib/prng.c @@ -1,25 +1,27 @@ // https://en.wikipedia.org/wiki/Linear_congruential_generator -> MMIX Donald Knuth // modulo 2^64 = no need to do it explicitly +#include "types.h" + #define MULTIPLIER 6364136223846793005LL #define INCREMENT 1442695040888963407LL -static unsigned long long current; +static uint64_t current; -void srand(long long seed){ +void srand(uint64_t seed){ seed = current; } -unsigned long long randlong(void){ +uint64_t randlong(void){ return (current = MULTIPLIER * current + INCREMENT); } #ifdef __UNIT_TEST__ -char bytewise_sum(unsigned long long to_check){ +char bytewise_sum(uint64_t to_check){ char sum = 0; for (int i = 0 ; i < 8 ; i++) - sum += (to_check & (unsigned long long)(0xFFULL << i*8)) >> i*8; + sum += (to_check & (uint64_t)(0xFFULL << i*8)) >> i*8; return sum; } @@ -33,7 +35,7 @@ int main(void){ for (int i = 0 ; i < 1000 ; i++) randlong(); - unsigned long long last = randlong(); + uint64_t last = randlong(); return !((unsigned char)bytewise_sum(last) == 251); } diff --git a/test/mppa/lib/prng.h b/test/mppa/lib/prng.h index fee8c865..6abdb45a 100644 --- a/test/mppa/lib/prng.h +++ b/test/mppa/lib/prng.h @@ -1,8 +1,10 @@ #ifndef __PRNG_H__ #define __PRNG_H__ -void srand(long long seed); +#include "types.h" -long long randlong(void); +void srand(uint64_t seed); + +uint64_t randlong(void); #endif // __PRNG_H__ diff --git a/test/mppa/lib/types.h b/test/mppa/lib/types.h new file mode 100644 index 00000000..584023e3 --- /dev/null +++ b/test/mppa/lib/types.h @@ -0,0 +1,7 @@ +#ifndef __TYPES_H__ +#define __TYPES_H__ + +#define uint64_t unsigned long long +#define int64_t signed long long + +#endif // __TYPES_H__ -- cgit From 04722ad007e7a4f0cef7fd2fd08a6f3219138299 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 12:00:43 +0200 Subject: MPPA - changed UNIT_TEST names --- test/mppa/lib/Makefile | 4 ++-- test/mppa/lib/prng.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/lib/Makefile b/test/mppa/lib/Makefile index e6a75707..7aeab9f3 100644 --- a/test/mppa/lib/Makefile +++ b/test/mppa/lib/Makefile @@ -1,8 +1,8 @@ prng-test-x86: prng.c - gcc -D__UNIT_TEST__ -O2 -std=c99 $< -o $@ + gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ prng-test-k1c: prng.c - k1-gcc -D__UNIT_TEST__ -O2 -std=c99 $< -o $@ + k1-gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ .PHONY: test: test-x86 test-k1c diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c index bfc38678..dfa97834 100644 --- a/test/mppa/lib/prng.c +++ b/test/mppa/lib/prng.c @@ -16,7 +16,7 @@ uint64_t randlong(void){ return (current = MULTIPLIER * current + INCREMENT); } -#ifdef __UNIT_TEST__ +#ifdef __UNIT_TEST_PRNG__ char bytewise_sum(uint64_t to_check){ char sum = 0; @@ -39,4 +39,4 @@ int main(void){ return !((unsigned char)bytewise_sum(last) == 251); } -#endif // __UNIT_TEST__ +#endif // __UNIT_TEST_PRNG__ -- cgit From eb1e1c79fa3fc882b68c67d781f7b64e74e00828 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 12:01:18 +0200 Subject: MPPA - tests - added insertion sort and selection sort --- test/mppa/sort/Makefile | 40 +++++++++++++++++++++++++++++++++ test/mppa/sort/insertion.c | 52 +++++++++++++++++++++++++++++++++++++++++++ test/mppa/sort/insertion.h | 6 +++++ test/mppa/sort/selection.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++ test/mppa/sort/selection.h | 6 +++++ 5 files changed, 159 insertions(+) create mode 100644 test/mppa/sort/Makefile create mode 100644 test/mppa/sort/insertion.c create mode 100644 test/mppa/sort/insertion.h create mode 100644 test/mppa/sort/selection.c create mode 100644 test/mppa/sort/selection.h (limited to 'test/mppa') diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile new file mode 100644 index 00000000..1f4a0d51 --- /dev/null +++ b/test/mppa/sort/Makefile @@ -0,0 +1,40 @@ +PRNG=../lib/prng.c + +insertion-test-x86: insertion.c $(PRNG) + gcc -g -D__UNIT_TEST_INSERTION__ -O2 -std=c99 $^ -o $@ + +insertion-test-k1c: insertion.c $(PRNG) + k1-gcc -D__UNIT_TEST_INSERTION__ -O2 -std=c99 $^ -o $@ + +selection-test-x86: selection.c $(PRNG) + gcc -g -D__UNIT_TEST_SELECTION__ -O2 -std=c99 $^ -o $@ + +selection-test-k1c: selection.c $(PRNG) + k1-gcc -D__UNIT_TEST_SELECTION__ -O2 -std=c99 $^ -o $@ + +.PHONY: +unittest: unittest-x86 unittest-k1c + +.PHONY: +unittest-x86: insertion-test-x86 selection-test-x86 + @for test in $^; do\ + if ! ./$$test; then\ + >&2 echo "ERROR: $$test failed";\ + else\ + echo "x86: Test $$test Succeeded";\ + fi;\ + done + +.PHONY: +unittest-k1c: insertion-test-k1c selection-test-k1c + @for test in $^; do\ + if ! k1-cluster -- ./$$test; then\ + >&2 echo "ERROR: $$test failed";\ + else\ + echo "k1c: Test $$test Succeeded";\ + fi;\ + done + +.PHONY: +clean: + rm -f insertion-test-x86 insertion-test-k1c selection-test-k1c selection-test-x86 diff --git a/test/mppa/sort/insertion.c b/test/mppa/sort/insertion.c new file mode 100644 index 00000000..2c6065e7 --- /dev/null +++ b/test/mppa/sort/insertion.c @@ -0,0 +1,52 @@ +#include "../lib/prng.h" +#include "../lib/types.h" + +void swap(uint64_t *a, uint64_t *b){ + uint64_t tmp = *a; + *a = *b; + *b = tmp; +} + +int insert_sort(uint64_t *res, const uint64_t *T, int size){ + if (size <= 0) + return -1; + + for (int i = 0 ; i < size ; i++) + res[i] = T[i]; + + for (int i = 0 ; i < size-1 ; i++){ + if (res[i] > res[i+1]){ + swap(&res[i], &res[i+1]); + for (int j = i ; j > 1 ; j--) + if (res[j-1] > res[j]) + swap(&res[j-1], &res[j]); + } + } + + return 0; +} + +#ifdef __UNIT_TEST_INSERTION__ +#define SIZE 100 + +int main(void){ + uint64_t T[SIZE]; + uint64_t res[SIZE]; + srand(42); + + for (int i = 0 ; i < SIZE ; i++) + T[i] = randlong(); + + /* Sorting the table */ + if (insert_sort(res, T, SIZE) < 0) return -1; + + /* Computing max(T) */ + uint64_t max = T[0]; + for (int i = 1 ; i < SIZE ; i++) + if (T[i] > max) + max = T[i]; + + /* We should have: max(T) == res[SIZE] */ + return !(max == res[SIZE-1]); +} +#endif // __UNIT_TEST_INSERTION__ diff --git a/test/mppa/sort/insertion.h b/test/mppa/sort/insertion.h new file mode 100644 index 00000000..135b3bc1 --- /dev/null +++ b/test/mppa/sort/insertion.h @@ -0,0 +1,6 @@ +#ifndef __INSERTION_H__ +#define __INSERTION_H__ + +int insert_sort(uint64_t *res, const uint64_t *T, int size); + +#endif // __INSERTION_H__ diff --git a/test/mppa/sort/selection.c b/test/mppa/sort/selection.c new file mode 100644 index 00000000..432bbf49 --- /dev/null +++ b/test/mppa/sort/selection.c @@ -0,0 +1,55 @@ +#include "../lib/prng.h" +#include "../lib/types.h" + +void swap(uint64_t *a, uint64_t *b){ + uint64_t tmp = *a; + *a = *b; + *b = tmp; +} + +int selection_sort(uint64_t *res, const uint64_t *T, int size){ + if (size <= 0) + return -1; + + for (int i = 0 ; i < size ; i++) + res[i] = T[i]; + + for (int j = 0 ; j < size ; j++){ + int i; + int iMin = j; + for (i = j+1 ; i < size ; i++) + if (res[i] < res[iMin]) + iMin = i; + + if (iMin != j) + swap (&res[j], &res[iMin]); + } + + return 0; +} + +#ifdef __UNIT_TEST_SELECTION__ +#define SIZE 100 + +int main(void){ + uint64_t T[SIZE]; + uint64_t res[SIZE]; + srand(42); + + for (int i = 0 ; i < SIZE ; i++) + T[i] = randlong(); + + /* Sorting the table */ + if (selection_sort(res, T, SIZE) < 0) return -1; + + /* Computing max(T) */ + uint64_t max = T[0]; + for (int i = 1 ; i < SIZE ; i++) + if (T[i] > max) + max = T[i]; + + /* We should have: max(T) == res[SIZE] */ + return !(max == res[SIZE-1]); +} +#endif // __UNIT_TEST_SELECTION__ + diff --git a/test/mppa/sort/selection.h b/test/mppa/sort/selection.h new file mode 100644 index 00000000..b2b4aebe --- /dev/null +++ b/test/mppa/sort/selection.h @@ -0,0 +1,6 @@ +#ifndef __SELECTION_H__ +#define __SELECTION_H__ + +int selection_sort(uint64_t *res, const uint64_t *T, int size); + +#endif // __SELECTION_H__ -- cgit From 1b8cf73abc25b1bb167db770a622704f0d672691 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 15:33:14 +0200 Subject: MPPA - added merge sort + corrected bug in insertion + testing them together --- test/mppa/lib/prng.c | 6 ++-- test/mppa/sort/Makefile | 52 +++++++++++++++++++++------- test/mppa/sort/insertion.c | 26 ++++++++------ test/mppa/sort/insertion.h | 2 +- test/mppa/sort/merge.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++ test/mppa/sort/merge.h | 7 ++++ test/mppa/sort/selection.c | 24 +++++++------ test/mppa/sort/selection.h | 2 +- test/mppa/sort/test.c | 33 ++++++++++++++++++ test/mppa/sort/test.h | 6 ++++ 10 files changed, 205 insertions(+), 38 deletions(-) create mode 100644 test/mppa/sort/merge.c create mode 100644 test/mppa/sort/merge.h create mode 100644 test/mppa/sort/test.c create mode 100644 test/mppa/sort/test.h (limited to 'test/mppa') diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c index dfa97834..c902cc3e 100644 --- a/test/mppa/lib/prng.c +++ b/test/mppa/lib/prng.c @@ -9,11 +9,13 @@ static uint64_t current; void srand(uint64_t seed){ - seed = current; + //seed = current; + current=100; } uint64_t randlong(void){ - return (current = MULTIPLIER * current + INCREMENT); + //return (current = MULTIPLIER * current + INCREMENT); + return current--; } #ifdef __UNIT_TEST_PRNG__ diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index 1f4a0d51..ce86017d 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -1,35 +1,61 @@ PRNG=../lib/prng.c -insertion-test-x86: insertion.c $(PRNG) - gcc -g -D__UNIT_TEST_INSERTION__ -O2 -std=c99 $^ -o $@ +ALL= insertion-test-x86 insertion-test-k1c\ + selection-test-x86 selection-test-k1c\ + merge-test-x86 merge-test-k1c\ + test-x86 test-k1c -insertion-test-k1c: insertion.c $(PRNG) - k1-gcc -D__UNIT_TEST_INSERTION__ -O2 -std=c99 $^ -o $@ +all: $(ALL) -selection-test-x86: selection.c $(PRNG) - gcc -g -D__UNIT_TEST_SELECTION__ -O2 -std=c99 $^ -o $@ +%-test-x86: %.c $(PRNG) + gcc -g -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ -selection-test-k1c: selection.c $(PRNG) - k1-gcc -D__UNIT_TEST_SELECTION__ -O2 -std=c99 $^ -o $@ +%-test-k1c: %.c $(PRNG) + k1-gcc -g -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ + +test-x86: selection.c merge.c insertion.c test.c $(PRNG) + gcc -g -O2 -std=c99 $^ -o $@ + +test-k1c: selection.c merge.c insertion.c test.c $(PRNG) + k1-gcc -g -O2 -std=c99 $^ -o $@ .PHONY: unittest: unittest-x86 unittest-k1c .PHONY: -unittest-x86: insertion-test-x86 selection-test-x86 +check: check-x86 check-k1c + +.PHONY: +check-x86: test-x86 + @if ! ./$<; then\ + >&2 echo "ERROR x86: $< failed";\ + else\ + echo "x86: Test $< succeeded";\ + fi + +.PHONY: +check-k1c: test-k1c + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR k1c: $< failed";\ + else\ + echo "k1c: Test $< succeeded";\ + fi + +.PHONY: +unittest-x86: insertion-test-x86 selection-test-x86 merge-test-x86 @for test in $^; do\ if ! ./$$test; then\ - >&2 echo "ERROR: $$test failed";\ + >&2 echo "ERROR x86: $$test failed";\ else\ echo "x86: Test $$test Succeeded";\ fi;\ done .PHONY: -unittest-k1c: insertion-test-k1c selection-test-k1c +unittest-k1c: insertion-test-k1c selection-test-k1c merge-test-k1c @for test in $^; do\ if ! k1-cluster -- ./$$test; then\ - >&2 echo "ERROR: $$test failed";\ + >&2 echo "ERROR k1c: $$test failed";\ else\ echo "k1c: Test $$test Succeeded";\ fi;\ @@ -37,4 +63,4 @@ unittest-k1c: insertion-test-k1c selection-test-k1c .PHONY: clean: - rm -f insertion-test-x86 insertion-test-k1c selection-test-k1c selection-test-x86 + rm -f $(ALL) diff --git a/test/mppa/sort/insertion.c b/test/mppa/sort/insertion.c index 2c6065e7..88093b64 100644 --- a/test/mppa/sort/insertion.c +++ b/test/mppa/sort/insertion.c @@ -1,25 +1,31 @@ #include "../lib/prng.h" #include "../lib/types.h" -void swap(uint64_t *a, uint64_t *b){ +#ifdef __UNIT_TEST_INSERTION__ +#define SIZE 100 +#else +#include "test.h" +#endif + +void swap_ins(uint64_t *a, uint64_t *b){ uint64_t tmp = *a; *a = *b; *b = tmp; } -int insert_sort(uint64_t *res, const uint64_t *T, int size){ - if (size <= 0) +int insert_sort(uint64_t *res, const uint64_t *T){ + if (SIZE <= 0) return -1; - for (int i = 0 ; i < size ; i++) + for (int i = 0 ; i < SIZE ; i++) res[i] = T[i]; - for (int i = 0 ; i < size-1 ; i++){ + for (int i = 0 ; i < SIZE-1 ; i++){ if (res[i] > res[i+1]){ - swap(&res[i], &res[i+1]); - for (int j = i ; j > 1 ; j--) + swap_ins(&res[i], &res[i+1]); + for (int j = i ; j > 0 ; j--) if (res[j-1] > res[j]) - swap(&res[j-1], &res[j]); + swap_ins(&res[j-1], &res[j]); } } @@ -27,8 +33,6 @@ int insert_sort(uint64_t *res, const uint64_t *T, int size){ } #ifdef __UNIT_TEST_INSERTION__ -#define SIZE 100 - int main(void){ uint64_t T[SIZE]; uint64_t res[SIZE]; @@ -38,7 +42,7 @@ int main(void){ T[i] = randlong(); /* Sorting the table */ - if (insert_sort(res, T, SIZE) < 0) return -1; + if (insert_sort(res, T) < 0) return -1; /* Computing max(T) */ uint64_t max = T[0]; diff --git a/test/mppa/sort/insertion.h b/test/mppa/sort/insertion.h index 135b3bc1..6e37c5fe 100644 --- a/test/mppa/sort/insertion.h +++ b/test/mppa/sort/insertion.h @@ -1,6 +1,6 @@ #ifndef __INSERTION_H__ #define __INSERTION_H__ -int insert_sort(uint64_t *res, const uint64_t *T, int size); +int insert_sort(uint64_t *res, const uint64_t *T); #endif // __INSERTION_H__ diff --git a/test/mppa/sort/merge.c b/test/mppa/sort/merge.c new file mode 100644 index 00000000..63f662ac --- /dev/null +++ b/test/mppa/sort/merge.c @@ -0,0 +1,85 @@ +#include "../lib/prng.h" +#include "../lib/types.h" + +//https://en.wikipedia.org/wiki/Merge_sort + +#ifdef __UNIT_TEST_MERGE__ +#define SIZE 100 +#else +#include "test.h" +#endif + +int min(int a, int b){ + return (a < b)?a:b; +} + +void BottomUpMerge(const uint64_t *A, int iLeft, int iRight, int iEnd, int64_t *B) +{ + int i = iLeft, j = iRight; + for (int k = iLeft; k < iEnd; k++) { + if (i < iRight && (j >= iEnd || A[i] <= A[j])) { + B[k] = A[i]; + i = i + 1; + } else { + B[k] = A[j]; + j = j + 1; + } + } +} + +void CopyArray(uint64_t *to, const uint64_t *from) +{ + const int n = SIZE; + + for(int i = 0; i < n; i++) + to[i] = from[i]; +} + +void BottomUpMergeSort(uint64_t *A, uint64_t *B) +{ + const int n = SIZE; + + for (int width = 1; width < n; width = 2 * width) + { + for (int i = 0; i < n; i = i + 2 * width) + { + BottomUpMerge(A, i, min(i+width, n), min(i+2*width, n), B); + } + CopyArray(A, B); + } +} + +int merge_sort(uint64_t *res, const uint64_t *T){ + if (SIZE <= 0) + return -1; + + uint64_t B[SIZE]; + uint64_t *A = res; + for (int i = 0 ; i < SIZE ; i++) + A[i] = T[i]; + + BottomUpMergeSort(A, B); +} + +#ifdef __UNIT_TEST_MERGE__ +int main(void){ + uint64_t T[SIZE]; + uint64_t res[SIZE]; + srand(42); + + for (int i = 0 ; i < SIZE ; i++) + T[i] = randlong(); + + /* Sorting the table */ + if (merge_sort(res, T) < 0) return -1; + + /* Computing max(T) */ + uint64_t max = T[0]; + for (int i = 1 ; i < SIZE ; i++) + if (T[i] > max) + max = T[i]; + + /* We should have: max(T) == res[SIZE] */ + return !(max == res[SIZE-1]); +} +#endif // __UNIT_TEST_MERGE__ diff --git a/test/mppa/sort/merge.h b/test/mppa/sort/merge.h new file mode 100644 index 00000000..439ce64a --- /dev/null +++ b/test/mppa/sort/merge.h @@ -0,0 +1,7 @@ +#ifndef __MERGE_H__ +#define __MERGE_H__ + +int merge_sort(uint64_t *res, const uint64_t *T); + +#endif // __MERGE_H__ + diff --git a/test/mppa/sort/selection.c b/test/mppa/sort/selection.c index 432bbf49..89bc2c65 100644 --- a/test/mppa/sort/selection.c +++ b/test/mppa/sort/selection.c @@ -1,36 +1,40 @@ #include "../lib/prng.h" #include "../lib/types.h" -void swap(uint64_t *a, uint64_t *b){ +#ifdef __UNIT_TEST_SELECTION__ +#define SIZE 100 +#else +#include "test.h" +#endif + +void swap_sel(uint64_t *a, uint64_t *b){ uint64_t tmp = *a; *a = *b; *b = tmp; } -int selection_sort(uint64_t *res, const uint64_t *T, int size){ - if (size <= 0) +int select_sort(uint64_t *res, const uint64_t *T){ + if (SIZE <= 0) return -1; - for (int i = 0 ; i < size ; i++) + for (int i = 0 ; i < SIZE ; i++) res[i] = T[i]; - for (int j = 0 ; j < size ; j++){ + for (int j = 0 ; j < SIZE ; j++){ int i; int iMin = j; - for (i = j+1 ; i < size ; i++) + for (i = j+1 ; i < SIZE ; i++) if (res[i] < res[iMin]) iMin = i; if (iMin != j) - swap (&res[j], &res[iMin]); + swap_sel (&res[j], &res[iMin]); } return 0; } #ifdef __UNIT_TEST_SELECTION__ -#define SIZE 100 - int main(void){ uint64_t T[SIZE]; uint64_t res[SIZE]; @@ -40,7 +44,7 @@ int main(void){ T[i] = randlong(); /* Sorting the table */ - if (selection_sort(res, T, SIZE) < 0) return -1; + if (select_sort(res, T) < 0) return -1; /* Computing max(T) */ uint64_t max = T[0]; diff --git a/test/mppa/sort/selection.h b/test/mppa/sort/selection.h index b2b4aebe..92a6b461 100644 --- a/test/mppa/sort/selection.h +++ b/test/mppa/sort/selection.h @@ -1,6 +1,6 @@ #ifndef __SELECTION_H__ #define __SELECTION_H__ -int selection_sort(uint64_t *res, const uint64_t *T, int size); +int select_sort(uint64_t *res, const uint64_t *T); #endif // __SELECTION_H__ diff --git a/test/mppa/sort/test.c b/test/mppa/sort/test.c new file mode 100644 index 00000000..e5e14fef --- /dev/null +++ b/test/mppa/sort/test.c @@ -0,0 +1,33 @@ +#include "../lib/prng.h" +#include "../lib/types.h" + +#include "test.h" +#include "insertion.h" +#include "selection.h" +#include "merge.h" + +int main(void){ + uint64_t T[SIZE]; + uint64_t res1[SIZE], res2[SIZE], res3[SIZE]; + srand(42); + + for (int i = 0 ; i < SIZE ; i++) + T[i] = randlong(); + + /* insertion sort */ + if (insert_sort(res1, T) < 0) return -1; + + /* selection sort */ + if (select_sort(res2, T) < 0) return -2; + + /* merge sort */ + if (merge_sort(res3, T) < 0) return -3; + + /* We should have: res1[i] == res2[i] == res3[i] */ + for (int i = 0 ; i < SIZE ; i++){ + if (!(res1[i] == res2[i] && res2[i] == res3[i])) + return -4; + } + + return 0; +} diff --git a/test/mppa/sort/test.h b/test/mppa/sort/test.h new file mode 100644 index 00000000..4501ee38 --- /dev/null +++ b/test/mppa/sort/test.h @@ -0,0 +1,6 @@ +#ifndef __TEST_H__ +#define __TEST_H__ + +#define SIZE 100 + +#endif -- cgit From 8a77a2d41eb560ce9dbc3669971ccbc342743784 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 15:41:14 +0200 Subject: MPPA - Added CompCert tests --- test/mppa/sort/Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/mppa') diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index ce86017d..69dfca23 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -3,7 +3,8 @@ PRNG=../lib/prng.c ALL= insertion-test-x86 insertion-test-k1c\ selection-test-x86 selection-test-k1c\ merge-test-x86 merge-test-k1c\ - test-x86 test-k1c + test-x86 test-k1c\ + test-ccomp all: $(ALL) @@ -19,12 +20,26 @@ test-x86: selection.c merge.c insertion.c test.c $(PRNG) test-k1c: selection.c merge.c insertion.c test.c $(PRNG) k1-gcc -g -O2 -std=c99 $^ -o $@ +%.s: %.c + ccomp -O2 -S $< -o $@ + +test-ccomp: selection.s merge.s insertion.s test.s $(subst .c,.s,$(PRNG)) + k1-gcc $^ -o $@ + .PHONY: unittest: unittest-x86 unittest-k1c .PHONY: check: check-x86 check-k1c +.PHONY: +compc-check: test-ccomp + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR k1c: $< failed";\ + else\ + echo "k1c: Test $< succeeded";\ + fi + .PHONY: check-x86: test-x86 @if ! ./$<; then\ -- cgit From 3997c0bc61ddbbceefd449a8007e7212add8ac4a Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 16:30:26 +0200 Subject: MPPA - added all shifts --- test/mppa/.gitignore | 1 + test/mppa/general/.gitignore | 1 + test/mppa/lib/.gitignore | 2 ++ test/mppa/sort/.gitignore | 8 ++++++++ 4 files changed, 12 insertions(+) create mode 100644 test/mppa/.gitignore create mode 100644 test/mppa/general/.gitignore create mode 100644 test/mppa/lib/.gitignore create mode 100644 test/mppa/sort/.gitignore (limited to 'test/mppa') diff --git a/test/mppa/.gitignore b/test/mppa/.gitignore new file mode 100644 index 00000000..f03fc12c --- /dev/null +++ b/test/mppa/.gitignore @@ -0,0 +1 @@ +check diff --git a/test/mppa/general/.gitignore b/test/mppa/general/.gitignore new file mode 100644 index 00000000..ea1472ec --- /dev/null +++ b/test/mppa/general/.gitignore @@ -0,0 +1 @@ +output/ diff --git a/test/mppa/lib/.gitignore b/test/mppa/lib/.gitignore new file mode 100644 index 00000000..1879eaee --- /dev/null +++ b/test/mppa/lib/.gitignore @@ -0,0 +1,2 @@ +prng-test-k1c +prng-test-x86 diff --git a/test/mppa/sort/.gitignore b/test/mppa/sort/.gitignore new file mode 100644 index 00000000..e7dc9aa0 --- /dev/null +++ b/test/mppa/sort/.gitignore @@ -0,0 +1,8 @@ +insertion-test-k1c +insertion-test-x86 +merge-test-k1c +selection-test-k1c +test-k1c +merge-test-x86 +selection-test-x86 +test-x86 -- cgit From b17acc2e5f9c31a93164897c64c698fe8e490765 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 16:33:11 +0200 Subject: MPPA - Forgot to uncomment debugging section of prng test --- test/mppa/lib/prng.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c index c902cc3e..dfa97834 100644 --- a/test/mppa/lib/prng.c +++ b/test/mppa/lib/prng.c @@ -9,13 +9,11 @@ static uint64_t current; void srand(uint64_t seed){ - //seed = current; - current=100; + seed = current; } uint64_t randlong(void){ - //return (current = MULTIPLIER * current + INCREMENT); - return current--; + return (current = MULTIPLIER * current + INCREMENT); } #ifdef __UNIT_TEST_PRNG__ -- cgit From b63085295d8495ff640f5eaff8b8ad52fc5c43d1 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 17:03:52 +0200 Subject: MPPA - More shifts --- test/mppa/sort/merge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/mppa') diff --git a/test/mppa/sort/merge.c b/test/mppa/sort/merge.c index 63f662ac..b2d41ce3 100644 --- a/test/mppa/sort/merge.c +++ b/test/mppa/sort/merge.c @@ -13,7 +13,7 @@ int min(int a, int b){ return (a < b)?a:b; } -void BottomUpMerge(const uint64_t *A, int iLeft, int iRight, int iEnd, int64_t *B) +void BottomUpMerge(const uint64_t *A, int iLeft, int iRight, int iEnd, uint64_t *B) { int i = iLeft, j = iRight; for (int k = iLeft; k < iEnd; k++) { @@ -59,6 +59,8 @@ int merge_sort(uint64_t *res, const uint64_t *T){ A[i] = T[i]; BottomUpMergeSort(A, B); + + return 0; } #ifdef __UNIT_TEST_MERGE__ -- cgit From eb3fd167668695c33f776cbb381c7664c3ec1858 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 17 Apr 2018 17:28:51 +0200 Subject: MPPA - Added Pmull -> now able to run the sort test --- test/mppa/Makefile | 6 +++++- test/mppa/sort/.gitignore | 1 + test/mppa/sort/Makefile | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 0e0b2eb2..3c1ab002 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -34,7 +34,11 @@ $(DIR)/output/%.bin.exp: $(DIR)/%.c FORCE: .PHONY: -check: $(TOK) +check: $(TOK) sort + +.PHONY: +sort: FORCE + (cd sort && make compc-check) .PHONY: clean: diff --git a/test/mppa/sort/.gitignore b/test/mppa/sort/.gitignore index e7dc9aa0..c8f4f4e5 100644 --- a/test/mppa/sort/.gitignore +++ b/test/mppa/sort/.gitignore @@ -6,3 +6,4 @@ test-k1c merge-test-x86 selection-test-x86 test-x86 +test-ccomp diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index 69dfca23..4a118875 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -35,9 +35,9 @@ check: check-x86 check-k1c .PHONY: compc-check: test-ccomp @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR k1c: $< failed";\ + >&2 echo "ERROR k1c: sort $< failed";\ else\ - echo "k1c: Test $< succeeded";\ + echo "k1c: Test sort $< succeeded";\ fi .PHONY: -- cgit From 511acb8102b26ec0460f1d3c7ce21a9941f095ff Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 18 Apr 2018 14:03:48 +0200 Subject: MPPA - added a Matrix Multiply test --- test/mppa/mmult/Makefile | 77 ++++++++++++++++++++++++++++++++++++++++++++++++ test/mppa/mmult/mmult.c | 54 +++++++++++++++++++++++++++++++++ test/mppa/mmult/mmult.h | 9 ++++++ 3 files changed, 140 insertions(+) create mode 100644 test/mppa/mmult/Makefile create mode 100644 test/mppa/mmult/mmult.c create mode 100644 test/mppa/mmult/mmult.h (limited to 'test/mppa') diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile new file mode 100644 index 00000000..9cb5b9e7 --- /dev/null +++ b/test/mppa/mmult/Makefile @@ -0,0 +1,77 @@ +PRNG=../lib/prng.c + +ALL= mmult-test-x86 mmult-test-k1c\ + +all: $(ALL) + +%-test-x86: %.c $(PRNG) + gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ + +%-test-k1c: %.c $(PRNG) + k1-gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ + +#test-x86: selection.c merge.c insertion.c test.c $(PRNG) +# gcc -g -O2 -std=c99 $^ -o $@ +# +#test-k1c: selection.c merge.c insertion.c test.c $(PRNG) +# k1-gcc -g -O2 -std=c99 $^ -o $@ +# +#%.s: %.c +# ccomp -O2 -S $< -o $@ +# +#test-ccomp: selection.s merge.s insertion.s test.s $(subst .c,.s,$(PRNG)) +# k1-gcc $^ -o $@ + +.PHONY: +unittest: unittest-x86 unittest-k1c + +#.PHONY: +#check: check-x86 check-k1c + +#.PHONY: +#compc-check: test-ccomp +# @if ! k1-cluster -- ./$<; then\ +# >&2 echo "ERROR k1c: sort $< failed";\ +# else\ +# echo "k1c: Test sort $< succeeded";\ +# fi +# +#.PHONY: +#check-x86: test-x86 +# @if ! ./$<; then\ +# >&2 echo "ERROR x86: $< failed";\ +# else\ +# echo "x86: Test $< succeeded";\ +# fi +# +#.PHONY: +#check-k1c: test-k1c +# @if ! k1-cluster -- ./$<; then\ +# >&2 echo "ERROR k1c: $< failed";\ +# else\ +# echo "k1c: Test $< succeeded";\ +# fi + +.PHONY: +unittest-x86: mmult-test-x86 + @for test in $^; do\ + if ! ./$$test; then\ + >&2 echo "ERROR x86: $$test failed";\ + else\ + echo "x86: Test $$test Succeeded";\ + fi;\ + done + +.PHONY: +unittest-k1c: mmult-test-k1c + @for test in $^; do\ + if ! k1-cluster -- ./$$test; then\ + >&2 echo "ERROR k1c: $$test failed";\ + else\ + echo "k1c: Test $$test Succeeded";\ + fi;\ + done + +.PHONY: +clean: + rm -f $(ALL) diff --git a/test/mppa/mmult/mmult.c b/test/mppa/mmult/mmult.c new file mode 100644 index 00000000..04ac4605 --- /dev/null +++ b/test/mppa/mmult/mmult.c @@ -0,0 +1,54 @@ +#include "../lib/types.h" +#include "../lib/prng.h" + +#ifdef __UNIT_TEST_MMULT__ +#define SIZE 50 +#else +#include "test.h" +#endif + +void mmult_row(uint64_t C[][SIZE], uint64_t A[][SIZE], uint64_t B[][SIZE]){ + for (int i = 0 ; i < SIZE ; i++) + for (int j = 0 ; j < SIZE ; j++) + C[i][j] = 0; + + for (int i = 0 ; i < SIZE ; i++) + for (int j = 0 ; j < SIZE ; j++) + for (int k = 0 ; k < SIZE ; k++) + C[i][j] += A[i][k] * B[k][j]; +} + +void mmult_col(uint64_t C[][SIZE], uint64_t A[][SIZE], uint64_t B[][SIZE]){ + for (int i = 0 ; i < SIZE ; i++) + for (int j = 0 ; j < SIZE ; j++) + C[i][j] = 0; + + for (int k = 0 ; k < SIZE ; k++) + for (int i = 0 ; i < SIZE ; i++) + for (int j = 0 ; j < SIZE ; j++) + C[i][j] += A[i][k] * B[k][j]; +} + +#ifdef __UNIT_TEST_MMULT__ +static uint64_t C1[SIZE][SIZE], C2[SIZE][SIZE], A[SIZE][SIZE], B[SIZE][SIZE]; + +int main(void){ + srand(42); + + for (int i = 0 ; i < SIZE ; i++) + for (int j = 0 ; j < SIZE ; j++){ + A[i][j] = randlong(); + B[i][j] = randlong(); + } + + mmult_row(C1, A, B); + mmult_col(C2, A, B); + + for (int i = 0 ; i < SIZE ; i++) + for (int j = 0 ; j < SIZE ; j++) + if (C1[i][j] != C2[i][j]) + return -1; + + return 0; +} +#endif /* __UNIT_TEST_MMULT__ */ diff --git a/test/mppa/mmult/mmult.h b/test/mppa/mmult/mmult.h new file mode 100644 index 00000000..50c04afd --- /dev/null +++ b/test/mppa/mmult/mmult.h @@ -0,0 +1,9 @@ +#ifndef __MMULT_H__ +#define __MMULT_H__ + +#include "../lib/types.h" + +void mmult_row(uint64_t *A, const uint64_t *B, const uint64_t *C); +void mmult_column(uint64_t *A, const uint64_t *B, const uint64_t *C); + +#endif /* __MMULT_H__ */ -- cgit From b7021853e651ddde91450cc83d3c77c5377efc06 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 18 Apr 2018 14:27:44 +0200 Subject: MPPA - added Oaddrsymbol -> now able to run the matrix mult test --- test/mppa/mmult/.gitignore | 3 ++ test/mppa/mmult/Makefile | 74 +++++++++++++++++++++++----------------------- test/mppa/mmult/mmult.c | 2 ++ 3 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 test/mppa/mmult/.gitignore (limited to 'test/mppa') diff --git a/test/mppa/mmult/.gitignore b/test/mppa/mmult/.gitignore new file mode 100644 index 00000000..5883d367 --- /dev/null +++ b/test/mppa/mmult/.gitignore @@ -0,0 +1,3 @@ +mmult-test-k1c +mmult-test-x86 +test-ccomp diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index 9cb5b9e7..bb4506bf 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -10,47 +10,47 @@ all: $(ALL) %-test-k1c: %.c $(PRNG) k1-gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ -#test-x86: selection.c merge.c insertion.c test.c $(PRNG) -# gcc -g -O2 -std=c99 $^ -o $@ -# -#test-k1c: selection.c merge.c insertion.c test.c $(PRNG) -# k1-gcc -g -O2 -std=c99 $^ -o $@ -# -#%.s: %.c -# ccomp -O2 -S $< -o $@ -# -#test-ccomp: selection.s merge.s insertion.s test.s $(subst .c,.s,$(PRNG)) -# k1-gcc $^ -o $@ +test-x86: mmult.c $(PRNG) + gcc -g -O2 -std=c99 $^ -o $@ + +test-k1c: mmult.c $(PRNG) + k1-gcc -g -O2 -std=c99 $^ -o $@ + +%.s: %.c + ccomp -O2 -S $< -o $@ + +test-ccomp: mmult.s $(subst .c,.s,$(PRNG)) + k1-gcc $^ -o $@ .PHONY: unittest: unittest-x86 unittest-k1c -#.PHONY: -#check: check-x86 check-k1c - -#.PHONY: -#compc-check: test-ccomp -# @if ! k1-cluster -- ./$<; then\ -# >&2 echo "ERROR k1c: sort $< failed";\ -# else\ -# echo "k1c: Test sort $< succeeded";\ -# fi -# -#.PHONY: -#check-x86: test-x86 -# @if ! ./$<; then\ -# >&2 echo "ERROR x86: $< failed";\ -# else\ -# echo "x86: Test $< succeeded";\ -# fi -# -#.PHONY: -#check-k1c: test-k1c -# @if ! k1-cluster -- ./$<; then\ -# >&2 echo "ERROR k1c: $< failed";\ -# else\ -# echo "k1c: Test $< succeeded";\ -# fi +.PHONY: +check: check-x86 check-k1c + +.PHONY: +compc-check: test-ccomp + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR k1c: sort $< failed";\ + else\ + echo "k1c: Test sort $< succeeded";\ + fi + +.PHONY: +check-x86: test-x86 + @if ! ./$<; then\ + >&2 echo "ERROR x86: $< failed";\ + else\ + echo "x86: Test $< succeeded";\ + fi + +.PHONY: +check-k1c: test-k1c + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR k1c: $< failed";\ + else\ + echo "k1c: Test $< succeeded";\ + fi .PHONY: unittest-x86: mmult-test-x86 diff --git a/test/mppa/mmult/mmult.c b/test/mppa/mmult/mmult.c index 04ac4605..16dcf34c 100644 --- a/test/mppa/mmult/mmult.c +++ b/test/mppa/mmult/mmult.c @@ -1,6 +1,8 @@ #include "../lib/types.h" #include "../lib/prng.h" +#define __UNIT_TEST_MMULT__ + #ifdef __UNIT_TEST_MMULT__ #define SIZE 50 #else -- cgit From 41a048fa4bb9ddefd4e4acff2207251bb3ddbf06 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 18 Apr 2018 16:44:43 +0200 Subject: MPPA - Added divide & conqueer test matmul --- test/mppa/mmult/mmult.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++-- test/mppa/mmult/mmult.h | 1 + 2 files changed, 87 insertions(+), 2 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/mmult/mmult.c b/test/mppa/mmult/mmult.c index 16dcf34c..c9e7ad5e 100644 --- a/test/mppa/mmult/mmult.c +++ b/test/mppa/mmult/mmult.c @@ -31,8 +31,91 @@ void mmult_col(uint64_t C[][SIZE], uint64_t A[][SIZE], uint64_t B[][SIZE]){ C[i][j] += A[i][k] * B[k][j]; } +typedef struct mblock { + int imin, imax, jmin, jmax; + uint64_t *mat; +} mblock; + +#define MAT_XY(mat, x, y) (mat)[(x)*SIZE + (y)] +#define MAT_IJ(block, i, j) MAT_XY((block)->mat, (block)->imin + (i), block->jmin + (j)) + +int strassen_mul(mblock *C, const mblock *A, const mblock *B){ + const int size = C->imax - C->imin; + + for (int i = 0 ; i < size ; i++) + for (int j = 0 ; j < size ; j++) + for (int k = 0 ; k < size ; k++) + MAT_IJ(C, i, j) += MAT_IJ(A, i, k) * MAT_IJ(B, k, j); +} + +#define BLOCK_X_MID(block) ((block)->imin + (block)->imax) / 2 +#define BLOCK_Y_MID(block) ((block)->jmin + (block)->jmax) / 2 + +#define MAKE_MBLOCK(newb, block, I, J) \ + mblock newb = {.mat=(block)->mat};\ + if ((I) == 0){\ + newb.imin = (block)->imin;\ + newb.imax = BLOCK_X_MID((block));\ + } else {\ + newb.imin = BLOCK_X_MID((block));\ + newb.imax = (block)->imax;\ + } if ((J) == 0){\ + newb.jmin = (block)->jmin;\ + newb.jmax = BLOCK_Y_MID((block));\ + } else {\ + newb.jmin = BLOCK_Y_MID((block));\ + newb.jmax = (block)->jmax;\ + } + +int strassen_part(mblock *C, const mblock *A, const mblock *B); + +void strassen_wrap(mblock *C , char IC, char JC, + const mblock *A, char IA, char JA, + const mblock *B, char IB, char JB){ + MAKE_MBLOCK(Cb, C, IC, JC); + MAKE_MBLOCK(Ab, A, IA, JA); + MAKE_MBLOCK(Bb, B, IB, JB); + + strassen_part(&Cb, &Ab, &Bb); +} + + +int strassen_part(mblock *C, const mblock *A, const mblock *B){ + const int size = C->imax - C->imin; + + if (size % 2 == 1) + strassen_mul(C, A, B); + else{ + /* C_00 = A_00 B_00 + A_01 B_10 */ + strassen_wrap(C, 0, 0, A, 0, 0, B, 0, 0); + strassen_wrap(C, 0, 0, A, 0, 1, B, 1, 0); + + /* C_10 = A_10 B_00 + A_11 B_10 */ + strassen_wrap(C, 1, 0, A, 1, 0, B, 0, 0); + strassen_wrap(C, 1, 0, A, 1, 1, B, 1, 0); + + /* C_01 = A_00 B_01 + A_01 B_11 */ + strassen_wrap(C, 0, 1, A, 0, 0, B, 0, 1); + strassen_wrap(C, 0, 1, A, 0, 1, B, 1, 1); + + /* C_11 = A_10 B_01 + A_11 B_11 */ + strassen_wrap(C, 1, 1, A, 1, 0, B, 0, 1); + strassen_wrap(C, 1, 1, A, 1, 1, B, 1, 1); + } + +} + +void mmult_strassen(uint64_t C[][SIZE], uint64_t A[][SIZE], uint64_t B[][SIZE]){ + mblock Cb = {.mat = (uint64_t *) C, .imin = 0, .imax = SIZE, .jmin = 0, .jmax = SIZE}; + mblock Ab = {.mat = (uint64_t *) A , .imin = 0, .imax = SIZE, .jmin = 0, .jmax = SIZE}; + mblock Bb = {.mat = (uint64_t *) B , .imin = 0, .imax = SIZE, .jmin = 0, .jmax = SIZE}; + + strassen_part(&Cb, &Ab, &Bb); +} + #ifdef __UNIT_TEST_MMULT__ -static uint64_t C1[SIZE][SIZE], C2[SIZE][SIZE], A[SIZE][SIZE], B[SIZE][SIZE]; +static uint64_t C1[SIZE][SIZE], C2[SIZE][SIZE], C3[SIZE][SIZE]; +static uint64_t A[SIZE][SIZE], B[SIZE][SIZE]; int main(void){ srand(42); @@ -45,10 +128,11 @@ int main(void){ mmult_row(C1, A, B); mmult_col(C2, A, B); + mmult_strassen(C3, A, B); for (int i = 0 ; i < SIZE ; i++) for (int j = 0 ; j < SIZE ; j++) - if (C1[i][j] != C2[i][j]) + if (!(C1[i][j] == C2[i][j] && C1[i][j] == C3[i][j])) return -1; return 0; diff --git a/test/mppa/mmult/mmult.h b/test/mppa/mmult/mmult.h index 50c04afd..3721784a 100644 --- a/test/mppa/mmult/mmult.h +++ b/test/mppa/mmult/mmult.h @@ -5,5 +5,6 @@ void mmult_row(uint64_t *A, const uint64_t *B, const uint64_t *C); void mmult_column(uint64_t *A, const uint64_t *B, const uint64_t *C); +void mmult_strassen(uint64_t *A, const uint64_t *B, const uint64_t *C); #endif /* __MMULT_H__ */ -- cgit From aa25ec270b651186154523ec71a3888b50994d70 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 20 Apr 2018 10:31:56 +0200 Subject: MPPA - Oshrximm + Mgetparam + FP is GPR10 + bug Added Oshrximm and Mgetparam -> mmult.c divide & conqueer generates FP is now GPR10 instead of being a mix of GPR30 and GPR32 Corrected a bug where Pgoto and Pj_l were given the same interpretation, where in fact there's a fundamental difference : Pgoto is supposed to have a function name (symbol), while Pj_l is supposed to have a label name (print_label). This led to having undefinite labels in the code. --- test/mppa/mmult/mmult.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/mmult/mmult.c b/test/mppa/mmult/mmult.c index c9e7ad5e..dcbcfe17 100644 --- a/test/mppa/mmult/mmult.c +++ b/test/mppa/mmult/mmult.c @@ -39,7 +39,7 @@ typedef struct mblock { #define MAT_XY(mat, x, y) (mat)[(x)*SIZE + (y)] #define MAT_IJ(block, i, j) MAT_XY((block)->mat, (block)->imin + (i), block->jmin + (j)) -int strassen_mul(mblock *C, const mblock *A, const mblock *B){ +void divac_mul(mblock *C, const mblock *A, const mblock *B){ const int size = C->imax - C->imin; for (int i = 0 ; i < size ; i++) @@ -67,50 +67,50 @@ int strassen_mul(mblock *C, const mblock *A, const mblock *B){ newb.jmax = (block)->jmax;\ } -int strassen_part(mblock *C, const mblock *A, const mblock *B); +void divac_part(mblock *C, const mblock *A, const mblock *B); -void strassen_wrap(mblock *C , char IC, char JC, +void divac_wrap(mblock *C , char IC, char JC, const mblock *A, char IA, char JA, const mblock *B, char IB, char JB){ MAKE_MBLOCK(Cb, C, IC, JC); MAKE_MBLOCK(Ab, A, IA, JA); MAKE_MBLOCK(Bb, B, IB, JB); - strassen_part(&Cb, &Ab, &Bb); + divac_part(&Cb, &Ab, &Bb); } -int strassen_part(mblock *C, const mblock *A, const mblock *B){ +void divac_part(mblock *C, const mblock *A, const mblock *B){ const int size = C->imax - C->imin; if (size % 2 == 1) - strassen_mul(C, A, B); + divac_mul(C, A, B); else{ /* C_00 = A_00 B_00 + A_01 B_10 */ - strassen_wrap(C, 0, 0, A, 0, 0, B, 0, 0); - strassen_wrap(C, 0, 0, A, 0, 1, B, 1, 0); + divac_wrap(C, 0, 0, A, 0, 0, B, 0, 0); + divac_wrap(C, 0, 0, A, 0, 1, B, 1, 0); /* C_10 = A_10 B_00 + A_11 B_10 */ - strassen_wrap(C, 1, 0, A, 1, 0, B, 0, 0); - strassen_wrap(C, 1, 0, A, 1, 1, B, 1, 0); + divac_wrap(C, 1, 0, A, 1, 0, B, 0, 0); + divac_wrap(C, 1, 0, A, 1, 1, B, 1, 0); /* C_01 = A_00 B_01 + A_01 B_11 */ - strassen_wrap(C, 0, 1, A, 0, 0, B, 0, 1); - strassen_wrap(C, 0, 1, A, 0, 1, B, 1, 1); + divac_wrap(C, 0, 1, A, 0, 0, B, 0, 1); + divac_wrap(C, 0, 1, A, 0, 1, B, 1, 1); /* C_11 = A_10 B_01 + A_11 B_11 */ - strassen_wrap(C, 1, 1, A, 1, 0, B, 0, 1); - strassen_wrap(C, 1, 1, A, 1, 1, B, 1, 1); + divac_wrap(C, 1, 1, A, 1, 0, B, 0, 1); + divac_wrap(C, 1, 1, A, 1, 1, B, 1, 1); } } -void mmult_strassen(uint64_t C[][SIZE], uint64_t A[][SIZE], uint64_t B[][SIZE]){ +void mmult_divac(uint64_t C[][SIZE], uint64_t A[][SIZE], uint64_t B[][SIZE]){ mblock Cb = {.mat = (uint64_t *) C, .imin = 0, .imax = SIZE, .jmin = 0, .jmax = SIZE}; mblock Ab = {.mat = (uint64_t *) A , .imin = 0, .imax = SIZE, .jmin = 0, .jmax = SIZE}; mblock Bb = {.mat = (uint64_t *) B , .imin = 0, .imax = SIZE, .jmin = 0, .jmax = SIZE}; - strassen_part(&Cb, &Ab, &Bb); + divac_part(&Cb, &Ab, &Bb); } #ifdef __UNIT_TEST_MMULT__ @@ -128,7 +128,7 @@ int main(void){ mmult_row(C1, A, B); mmult_col(C2, A, B); - mmult_strassen(C3, A, B); + mmult_divac(C3, A, B); for (int i = 0 ; i < SIZE ; i++) for (int j = 0 ; j < SIZE ; j++) -- cgit From b1ab210e798c911a5e4952ed244e581a18c86312 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 24 Apr 2018 10:48:24 +0200 Subject: MPPA - refined tests. Bug in mmult - need to generate O0 to debug easier --- test/mppa/Makefile | 6 +++++- test/mppa/generate.sh | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 3c1ab002..faeb7c62 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -34,12 +34,16 @@ $(DIR)/output/%.bin.exp: $(DIR)/%.c FORCE: .PHONY: -check: $(TOK) sort +check: $(TOK) sort mmult .PHONY: sort: FORCE (cd sort && make compc-check) +.PHONY: +mmult: FORCE + (cd mmult && make compc-check) + .PHONY: clean: rm -f $(DIR)/*.alloctrace diff --git a/test/mppa/generate.sh b/test/mppa/generate.sh index cfe6f7bb..cfb0a119 100644 --- a/test/mppa/generate.sh +++ b/test/mppa/generate.sh @@ -9,4 +9,6 @@ if [ ! -f $cfile ]; then shift; continue fi +mkdir -p $(dirname $writefile) + sed -n "s/^.*\/\*\s*RETURN VALUE:\s*\([0-9]*\)\s*\*\//\1/p" $1 > $2 -- cgit From 31d718c4b7fc81eced145de585b371bd01d3fabc Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 25 Apr 2018 13:37:15 +0200 Subject: MPPA - Corrected messages on test/mppa/mmult/Makefile --- test/mppa/mmult/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index bb4506bf..edea61ae 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -31,9 +31,9 @@ check: check-x86 check-k1c .PHONY: compc-check: test-ccomp @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR k1c: sort $< failed";\ + >&2 echo "ERROR k1c: mmult $< failed";\ else\ - echo "k1c: Test sort $< succeeded";\ + echo "k1c: Test mmult $< succeeded";\ fi .PHONY: -- cgit From 28db3119a6fef8a6ef487b414f7851a065db0889 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 25 Apr 2018 13:37:53 +0200 Subject: MPPA - Added test for division int by 2 --- test/mppa/Makefile | 2 +- test/mppa/general/div2.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 test/mppa/general/div2.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index faeb7c62..b210efaf 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,7 +1,7 @@ DIR=general BINDIR=bin ASMDIR=asm -TESTNAMES=simple call branch for forvar forvarl branchz branchzu +TESTNAMES=simple call branch for forvar forvarl branchz branchzu div2 CCOMP=../../ccomp #TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) diff --git a/test/mppa/general/div2.c b/test/mppa/general/div2.c new file mode 100644 index 00000000..ec73b32d --- /dev/null +++ b/test/mppa/general/div2.c @@ -0,0 +1,22 @@ +#define SIZE 10 + +int main(void){ + int a[SIZE], b[SIZE], c[SIZE]; + int i; + + for (i = 0 ; i < SIZE ; i++){ + a[i] = i-5; + b[i] = -i+2; + c[i] = (a[i] + b[i]) / 2; + } + /* a = {-5, -4, .., 5} + * b = { 2, 1, .., -8} + */ + + for (i = 0 ; i < SIZE ; i++) + if (c[i] != -1) + return c[i]; + + return 42; +} +/* RETURN VALUE: 42 */ -- cgit From aa26db13f4daedec371a17ee7f79ecce7f8fb60f Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 25 Apr 2018 15:26:28 +0200 Subject: MPPA - Added coverage test --- test/mppa/Makefile | 5 +++++ test/mppa/asm_coverage | 1 + test/mppa/coverage.sh | 17 +++++++++++++++++ test/mppa/coverage_helper.py | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 160000 test/mppa/asm_coverage create mode 100644 test/mppa/coverage.sh create mode 100644 test/mppa/coverage_helper.py (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index b210efaf..87315f6e 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -36,6 +36,11 @@ FORCE: .PHONY: check: $(TOK) sort mmult +.PHONY: +coverage: $(ASM) + bash coverage.sh $(DIR)/$(ASMDIR) + + .PHONY: sort: FORCE (cd sort && make compc-check) diff --git a/test/mppa/asm_coverage b/test/mppa/asm_coverage new file mode 160000 index 00000000..5bdb081b --- /dev/null +++ b/test/mppa/asm_coverage @@ -0,0 +1 @@ +Subproject commit 5bdb081bc5fd4962315e960af3c539f2ddd24477 diff --git a/test/mppa/coverage.sh b/test/mppa/coverage.sh new file mode 100644 index 00000000..0a057ff9 --- /dev/null +++ b/test/mppa/coverage.sh @@ -0,0 +1,17 @@ +asmdir=$1 +to_cover_raw=/tmp/to_cover_raw +to_cover=/tmp/to_cover +covered_raw=/tmp/covered_raw +covered=/tmp/covered + +sed -n "s/^.*fprintf oc \" \(.*\) .*/\1/p" ../../mppa_k1c/TargetPrinter.ml > $to_cover_raw +sed -n "s/^.*fprintf oc \" \(.*\)\\n.*/\1/p" ../../mppa_k1c/TargetPrinter.ml >> $to_cover_raw +python2.7 coverage_helper.py $to_cover_raw > $to_cover + +rm -f $covered_raw +for asm in $(ls $asmdir/*.s); do + bash asm_coverage/asm-coverage.sh $asm >> $covered_raw +done +python2.7 coverage_helper.py $covered_raw > $covered + +vimdiff $to_cover $covered diff --git a/test/mppa/coverage_helper.py b/test/mppa/coverage_helper.py new file mode 100644 index 00000000..f886264c --- /dev/null +++ b/test/mppa/coverage_helper.py @@ -0,0 +1,35 @@ +import fileinput + +occurs = {} + +for line in fileinput.input(): + line_noc = line.replace('\n', '') + if line_noc not in occurs: + occurs[line_noc] = 0 + occurs[line_noc] += 1 + +# HACK: Removing all the instructions with "%a", replacing them with all their variations +# Also removing all instructions starting with '.' +pruned_occurs = dict(occurs) +for inst in occurs: + if inst[0] == '.': + del pruned_occurs[inst] + if "%a" not in inst: + continue + inst_no_a = inst.replace(".%a", "") + if inst_no_a in ("compw", "compd"): + del pruned_occurs[inst] + for mod in ("ne", "eq", "lt", "gt", "le", "ge", "ltu", "leu", "geu", + "gtu", "all", "any", "nall", "none"): + pruned_occurs[inst_no_a + "." + mod] = 1 + elif inst_no_a in ("cb"): + del pruned_occurs[inst] + for mod in ("wnez", "weqz", "wltz", "wgez", "wlez", "wgtz", "dnez", + "dltz", "dgez", "dlez", "dgtz"): + pruned_occurs[inst_no_a + "." + mod] = 1 + else: + assert False, "Found instruction with %a: " + inst +occurs = pruned_occurs + +for inst in sorted(occurs): + print inst -- cgit From 3cecb184dc53baf94ac1b98ec392f27576106d35 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 25 Apr 2018 15:56:51 +0200 Subject: MPPA - we now compare the results of our tests with k1-gcc --- test/mppa/Makefile | 11 ++++++----- test/mppa/asm_coverage | 2 +- test/mppa/generate.sh | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 87315f6e..d1b732d8 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -10,6 +10,7 @@ TOK=$(addprefix $(DIR)/$(BINDIR)/,$(addsuffix .tok,$(TESTNAMES))) ASM=$(addprefix $(DIR)/$(ASMDIR)/,$(addsuffix .s,$(TESTNAMES))) DEBUG:=$(if $(DEBUG),"-dall",) +.PHONY: all all: $(ELF) nobin: $(ASM) @@ -33,23 +34,23 @@ $(DIR)/output/%.bin.exp: $(DIR)/%.c .PHONY: FORCE FORCE: -.PHONY: +.PHONY: check check: $(TOK) sort mmult -.PHONY: +.PHONY: coverage coverage: $(ASM) bash coverage.sh $(DIR)/$(ASMDIR) -.PHONY: +.PHONY: sort sort: FORCE (cd sort && make compc-check) -.PHONY: +.PHONY: mmult mmult: FORCE (cd mmult && make compc-check) -.PHONY: +.PHONY: clean clean: rm -f $(DIR)/*.alloctrace rm -f $(DIR)/*.cm diff --git a/test/mppa/asm_coverage b/test/mppa/asm_coverage index 5bdb081b..88898ab2 160000 --- a/test/mppa/asm_coverage +++ b/test/mppa/asm_coverage @@ -1 +1 @@ -Subproject commit 5bdb081bc5fd4962315e960af3c539f2ddd24477 +Subproject commit 88898ab230e813d5d03dc901ba4b906d2ef6bbb0 diff --git a/test/mppa/generate.sh b/test/mppa/generate.sh index cfb0a119..765128d4 100644 --- a/test/mppa/generate.sh +++ b/test/mppa/generate.sh @@ -11,4 +11,7 @@ fi mkdir -p $(dirname $writefile) -sed -n "s/^.*\/\*\s*RETURN VALUE:\s*\([0-9]*\)\s*\*\//\1/p" $1 > $2 +#sed -n "s/^.*\/\*\s*RETURN VALUE:\s*\([0-9]*\)\s*\*\//\1/p" $1 > $2 +tmpbin=/tmp/k1-$(basename $1)-bin +k1-gcc -O0 $1 -o $tmpbin +(k1-cluster -- $tmpbin; echo $? > $2) -- cgit From 432bff5418d4789ba4187ffdd6ce89a29d58962a Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 26 Apr 2018 11:36:02 +0200 Subject: MPPA - Added a lot more unit tests + refined coverage --- test/mppa/Makefile | 2 +- test/mppa/asm_coverage | 2 +- test/mppa/coverage_helper.py | 2 +- test/mppa/general/addw.c | 5 +++++ test/mppa/general/andd.c | 5 +++++ test/mppa/general/andw.c | 5 +++++ test/mppa/general/cb.deqz.c | 9 +++++++++ test/mppa/general/cb.dgez.c | 9 +++++++++ test/mppa/general/cb.dgtz.c | 9 +++++++++ test/mppa/general/cb.dlez.c | 9 +++++++++ test/mppa/general/cb.dltz.c | 9 +++++++++ test/mppa/general/cb.dnez.c | 9 +++++++++ test/mppa/general/cb.wgez.c | 9 +++++++++ test/mppa/general/cb.wgtz.c | 9 +++++++++ test/mppa/general/cb.wlez.c | 9 +++++++++ test/mppa/general/cb.wltz.c | 9 +++++++++ test/mppa/general/compd.eq.c | 4 ++++ test/mppa/general/compd.geu.c | 4 ++++ test/mppa/general/compd.gt.c | 4 ++++ test/mppa/general/compd.gtu.c | 4 ++++ test/mppa/general/compd.le.c | 4 ++++ test/mppa/general/compd.leu.c | 4 ++++ test/mppa/general/compd.lt.c | 4 ++++ test/mppa/general/compd.ltu.c | 4 ++++ test/mppa/general/compd.ne.c | 4 ++++ test/mppa/general/compw.eq.c | 4 ++++ test/mppa/general/compw.geu.c | 4 ++++ test/mppa/general/compw.gt.c | 4 ++++ test/mppa/general/compw.gtu.c | 4 ++++ test/mppa/general/compw.le.c | 4 ++++ test/mppa/general/compw.leu.c | 4 ++++ test/mppa/general/compw.lt.c | 4 ++++ test/mppa/general/compw.ltu.c | 4 ++++ test/mppa/general/compw.ne.c | 4 ++++ test/mppa/general/lbs.c | 5 +++++ test/mppa/general/lbz.c | 5 +++++ test/mppa/general/muld.c | 5 +++++ test/mppa/general/mulw.c | 5 +++++ test/mppa/general/negd.c | 6 ++++++ test/mppa/general/ord.c | 5 +++++ test/mppa/general/sbfd.c | 5 +++++ test/mppa/general/sbfw.c | 5 +++++ test/mppa/general/sllw.c | 5 +++++ test/mppa/general/srad.c | 5 +++++ test/mppa/general/srld.c | 5 +++++ test/mppa/general/xord.c | 5 +++++ 46 files changed, 241 insertions(+), 3 deletions(-) create mode 100644 test/mppa/general/addw.c create mode 100644 test/mppa/general/andd.c create mode 100644 test/mppa/general/andw.c create mode 100644 test/mppa/general/cb.deqz.c create mode 100644 test/mppa/general/cb.dgez.c create mode 100644 test/mppa/general/cb.dgtz.c create mode 100644 test/mppa/general/cb.dlez.c create mode 100644 test/mppa/general/cb.dltz.c create mode 100644 test/mppa/general/cb.dnez.c create mode 100644 test/mppa/general/cb.wgez.c create mode 100644 test/mppa/general/cb.wgtz.c create mode 100644 test/mppa/general/cb.wlez.c create mode 100644 test/mppa/general/cb.wltz.c create mode 100644 test/mppa/general/compd.eq.c create mode 100644 test/mppa/general/compd.geu.c create mode 100644 test/mppa/general/compd.gt.c create mode 100644 test/mppa/general/compd.gtu.c create mode 100644 test/mppa/general/compd.le.c create mode 100644 test/mppa/general/compd.leu.c create mode 100644 test/mppa/general/compd.lt.c create mode 100644 test/mppa/general/compd.ltu.c create mode 100644 test/mppa/general/compd.ne.c create mode 100644 test/mppa/general/compw.eq.c create mode 100644 test/mppa/general/compw.geu.c create mode 100644 test/mppa/general/compw.gt.c create mode 100644 test/mppa/general/compw.gtu.c create mode 100644 test/mppa/general/compw.le.c create mode 100644 test/mppa/general/compw.leu.c create mode 100644 test/mppa/general/compw.lt.c create mode 100644 test/mppa/general/compw.ltu.c create mode 100644 test/mppa/general/compw.ne.c create mode 100644 test/mppa/general/lbs.c create mode 100644 test/mppa/general/lbz.c create mode 100644 test/mppa/general/muld.c create mode 100644 test/mppa/general/mulw.c create mode 100644 test/mppa/general/negd.c create mode 100644 test/mppa/general/ord.c create mode 100644 test/mppa/general/sbfd.c create mode 100644 test/mppa/general/sbfw.c create mode 100644 test/mppa/general/sllw.c create mode 100644 test/mppa/general/srad.c create mode 100644 test/mppa/general/srld.c create mode 100644 test/mppa/general/xord.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index d1b732d8..ffea4c30 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,7 +1,7 @@ DIR=general BINDIR=bin ASMDIR=asm -TESTNAMES=simple call branch for forvar forvarl branchz branchzu div2 +TESTNAMES=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))) CCOMP=../../ccomp #TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) diff --git a/test/mppa/asm_coverage b/test/mppa/asm_coverage index 88898ab2..63195a53 160000 --- a/test/mppa/asm_coverage +++ b/test/mppa/asm_coverage @@ -1 +1 @@ -Subproject commit 88898ab230e813d5d03dc901ba4b906d2ef6bbb0 +Subproject commit 63195a533f3a7f93e8e8ebad0683b176041e09d4 diff --git a/test/mppa/coverage_helper.py b/test/mppa/coverage_helper.py index f886264c..b086aca9 100644 --- a/test/mppa/coverage_helper.py +++ b/test/mppa/coverage_helper.py @@ -24,7 +24,7 @@ for inst in occurs: pruned_occurs[inst_no_a + "." + mod] = 1 elif inst_no_a in ("cb"): del pruned_occurs[inst] - for mod in ("wnez", "weqz", "wltz", "wgez", "wlez", "wgtz", "dnez", + for mod in ("wnez", "weqz", "wltz", "wgez", "wlez", "wgtz", "deqz", "dnez", "dltz", "dgez", "dlez", "dgtz"): pruned_occurs[inst_no_a + "." + mod] = 1 else: diff --git a/test/mppa/general/addw.c b/test/mppa/general/addw.c new file mode 100644 index 00000000..842b0de7 --- /dev/null +++ b/test/mppa/general/addw.c @@ -0,0 +1,5 @@ +int main(void){ + int a = 5; + int b = -3; + return a+b; +} diff --git a/test/mppa/general/andd.c b/test/mppa/general/andd.c new file mode 100644 index 00000000..57c23585 --- /dev/null +++ b/test/mppa/general/andd.c @@ -0,0 +1,5 @@ +int main(void){ + long long a = 5; + long long b = -3; + return a&b; +} diff --git a/test/mppa/general/andw.c b/test/mppa/general/andw.c new file mode 100644 index 00000000..a10f1203 --- /dev/null +++ b/test/mppa/general/andw.c @@ -0,0 +1,5 @@ +int main(void){ + int a = 5; + int b = -3; + return a&b; +} diff --git a/test/mppa/general/cb.deqz.c b/test/mppa/general/cb.deqz.c new file mode 100644 index 00000000..c4f639fd --- /dev/null +++ b/test/mppa/general/cb.deqz.c @@ -0,0 +1,9 @@ +#define TYPE long long + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (0 != a) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.dgez.c b/test/mppa/general/cb.dgez.c new file mode 100644 index 00000000..3d1caf1e --- /dev/null +++ b/test/mppa/general/cb.dgez.c @@ -0,0 +1,9 @@ +#define TYPE long long + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (0 > a) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.dgtz.c b/test/mppa/general/cb.dgtz.c new file mode 100644 index 00000000..9c0c9ea2 --- /dev/null +++ b/test/mppa/general/cb.dgtz.c @@ -0,0 +1,9 @@ +#define TYPE long long + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (0 >= a) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.dlez.c b/test/mppa/general/cb.dlez.c new file mode 100644 index 00000000..021bb16d --- /dev/null +++ b/test/mppa/general/cb.dlez.c @@ -0,0 +1,9 @@ +#define TYPE long long + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (a > 0) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.dltz.c b/test/mppa/general/cb.dltz.c new file mode 100644 index 00000000..d6c59d03 --- /dev/null +++ b/test/mppa/general/cb.dltz.c @@ -0,0 +1,9 @@ +#define TYPE long long + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (a >= 0) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.dnez.c b/test/mppa/general/cb.dnez.c new file mode 100644 index 00000000..99ecf84e --- /dev/null +++ b/test/mppa/general/cb.dnez.c @@ -0,0 +1,9 @@ +#define TYPE long long + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (0 == a) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.wgez.c b/test/mppa/general/cb.wgez.c new file mode 100644 index 00000000..8226c397 --- /dev/null +++ b/test/mppa/general/cb.wgez.c @@ -0,0 +1,9 @@ +#define TYPE int + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (0 > a) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.wgtz.c b/test/mppa/general/cb.wgtz.c new file mode 100644 index 00000000..005e552b --- /dev/null +++ b/test/mppa/general/cb.wgtz.c @@ -0,0 +1,9 @@ +#define TYPE int + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (0 >= a) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.wlez.c b/test/mppa/general/cb.wlez.c new file mode 100644 index 00000000..4393003b --- /dev/null +++ b/test/mppa/general/cb.wlez.c @@ -0,0 +1,9 @@ +#define TYPE int + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (a > 0) + return 42; + return 0; +} diff --git a/test/mppa/general/cb.wltz.c b/test/mppa/general/cb.wltz.c new file mode 100644 index 00000000..76d49f56 --- /dev/null +++ b/test/mppa/general/cb.wltz.c @@ -0,0 +1,9 @@ +#define TYPE int + +int main(void){ + TYPE a = 6; + TYPE b = -4; + if (a >= 0) + return 42; + return 0; +} diff --git a/test/mppa/general/compd.eq.c b/test/mppa/general/compd.eq.c new file mode 100644 index 00000000..9b3e3a0d --- /dev/null +++ b/test/mppa/general/compd.eq.c @@ -0,0 +1,4 @@ +int main(void){ + long long a = 5, b = -2; + return (a == b); +} diff --git a/test/mppa/general/compd.geu.c b/test/mppa/general/compd.geu.c new file mode 100644 index 00000000..d168a6a7 --- /dev/null +++ b/test/mppa/general/compd.geu.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned long long a = 5, b = -2; + return (a >= b); +} diff --git a/test/mppa/general/compd.gt.c b/test/mppa/general/compd.gt.c new file mode 100644 index 00000000..768e57fc --- /dev/null +++ b/test/mppa/general/compd.gt.c @@ -0,0 +1,4 @@ +int main(void){ + long long a = 5, b = -2; + return (a > b); +} diff --git a/test/mppa/general/compd.gtu.c b/test/mppa/general/compd.gtu.c new file mode 100644 index 00000000..5ac1910a --- /dev/null +++ b/test/mppa/general/compd.gtu.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned long long a = 5, b = -2; + return (a > b); +} diff --git a/test/mppa/general/compd.le.c b/test/mppa/general/compd.le.c new file mode 100644 index 00000000..b493f661 --- /dev/null +++ b/test/mppa/general/compd.le.c @@ -0,0 +1,4 @@ +int main(void){ + long long a = 5, b = -2; + return (a <= b); +} diff --git a/test/mppa/general/compd.leu.c b/test/mppa/general/compd.leu.c new file mode 100644 index 00000000..8bb640b1 --- /dev/null +++ b/test/mppa/general/compd.leu.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned long long a = 5, b = -2; + return (a <= b); +} diff --git a/test/mppa/general/compd.lt.c b/test/mppa/general/compd.lt.c new file mode 100644 index 00000000..04a92556 --- /dev/null +++ b/test/mppa/general/compd.lt.c @@ -0,0 +1,4 @@ +int main(void){ + long long a = 5, b = -2; + return (a < b); +} diff --git a/test/mppa/general/compd.ltu.c b/test/mppa/general/compd.ltu.c new file mode 100644 index 00000000..bbd901f6 --- /dev/null +++ b/test/mppa/general/compd.ltu.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned long long a = 5, b = -2; + return (a < b); +} diff --git a/test/mppa/general/compd.ne.c b/test/mppa/general/compd.ne.c new file mode 100644 index 00000000..01c52254 --- /dev/null +++ b/test/mppa/general/compd.ne.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned long long a = 5, b = -2; + return (a != b); +} diff --git a/test/mppa/general/compw.eq.c b/test/mppa/general/compw.eq.c new file mode 100644 index 00000000..f030d86b --- /dev/null +++ b/test/mppa/general/compw.eq.c @@ -0,0 +1,4 @@ +int main(void){ + int a = 5, b = -2; + return (a == b); +} diff --git a/test/mppa/general/compw.geu.c b/test/mppa/general/compw.geu.c new file mode 100644 index 00000000..866f0b47 --- /dev/null +++ b/test/mppa/general/compw.geu.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned int a = 5, b = -2; + return (a >= b); +} diff --git a/test/mppa/general/compw.gt.c b/test/mppa/general/compw.gt.c new file mode 100644 index 00000000..6cde8622 --- /dev/null +++ b/test/mppa/general/compw.gt.c @@ -0,0 +1,4 @@ +int main(void){ + int a = 5, b = -2; + return (a > b); +} diff --git a/test/mppa/general/compw.gtu.c b/test/mppa/general/compw.gtu.c new file mode 100644 index 00000000..b2e74594 --- /dev/null +++ b/test/mppa/general/compw.gtu.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned int a = 5, b = -2; + return (a > b); +} diff --git a/test/mppa/general/compw.le.c b/test/mppa/general/compw.le.c new file mode 100644 index 00000000..8f33e064 --- /dev/null +++ b/test/mppa/general/compw.le.c @@ -0,0 +1,4 @@ +int main(void){ + int a = 5, b = -2; + return (a <= b); +} diff --git a/test/mppa/general/compw.leu.c b/test/mppa/general/compw.leu.c new file mode 100644 index 00000000..fde558eb --- /dev/null +++ b/test/mppa/general/compw.leu.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned int a = 5, b = -2; + return (a <= b); +} diff --git a/test/mppa/general/compw.lt.c b/test/mppa/general/compw.lt.c new file mode 100644 index 00000000..f3bc5a65 --- /dev/null +++ b/test/mppa/general/compw.lt.c @@ -0,0 +1,4 @@ +int main(void){ + int a = 5, b = -2; + return (a < b); +} diff --git a/test/mppa/general/compw.ltu.c b/test/mppa/general/compw.ltu.c new file mode 100644 index 00000000..5e396085 --- /dev/null +++ b/test/mppa/general/compw.ltu.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned int a = 5, b = -2; + return (a < b); +} diff --git a/test/mppa/general/compw.ne.c b/test/mppa/general/compw.ne.c new file mode 100644 index 00000000..28eb627e --- /dev/null +++ b/test/mppa/general/compw.ne.c @@ -0,0 +1,4 @@ +int main(void){ + unsigned int a = 5, b = -2; + return (a != b); +} diff --git a/test/mppa/general/lbs.c b/test/mppa/general/lbs.c new file mode 100644 index 00000000..17441fd2 --- /dev/null +++ b/test/mppa/general/lbs.c @@ -0,0 +1,5 @@ +int main(void){ + char s[] = "Tom and Jerry at the playa\n"; + int a = s[10]; + return a; +} diff --git a/test/mppa/general/lbz.c b/test/mppa/general/lbz.c new file mode 100644 index 00000000..ca4e076f --- /dev/null +++ b/test/mppa/general/lbz.c @@ -0,0 +1,5 @@ +int main(void){ + unsigned char s[] = "Tom and Jerry at the playa\n"; + int a = s[10]; + return a; +} diff --git a/test/mppa/general/muld.c b/test/mppa/general/muld.c new file mode 100644 index 00000000..7893f714 --- /dev/null +++ b/test/mppa/general/muld.c @@ -0,0 +1,5 @@ +int main(void){ + long long a = 3, b = -4; + long long c = a*b; + return c; +} diff --git a/test/mppa/general/mulw.c b/test/mppa/general/mulw.c new file mode 100644 index 00000000..36e3abb1 --- /dev/null +++ b/test/mppa/general/mulw.c @@ -0,0 +1,5 @@ +int main(void){ + int a = 3, b = -4; + int c = a*b; + return c; +} diff --git a/test/mppa/general/negd.c b/test/mppa/general/negd.c new file mode 100644 index 00000000..3a949389 --- /dev/null +++ b/test/mppa/general/negd.c @@ -0,0 +1,6 @@ +int main(void){ + long long a = 5; + long long b = -2; + long long c = -a; + return c; +} diff --git a/test/mppa/general/ord.c b/test/mppa/general/ord.c new file mode 100644 index 00000000..f87061dd --- /dev/null +++ b/test/mppa/general/ord.c @@ -0,0 +1,5 @@ +int main(void){ + long long a = 3, b = -4; + long long c = a|b; + return c; +} diff --git a/test/mppa/general/sbfd.c b/test/mppa/general/sbfd.c new file mode 100644 index 00000000..503c65c7 --- /dev/null +++ b/test/mppa/general/sbfd.c @@ -0,0 +1,5 @@ +int main(void){ + long long a = 3, b = -4; + long long c = a-b; + return c; +} diff --git a/test/mppa/general/sbfw.c b/test/mppa/general/sbfw.c new file mode 100644 index 00000000..2607159f --- /dev/null +++ b/test/mppa/general/sbfw.c @@ -0,0 +1,5 @@ +int main(void){ + int a = 3, b = -4; + int c = a-b; + return c; +} diff --git a/test/mppa/general/sllw.c b/test/mppa/general/sllw.c new file mode 100644 index 00000000..98ecde3a --- /dev/null +++ b/test/mppa/general/sllw.c @@ -0,0 +1,5 @@ +int main(void){ + int a = 3, b = -4; + int c = a << b; + return c; +} diff --git a/test/mppa/general/srad.c b/test/mppa/general/srad.c new file mode 100644 index 00000000..1c0ea20b --- /dev/null +++ b/test/mppa/general/srad.c @@ -0,0 +1,5 @@ +int main(void){ + long long a = 3, b = -4; + long long c = a >> b; + return c; +} diff --git a/test/mppa/general/srld.c b/test/mppa/general/srld.c new file mode 100644 index 00000000..78861790 --- /dev/null +++ b/test/mppa/general/srld.c @@ -0,0 +1,5 @@ +int main(void){ + unsigned long long a = 3, b = -4; + unsigned long long c = a >> b; + return c; +} diff --git a/test/mppa/general/xord.c b/test/mppa/general/xord.c new file mode 100644 index 00000000..ab0ba653 --- /dev/null +++ b/test/mppa/general/xord.c @@ -0,0 +1,5 @@ +int main(void){ + long long a = 3, b = -4; + long long c = a^b; + return c; +} -- cgit From 155745466c01ad9485027689409ab986f7ebb207 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 26 Apr 2018 16:44:37 +0200 Subject: MPPA - mmult and sort Makefile now check on ccomp version --- test/mppa/mmult/Makefile | 7 ++++--- test/mppa/mmult/mmult.c | 2 +- test/mppa/sort/Makefile | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index edea61ae..3297dfe4 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -1,4 +1,5 @@ PRNG=../lib/prng.c +CCOMP=../../../ccomp ALL= mmult-test-x86 mmult-test-k1c\ @@ -16,11 +17,11 @@ test-x86: mmult.c $(PRNG) test-k1c: mmult.c $(PRNG) k1-gcc -g -O2 -std=c99 $^ -o $@ -%.s: %.c - ccomp -O2 -S $< -o $@ +%.s: %.c $(CCOMP) + ccomp -O0 -g -S $< -o $@ test-ccomp: mmult.s $(subst .c,.s,$(PRNG)) - k1-gcc $^ -o $@ + k1-gcc $^ -g -o $@ .PHONY: unittest: unittest-x86 unittest-k1c diff --git a/test/mppa/mmult/mmult.c b/test/mppa/mmult/mmult.c index dcbcfe17..b674ca80 100644 --- a/test/mppa/mmult/mmult.c +++ b/test/mppa/mmult/mmult.c @@ -4,7 +4,7 @@ #define __UNIT_TEST_MMULT__ #ifdef __UNIT_TEST_MMULT__ -#define SIZE 50 +#define SIZE 10 #else #include "test.h" #endif diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index 4a118875..f94fe6b8 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -1,4 +1,5 @@ PRNG=../lib/prng.c +CCOMP=../../../ccomp ALL= insertion-test-x86 insertion-test-k1c\ selection-test-x86 selection-test-k1c\ @@ -20,7 +21,7 @@ test-x86: selection.c merge.c insertion.c test.c $(PRNG) test-k1c: selection.c merge.c insertion.c test.c $(PRNG) k1-gcc -g -O2 -std=c99 $^ -o $@ -%.s: %.c +%.s: %.c $(CCOMP) ccomp -O2 -S $< -o $@ test-ccomp: selection.s merge.s insertion.s test.s $(subst .c,.s,$(PRNG)) -- cgit From 4f1b42bd2ec89d74f7156054e12edd5321c31337 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 26 Apr 2018 18:01:45 +0200 Subject: MPPA - Updated asm_coverage --- test/mppa/asm_coverage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/mppa') diff --git a/test/mppa/asm_coverage b/test/mppa/asm_coverage index 63195a53..a9c62b61 160000 --- a/test/mppa/asm_coverage +++ b/test/mppa/asm_coverage @@ -1 +1 @@ -Subproject commit 63195a533f3a7f93e8e8ebad0683b176041e09d4 +Subproject commit a9c62b61552a9e9fd0ebf43df5ee0d5b88bb0944 -- cgit From a44f224bfa7c340188b54b3bd26a61e94567729b Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 9 May 2018 14:04:31 +0200 Subject: Code cleaning --- test/mppa/mmult/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index 3297dfe4..23b31d49 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -12,16 +12,16 @@ all: $(ALL) k1-gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ test-x86: mmult.c $(PRNG) - gcc -g -O2 -std=c99 $^ -o $@ + gcc -O2 -std=c99 $^ -o $@ test-k1c: mmult.c $(PRNG) - k1-gcc -g -O2 -std=c99 $^ -o $@ + k1-gcc -O2 -std=c99 $^ -o $@ %.s: %.c $(CCOMP) - ccomp -O0 -g -S $< -o $@ + ccomp -O2 -S $< -o $@ test-ccomp: mmult.s $(subst .c,.s,$(PRNG)) - k1-gcc $^ -g -o $@ + k1-gcc $^ -o $@ .PHONY: unittest: unittest-x86 unittest-k1c -- cgit From 479aacd0254605942a3f48c3b8053af4d07f0f6c Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Mon, 21 May 2018 16:34:36 +0200 Subject: MPPA - Added modulo and division 64 bits. Non certified 32 bits version are not yet there. Right now the code is directly from libgcc, compiled with k1-gcc because of builtins. --- test/mppa/Makefile | 2 +- test/mppa/general/udivd.c | 8 ++++++++ test/mppa/general/umodd.c | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/mppa/general/udivd.c create mode 100644 test/mppa/general/umodd.c (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index ffea4c30..5b312475 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -17,7 +17,7 @@ nobin: $(ASM) $(DIR)/$(BINDIR)/%.bin: $(DIR)/$(ASMDIR)/%.s @mkdir -p $(@D) - k1-gcc $< -o $@ + ccomp $< -o $@ .SECONDARY: $(DIR)/$(ASMDIR)/%.s: $(DIR)/%.c $(CCOMP) diff --git a/test/mppa/general/udivd.c b/test/mppa/general/udivd.c new file mode 100644 index 00000000..03e103a6 --- /dev/null +++ b/test/mppa/general/udivd.c @@ -0,0 +1,8 @@ +#define TYPE unsigned long long + +int main(void){ + TYPE a = 6; + TYPE b = -4; + + return a/b; +} diff --git a/test/mppa/general/umodd.c b/test/mppa/general/umodd.c new file mode 100644 index 00000000..96d2b564 --- /dev/null +++ b/test/mppa/general/umodd.c @@ -0,0 +1,8 @@ +#define TYPE unsigned long long + +int main(void){ + TYPE a = 6; + TYPE b = -4; + + return a%b; +} -- cgit From 48762e6309dc92ac7788a30c0ca1007715fce4db Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 5 Jun 2018 13:54:40 +0200 Subject: MPPA - Added Builtins support. Starting with clzll and stsud --- test/mppa/general/clzll.c | 4 ++++ test/mppa/general/stsud.c | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 test/mppa/general/clzll.c create mode 100644 test/mppa/general/stsud.c (limited to 'test/mppa') diff --git a/test/mppa/general/clzll.c b/test/mppa/general/clzll.c new file mode 100644 index 00000000..e3853ea8 --- /dev/null +++ b/test/mppa/general/clzll.c @@ -0,0 +1,4 @@ +int main(void){ + long long a = -5; + return __builtin_clzll(a); +} diff --git a/test/mppa/general/stsud.c b/test/mppa/general/stsud.c new file mode 100644 index 00000000..dc8769fe --- /dev/null +++ b/test/mppa/general/stsud.c @@ -0,0 +1,5 @@ +int main(void){ + unsigned long long a = 5; + long long b = -3; + return __builtin_k1_stsud(a, b); +} -- cgit From 7b5eb7e675ee0978e1b17b75f827dcd45df8c250 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 5 Jun 2018 17:48:22 +0200 Subject: WIP - Changed all the general tests to include PRNG (instead of small constants) --- test/mppa/Makefile | 6 ++++-- test/mppa/general/addw.c | 10 +++++----- test/mppa/general/andd.c | 8 ++++---- test/mppa/general/andw.c | 10 +++++----- test/mppa/general/branch.c | 19 ++++++++----------- test/mppa/general/branchz.c | 19 ++++++++----------- test/mppa/general/branchzu.c | 20 +++++++++----------- test/mppa/general/call.c | 20 +++++++++----------- test/mppa/general/cb.deqz.c | 15 ++++++++------- test/mppa/general/cb.dgez.c | 15 ++++++++------- test/mppa/general/cb.dgtz.c | 15 ++++++++------- test/mppa/general/cb.dlez.c | 15 ++++++++------- test/mppa/general/cb.dltz.c | 15 ++++++++------- test/mppa/general/cb.dnez.c | 15 ++++++++------- test/mppa/general/cb.wgez.c | 15 ++++++++------- test/mppa/general/cb.wgtz.c | 15 ++++++++------- test/mppa/general/cb.wlez.c | 15 ++++++++------- test/mppa/general/cb.wltz.c | 15 ++++++++------- test/mppa/general/clzll.c | 9 ++++++--- test/mppa/general/compd.eq.c | 9 ++++++--- test/mppa/general/compd.geu.c | 9 ++++++--- test/mppa/general/compd.gt.c | 9 ++++++--- test/mppa/general/compd.gtu.c | 9 ++++++--- test/mppa/general/compd.le.c | 9 ++++++--- test/mppa/general/compd.leu.c | 9 ++++++--- test/mppa/general/compd.lt.c | 9 ++++++--- test/mppa/general/compd.ltu.c | 9 ++++++--- test/mppa/general/compd.ne.c | 9 ++++++--- test/mppa/general/compw.eq.c | 9 ++++++--- test/mppa/general/compw.geu.c | 9 ++++++--- test/mppa/general/compw.gt.c | 9 ++++++--- test/mppa/general/compw.gtu.c | 9 ++++++--- test/mppa/general/compw.le.c | 9 ++++++--- test/mppa/general/compw.leu.c | 9 ++++++--- test/mppa/general/compw.lt.c | 9 ++++++--- test/mppa/general/compw.ltu.c | 9 ++++++--- test/mppa/general/compw.ne.c | 9 ++++++--- test/mppa/general/div2.c | 25 +++++-------------------- test/mppa/general/for.c | 16 +++++++--------- test/mppa/general/forvar.c | 17 +++++++---------- test/mppa/general/forvarl.c | 17 +++++++---------- test/mppa/general/framework.h | 24 ++++++++++++++++++++++++ test/mppa/general/lbs.c | 12 ++++++++---- test/mppa/general/lbz.c | 12 ++++++++---- test/mppa/general/muld.c | 10 ++++++---- test/mppa/general/mulw.c | 10 ++++++---- test/mppa/general/negd.c | 11 ++++++----- test/mppa/general/ord.c | 10 ++++++---- test/mppa/general/sbfd.c | 10 ++++++---- test/mppa/general/sbfw.c | 10 ++++++---- test/mppa/general/simple.c | 11 +++++------ test/mppa/general/sllw.c | 10 ++++++---- test/mppa/general/srad.c | 10 ++++++---- test/mppa/general/srld.c | 10 ++++++---- test/mppa/general/stsud.c | 10 ++++++---- test/mppa/general/udivd.c | 11 +++++------ test/mppa/general/umodd.c | 11 +++++------ test/mppa/general/xord.c | 10 ++++++---- test/mppa/lib/prng.c | 2 +- 59 files changed, 394 insertions(+), 308 deletions(-) create mode 100644 test/mppa/general/framework.h (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 5b312475..05223658 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,7 +1,8 @@ DIR=general BINDIR=bin ASMDIR=asm -TESTNAMES=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))) +#TESTNAMES=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))) +TESTNAMES=branch CCOMP=../../ccomp #TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) @@ -35,7 +36,8 @@ $(DIR)/output/%.bin.exp: $(DIR)/%.c FORCE: .PHONY: check -check: $(TOK) sort mmult +check: $(TOK) +#check: $(TOK) sort mmult .PHONY: coverage coverage: $(ASM) diff --git a/test/mppa/general/addw.c b/test/mppa/general/addw.c index 842b0de7..be8afc67 100644 --- a/test/mppa/general/addw.c +++ b/test/mppa/general/addw.c @@ -1,5 +1,5 @@ -int main(void){ - int a = 5; - int b = -3; - return a+b; -} +#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 index 57c23585..4f503764 100644 --- a/test/mppa/general/andd.c +++ b/test/mppa/general/andd.c @@ -1,5 +1,5 @@ -int main(void){ - long long a = 5; - long long b = -3; +#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 index a10f1203..99de0049 100644 --- a/test/mppa/general/andw.c +++ b/test/mppa/general/andw.c @@ -1,5 +1,5 @@ -int main(void){ - int a = 5; - int b = -3; - return a&b; -} +#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 index c9bb3865..72e7e20e 100644 --- a/test/mppa/general/branch.c +++ b/test/mppa/general/branch.c @@ -1,13 +1,10 @@ -int main(void){ - int a=1; - int b; +#include "framework.h" - if(a){ - b = a+4; - } else { - b = a+2; - } - - return b; +BEGIN_TEST(int) +{ + if ((a & 0x1) == 1) + c = 0; + else + c = 1; } -/* RETURN VALUE: 5 */ +END_TEST() diff --git a/test/mppa/general/branchz.c b/test/mppa/general/branchz.c index 685d3961..fb86d357 100644 --- a/test/mppa/general/branchz.c +++ b/test/mppa/general/branchz.c @@ -1,13 +1,10 @@ -int main(void){ - int a=1; - int b; +#include "framework.h" - if(a==0){ - b = a+4; - } else { - b = a+2; - } - - return b; +BEGIN_TEST(int) +{ + if (a & 0x1 == 0) + c = 0; + else + c = 1; } -/* RETURN VALUE: 3 */ +END_TEST() diff --git a/test/mppa/general/branchzu.c b/test/mppa/general/branchzu.c index 16bbc4c1..97adb605 100644 --- a/test/mppa/general/branchzu.c +++ b/test/mppa/general/branchzu.c @@ -1,13 +1,11 @@ -int main(void){ - int a=1; - int b; +#include "framework.h" - if(!a){ - b = a+4; - } else { - b = a+2; - } - - return b; +BEGIN_TEST(int) +{ + b = !(a & 0x01); + if (!b) + c = 0; + else + c = 1; } -/* RETURN VALUE: 3 */ +END_TEST() diff --git a/test/mppa/general/call.c b/test/mppa/general/call.c index f35473b6..727cef63 100644 --- a/test/mppa/general/call.c +++ b/test/mppa/general/call.c @@ -1,18 +1,16 @@ -int sum(int a, int b){ - return a + b; -} +#include "framework.h" -int make_42(void){ - return 42; +int sum(int a, int b){ + return a+b; } -int make_18(void){ - return 18; +int make(int a){ + return a; } -int main(void){ - return sum(make_42(), make_18()); - //return make_42() + make_18(); +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 index c4f639fd..c56733f0 100644 --- a/test/mppa/general/cb.deqz.c +++ b/test/mppa/general/cb.deqz.c @@ -1,9 +1,10 @@ -#define TYPE long long +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (0 != a) - return 42; - return 0; +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 index 3d1caf1e..abb6ec57 100644 --- a/test/mppa/general/cb.dgez.c +++ b/test/mppa/general/cb.dgez.c @@ -1,9 +1,10 @@ -#define TYPE long long +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (0 > a) - return 42; - return 0; +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 index 9c0c9ea2..d4271845 100644 --- a/test/mppa/general/cb.dgtz.c +++ b/test/mppa/general/cb.dgtz.c @@ -1,9 +1,10 @@ -#define TYPE long long +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (0 >= a) - return 42; - return 0; +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 index 021bb16d..18e67f06 100644 --- a/test/mppa/general/cb.dlez.c +++ b/test/mppa/general/cb.dlez.c @@ -1,9 +1,10 @@ -#define TYPE long long +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (a > 0) - return 42; - return 0; +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 index d6c59d03..366aea49 100644 --- a/test/mppa/general/cb.dltz.c +++ b/test/mppa/general/cb.dltz.c @@ -1,9 +1,10 @@ -#define TYPE long long +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (a >= 0) - return 42; - return 0; +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 index 99ecf84e..81c2cd29 100644 --- a/test/mppa/general/cb.dnez.c +++ b/test/mppa/general/cb.dnez.c @@ -1,9 +1,10 @@ -#define TYPE long long +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (0 == a) - return 42; - return 0; +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 index 8226c397..477f4bc6 100644 --- a/test/mppa/general/cb.wgez.c +++ b/test/mppa/general/cb.wgez.c @@ -1,9 +1,10 @@ -#define TYPE int +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (0 > a) - return 42; - return 0; +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 index 005e552b..c9ab9a06 100644 --- a/test/mppa/general/cb.wgtz.c +++ b/test/mppa/general/cb.wgtz.c @@ -1,9 +1,10 @@ -#define TYPE int +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (0 >= a) - return 42; - return 0; +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 index 4393003b..c3069fda 100644 --- a/test/mppa/general/cb.wlez.c +++ b/test/mppa/general/cb.wlez.c @@ -1,9 +1,10 @@ -#define TYPE int +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (a > 0) - return 42; - return 0; +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 index 76d49f56..6cf5fcf0 100644 --- a/test/mppa/general/cb.wltz.c +++ b/test/mppa/general/cb.wltz.c @@ -1,9 +1,10 @@ -#define TYPE int +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - if (a >= 0) - return 42; - return 0; +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 index e3853ea8..13905cba 100644 --- a/test/mppa/general/clzll.c +++ b/test/mppa/general/clzll.c @@ -1,4 +1,7 @@ -int main(void){ - long long a = -5; - return __builtin_clzll(a); +#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 index 9b3e3a0d..d19a4d20 100644 --- a/test/mppa/general/compd.eq.c +++ b/test/mppa/general/compd.eq.c @@ -1,4 +1,7 @@ -int main(void){ - long long a = 5, b = -2; - return (a == b); +#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 index d168a6a7..edc31183 100644 --- a/test/mppa/general/compd.geu.c +++ b/test/mppa/general/compd.geu.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned long long a = 5, b = -2; - return (a >= b); +#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 index 768e57fc..24147779 100644 --- a/test/mppa/general/compd.gt.c +++ b/test/mppa/general/compd.gt.c @@ -1,4 +1,7 @@ -int main(void){ - long long a = 5, b = -2; - return (a > b); +#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 index 5ac1910a..5ce82569 100644 --- a/test/mppa/general/compd.gtu.c +++ b/test/mppa/general/compd.gtu.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned long long a = 5, b = -2; - return (a > b); +#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 index b493f661..a84aad97 100644 --- a/test/mppa/general/compd.le.c +++ b/test/mppa/general/compd.le.c @@ -1,4 +1,7 @@ -int main(void){ - long long a = 5, b = -2; - return (a <= b); +#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 index 8bb640b1..e386bc27 100644 --- a/test/mppa/general/compd.leu.c +++ b/test/mppa/general/compd.leu.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned long long a = 5, b = -2; - return (a <= b); +#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 index 04a92556..df07a708 100644 --- a/test/mppa/general/compd.lt.c +++ b/test/mppa/general/compd.lt.c @@ -1,4 +1,7 @@ -int main(void){ - long long a = 5, b = -2; - return (a < b); +#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 index bbd901f6..dfaa8921 100644 --- a/test/mppa/general/compd.ltu.c +++ b/test/mppa/general/compd.ltu.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned long long a = 5, b = -2; - return (a < b); +#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 index 01c52254..19ce0a69 100644 --- a/test/mppa/general/compd.ne.c +++ b/test/mppa/general/compd.ne.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned long long a = 5, b = -2; - return (a != b); +#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 index f030d86b..dc7a3ab1 100644 --- a/test/mppa/general/compw.eq.c +++ b/test/mppa/general/compw.eq.c @@ -1,4 +1,7 @@ -int main(void){ - int a = 5, b = -2; - return (a == b); +#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 index 866f0b47..d72ca56c 100644 --- a/test/mppa/general/compw.geu.c +++ b/test/mppa/general/compw.geu.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned int a = 5, b = -2; - return (a >= b); +#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 index 6cde8622..9ad02610 100644 --- a/test/mppa/general/compw.gt.c +++ b/test/mppa/general/compw.gt.c @@ -1,4 +1,7 @@ -int main(void){ - int a = 5, b = -2; - return (a > b); +#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 index b2e74594..77f04989 100644 --- a/test/mppa/general/compw.gtu.c +++ b/test/mppa/general/compw.gtu.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned int a = 5, b = -2; - return (a > b); +#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 index 8f33e064..b7a7a432 100644 --- a/test/mppa/general/compw.le.c +++ b/test/mppa/general/compw.le.c @@ -1,4 +1,7 @@ -int main(void){ - int a = 5, b = -2; - return (a <= b); +#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 index fde558eb..4892f06c 100644 --- a/test/mppa/general/compw.leu.c +++ b/test/mppa/general/compw.leu.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned int a = 5, b = -2; - return (a <= b); +#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 index f3bc5a65..2cc151bf 100644 --- a/test/mppa/general/compw.lt.c +++ b/test/mppa/general/compw.lt.c @@ -1,4 +1,7 @@ -int main(void){ - int a = 5, b = -2; - return (a < b); +#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 index 5e396085..b524127f 100644 --- a/test/mppa/general/compw.ltu.c +++ b/test/mppa/general/compw.ltu.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned int a = 5, b = -2; - return (a < b); +#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 index 28eb627e..433b0b86 100644 --- a/test/mppa/general/compw.ne.c +++ b/test/mppa/general/compw.ne.c @@ -1,4 +1,7 @@ -int main(void){ - unsigned int a = 5, b = -2; - return (a != b); +#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 index ec73b32d..01a4b575 100644 --- a/test/mppa/general/div2.c +++ b/test/mppa/general/div2.c @@ -1,22 +1,7 @@ -#define SIZE 10 +#include "framework.h" -int main(void){ - int a[SIZE], b[SIZE], c[SIZE]; - int i; - - for (i = 0 ; i < SIZE ; i++){ - a[i] = i-5; - b[i] = -i+2; - c[i] = (a[i] + b[i]) / 2; - } - /* a = {-5, -4, .., 5} - * b = { 2, 1, .., -8} - */ - - for (i = 0 ; i < SIZE ; i++) - if (c[i] != -1) - return c[i]; - - return 42; +BEGIN_TEST(int) +{ + c = (a + b) / 2; } -/* RETURN VALUE: 42 */ +END_TEST() diff --git a/test/mppa/general/for.c b/test/mppa/general/for.c index 41669146..d6870afb 100644 --- a/test/mppa/general/for.c +++ b/test/mppa/general/for.c @@ -1,11 +1,9 @@ -int main(void){ - int a = 4; - int i; +#include "framework.h" - for (i = 0 ; i < 12 ; i++) - a++; - - return a; +BEGIN_TEST(int) +{ + int j; + for (j = 0 ; j < 10 ; j++) + c += a; } - -/* RETURN VALUE: 16 */ +END_TEST() diff --git a/test/mppa/general/forvar.c b/test/mppa/general/forvar.c index 5ada4357..57548274 100644 --- a/test/mppa/general/forvar.c +++ b/test/mppa/general/forvar.c @@ -1,12 +1,9 @@ -int main(void){ - int i; - int a = 4; - int b = 12; +#include "framework.h" - for (i = 0 ; i < b ; i++) - a++; - - return a; +BEGIN_TEST(int) +{ + int j; + for (j = 0 ; j < (b & 0x8) ; j++) + c += a; } - -/* RETURN VALUE: 16 */ +END_TEST() diff --git a/test/mppa/general/forvarl.c b/test/mppa/general/forvarl.c index 0ab31998..30717a51 100644 --- a/test/mppa/general/forvarl.c +++ b/test/mppa/general/forvarl.c @@ -1,13 +1,10 @@ -int main(void) -{ - long long int a = 42; - long long int b = 84; - long long int i; +#include "framework.h" - for (i = 0 ; i < a ; i++) - b++; +BEGIN_TEST(long long int) +{ + int j; - return 0; + for (j = 0 ; j < (b & 0x8LL) ; j++) + c += a; } - -/* RETURN VALUE: 0 */ +END_TEST() diff --git a/test/mppa/general/framework.h b/test/mppa/general/framework.h new file mode 100644 index 00000000..8321a9a9 --- /dev/null +++ b/test/mppa/general/framework.h @@ -0,0 +1,24 @@ +#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);\ + for (i = 0 ; i < 100 ; i++){\ + 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 index 17441fd2..f104d62b 100644 --- a/test/mppa/general/lbs.c +++ b/test/mppa/general/lbs.c @@ -1,5 +1,9 @@ -int main(void){ - char s[] = "Tom and Jerry at the playa\n"; - int a = s[10]; - return a; +#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 index ca4e076f..2deeaebe 100644 --- a/test/mppa/general/lbz.c +++ b/test/mppa/general/lbz.c @@ -1,5 +1,9 @@ -int main(void){ - unsigned char s[] = "Tom and Jerry at the playa\n"; - int a = s[10]; - return a; +#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 index 7893f714..9a40f389 100644 --- a/test/mppa/general/muld.c +++ b/test/mppa/general/muld.c @@ -1,5 +1,7 @@ -int main(void){ - long long a = 3, b = -4; - long long c = a*b; - return c; +#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 index 36e3abb1..bf517ce8 100644 --- a/test/mppa/general/mulw.c +++ b/test/mppa/general/mulw.c @@ -1,5 +1,7 @@ -int main(void){ - int a = 3, b = -4; - int c = a*b; - return c; +#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 index 3a949389..a8e8ff45 100644 --- a/test/mppa/general/negd.c +++ b/test/mppa/general/negd.c @@ -1,6 +1,7 @@ -int main(void){ - long long a = 5; - long long b = -2; - long long c = -a; - return c; +#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 index f87061dd..eaedcb28 100644 --- a/test/mppa/general/ord.c +++ b/test/mppa/general/ord.c @@ -1,5 +1,7 @@ -int main(void){ - long long a = 3, b = -4; - long long c = a|b; - return c; +#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 index 503c65c7..912f1fdb 100644 --- a/test/mppa/general/sbfd.c +++ b/test/mppa/general/sbfd.c @@ -1,5 +1,7 @@ -int main(void){ - long long a = 3, b = -4; - long long c = a-b; - return c; +#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 index 2607159f..feffd497 100644 --- a/test/mppa/general/sbfw.c +++ b/test/mppa/general/sbfw.c @@ -1,5 +1,7 @@ -int main(void){ - int a = 3, b = -4; - int c = a-b; - return c; +#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 index 451522fc..89bba27e 100644 --- a/test/mppa/general/simple.c +++ b/test/mppa/general/simple.c @@ -1,8 +1,7 @@ -int main(void){ - int a = 4; - int b = 3; +#include "framework.h" - return (a+b); +BEGIN_TEST(int) +{ + c = a+b; } - -/* RETURN VALUE: 7 */ +END_TEST() diff --git a/test/mppa/general/sllw.c b/test/mppa/general/sllw.c index 98ecde3a..df55c9e8 100644 --- a/test/mppa/general/sllw.c +++ b/test/mppa/general/sllw.c @@ -1,5 +1,7 @@ -int main(void){ - int a = 3, b = -4; - int c = a << b; - return c; +#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 index 1c0ea20b..b4047bc7 100644 --- a/test/mppa/general/srad.c +++ b/test/mppa/general/srad.c @@ -1,5 +1,7 @@ -int main(void){ - long long a = 3, b = -4; - long long c = a >> b; - return c; +#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 index 78861790..71e82b2a 100644 --- a/test/mppa/general/srld.c +++ b/test/mppa/general/srld.c @@ -1,5 +1,7 @@ -int main(void){ - unsigned long long a = 3, b = -4; - unsigned long long c = a >> b; - return c; +#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 index dc8769fe..81fb6e6d 100644 --- a/test/mppa/general/stsud.c +++ b/test/mppa/general/stsud.c @@ -1,5 +1,7 @@ -int main(void){ - unsigned long long a = 5; - long long b = -3; - return __builtin_k1_stsud(a, b); +#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 index 03e103a6..52e0d412 100644 --- a/test/mppa/general/udivd.c +++ b/test/mppa/general/udivd.c @@ -1,8 +1,7 @@ -#define TYPE unsigned long long +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - - return a/b; +BEGIN_TEST(unsigned long long) +{ + c = a/b; } +END_TEST() diff --git a/test/mppa/general/umodd.c b/test/mppa/general/umodd.c index 96d2b564..e7dd506f 100644 --- a/test/mppa/general/umodd.c +++ b/test/mppa/general/umodd.c @@ -1,8 +1,7 @@ -#define TYPE unsigned long long +#include "framework.h" -int main(void){ - TYPE a = 6; - TYPE b = -4; - - return a%b; +BEGIN_TEST(unsigned long long) +{ + c = a%b; } +END_TEST() diff --git a/test/mppa/general/xord.c b/test/mppa/general/xord.c index ab0ba653..b9d86f06 100644 --- a/test/mppa/general/xord.c +++ b/test/mppa/general/xord.c @@ -1,5 +1,7 @@ -int main(void){ - long long a = 3, b = -4; - long long c = a^b; - return c; +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a^b; } +END_TEST() diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c index dfa97834..59ec7ca6 100644 --- a/test/mppa/lib/prng.c +++ b/test/mppa/lib/prng.c @@ -9,7 +9,7 @@ static uint64_t current; void srand(uint64_t seed){ - seed = current; + current = seed; } uint64_t randlong(void){ -- cgit From 408ae8c4451b49277e8b97bbb7cedd2fb905bcdb Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 6 Jun 2018 17:30:28 +0200 Subject: MPPA - Forgot to initialize variables in the tests Warning : the division and modulo currently do not pass the tests --- test/mppa/Makefile | 3 +-- test/mppa/general/framework.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 05223658..fddaad37 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -1,8 +1,7 @@ DIR=general BINDIR=bin ASMDIR=asm -#TESTNAMES=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))) -TESTNAMES=branch +TESTNAMES=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))) CCOMP=../../ccomp #TESTS=$(addprefix $(DIR)/,$(TESTNAMES)) diff --git a/test/mppa/general/framework.h b/test/mppa/general/framework.h index 8321a9a9..78f2617e 100644 --- a/test/mppa/general/framework.h +++ b/test/mppa/general/framework.h @@ -7,7 +7,9 @@ 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 */ -- cgit From 265fdd4f703b0310fbcf5ad448c29dc34f7ff33a Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 26 Jun 2018 16:24:34 +0200 Subject: Fixed CompCert library inclusion. Indirect fix for udivd and umodd --- test/mppa/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index fddaad37..5b312475 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -35,8 +35,7 @@ $(DIR)/output/%.bin.exp: $(DIR)/%.c FORCE: .PHONY: check -check: $(TOK) -#check: $(TOK) sort mmult +check: $(TOK) sort mmult .PHONY: coverage coverage: $(ASM) -- cgit From 080875012a740b9fbe9ad9e1d147543ce538a955 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 1 Aug 2018 17:23:31 +0200 Subject: Added all the working builtins for ALU. Added BCU and LSU without testing --- test/mppa/general/clzd.c | 7 +++++++ test/mppa/general/clzll.c | 7 ------- test/mppa/general/clzw.c | 7 +++++++ test/mppa/general/ctzd.c | 7 +++++++ test/mppa/general/ctzw.c | 7 +++++++ test/mppa/general/framework.h | 11 +++++++++++ test/mppa/general/satd.c | 7 +++++++ test/mppa/general/sbmm8.c | 7 +++++++ test/mppa/general/sbmmt8.c | 7 +++++++ test/mppa/general/stsud.c | 4 ++-- test/mppa/generate.sh | 8 ++++++-- 11 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 test/mppa/general/clzd.c delete mode 100644 test/mppa/general/clzll.c create mode 100644 test/mppa/general/clzw.c create mode 100644 test/mppa/general/ctzd.c create mode 100644 test/mppa/general/ctzw.c create mode 100644 test/mppa/general/satd.c create mode 100644 test/mppa/general/sbmm8.c create mode 100644 test/mppa/general/sbmmt8.c (limited to 'test/mppa') diff --git a/test/mppa/general/clzd.c b/test/mppa/general/clzd.c new file mode 100644 index 00000000..4bedab97 --- /dev/null +++ b/test/mppa/general/clzd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST_N(unsigned long long, 1) +{ + c = __builtin_k1_clzd(t[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/clzw.c b/test/mppa/general/clzw.c new file mode 100644 index 00000000..361492f2 --- /dev/null +++ b/test/mppa/general/clzw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST_N(unsigned long long, 1) +{ + c = __builtin_k1_clzw(t[0]); +} +END_TEST() diff --git a/test/mppa/general/ctzd.c b/test/mppa/general/ctzd.c new file mode 100644 index 00000000..6f6586ad --- /dev/null +++ b/test/mppa/general/ctzd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST_N(unsigned long long, 1) +{ + c = __builtin_k1_ctzd(t[0]); +} +END_TEST() diff --git a/test/mppa/general/ctzw.c b/test/mppa/general/ctzw.c new file mode 100644 index 00000000..b0f2c937 --- /dev/null +++ b/test/mppa/general/ctzw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST_N(unsigned long long, 1) +{ + c = __builtin_k1_ctzw(t[0]); +} +END_TEST() diff --git a/test/mppa/general/framework.h b/test/mppa/general/framework.h index 78f2617e..b7dc4933 100644 --- a/test/mppa/general/framework.h +++ b/test/mppa/general/framework.h @@ -3,6 +3,17 @@ #include "../lib/prng.c" +#define BEGIN_TEST_N(type, N)\ + int main(void){\ + type t[N], c, i, j, S;\ + srand(0);\ + S = 0;\ + for (i = 0 ; i < 100 ; i++){\ + c = randlong();\ + for (j = 0 ; j < N ; j++)\ + t[j] = randlong();\ + /* END BEGIN_TEST_N */ + #define BEGIN_TEST(type)\ int main(void){\ type a, b, c, i, S;\ diff --git a/test/mppa/general/satd.c b/test/mppa/general/satd.c new file mode 100644 index 00000000..d8d0d256 --- /dev/null +++ b/test/mppa/general/satd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST_N(unsigned long long, 2) +{ + c = __builtin_k1_satd(t[0], t[1]); +} +END_TEST() diff --git a/test/mppa/general/sbmm8.c b/test/mppa/general/sbmm8.c new file mode 100644 index 00000000..beced8fc --- /dev/null +++ b/test/mppa/general/sbmm8.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST_N(unsigned long long, 2) +{ + c = __builtin_k1_sbmm8(t[0], t[1]); +} +END_TEST() diff --git a/test/mppa/general/sbmmt8.c b/test/mppa/general/sbmmt8.c new file mode 100644 index 00000000..8a64e7e7 --- /dev/null +++ b/test/mppa/general/sbmmt8.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST_N(unsigned long long, 2) +{ + c = __builtin_k1_sbmmt8(t[0], t[1]); +} +END_TEST() diff --git a/test/mppa/general/stsud.c b/test/mppa/general/stsud.c index 81fb6e6d..fb07b94f 100644 --- a/test/mppa/general/stsud.c +++ b/test/mppa/general/stsud.c @@ -1,7 +1,7 @@ #include "framework.h" -BEGIN_TEST(unsigned long long) +BEGIN_TEST_N(unsigned long long, 2) { - c = __builtin_k1_stsud(a, b); + c = __builtin_k1_stsud(t[0], t[1]); } END_TEST() diff --git a/test/mppa/generate.sh b/test/mppa/generate.sh index 765128d4..ea633724 100644 --- a/test/mppa/generate.sh +++ b/test/mppa/generate.sh @@ -4,14 +4,18 @@ cfile="$1" writefile="$2" +dirwritefile=$(dirname $writefile) +asmdir=$dirwritefile/../asm/gcc + if [ ! -f $cfile ]; then >&2 echo "ERROR: $cfile not found" shift; continue fi -mkdir -p $(dirname $writefile) +mkdir -p $dirwritefile +mkdir -p $asmdir -#sed -n "s/^.*\/\*\s*RETURN VALUE:\s*\([0-9]*\)\s*\*\//\1/p" $1 > $2 tmpbin=/tmp/k1-$(basename $1)-bin +k1-gcc -O0 $1 -S -o $asmdir/$(basename $1).s k1-gcc -O0 $1 -o $tmpbin (k1-cluster -- $tmpbin; echo $? > $2) -- cgit From 0b86431038c1e874d7d7030ab41a8f56b0a9991f Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 14 Aug 2018 10:33:40 +0200 Subject: Added some comments on the Makefile --- test/mppa/Makefile | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile index 5b312475..22f22945 100644 --- a/test/mppa/Makefile +++ b/test/mppa/Makefile @@ -4,7 +4,6 @@ ASMDIR=asm TESTNAMES=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))) 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))) @@ -15,19 +14,32 @@ all: $(ELF) nobin: $(ASM) +## +# Assembling CompCert's assembly file +## $(DIR)/$(BINDIR)/%.bin: $(DIR)/$(ASMDIR)/%.s @mkdir -p $(@D) ccomp $< -o $@ +## +# Compiling the C file with CompCert +## .SECONDARY: $(DIR)/$(ASMDIR)/%.s: $(DIR)/%.c $(CCOMP) @mkdir -p $(@D) ccomp $(DEBUG) -O0 -v -S $< -o $@ +## +# A token (.tok) is created if the .bin (created by CompCert) yields the same +# result as the .bin.exp (created by executing the binary compiled with gcc) +## $(DIR)/$(BINDIR)/%.tok: $(DIR)/$(BINDIR)/%.bin $(DIR)/output/%.bin.exp @mkdir -p $(@D) @bash check.sh $< $@ +## +# Generate .bin.exp : compile with gcc, execute, store the result in .bin.exp +## $(DIR)/output/%.bin.exp: $(DIR)/%.c @bash generate.sh $< $@ @@ -37,15 +49,23 @@ FORCE: .PHONY: check check: $(TOK) sort mmult +## +# A utility displaying which of the pseudo-instructions are covered in the tests +## .PHONY: coverage coverage: $(ASM) bash coverage.sh $(DIR)/$(ASMDIR) - +## +# Different versions of a sorting algorithm +## .PHONY: sort sort: FORCE (cd sort && make compc-check) +## +# Different versions of a matrix multiply +## .PHONY: mmult mmult: FORCE (cd mmult && make compc-check) -- cgit From 4f5ec2ec310a78940b29f18e51dd598a9dfe401d Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 9 Nov 2018 15:17:52 +0100 Subject: Fixing k1-gcc becoming k1-mbr-gcc --- test/mppa/generate.sh | 2 +- test/mppa/lib/Makefile | 2 +- test/mppa/mmult/Makefile | 6 +++--- test/mppa/sort/Makefile | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/generate.sh b/test/mppa/generate.sh index 765128d4..a883b8f5 100644 --- a/test/mppa/generate.sh +++ b/test/mppa/generate.sh @@ -13,5 +13,5 @@ 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-gcc -O0 $1 -o $tmpbin +k1-mbr-gcc -O0 $1 -o $tmpbin (k1-cluster -- $tmpbin; echo $? > $2) diff --git a/test/mppa/lib/Makefile b/test/mppa/lib/Makefile index 7aeab9f3..74e7ca8b 100644 --- a/test/mppa/lib/Makefile +++ b/test/mppa/lib/Makefile @@ -2,7 +2,7 @@ prng-test-x86: prng.c gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ prng-test-k1c: prng.c - k1-gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ + k1-mbr-gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ .PHONY: test: test-x86 test-k1c diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index 23b31d49..9c00f8b0 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -9,19 +9,19 @@ all: $(ALL) gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ %-test-k1c: %.c $(PRNG) - k1-gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ + k1-mbr-gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ test-x86: mmult.c $(PRNG) gcc -O2 -std=c99 $^ -o $@ test-k1c: mmult.c $(PRNG) - k1-gcc -O2 -std=c99 $^ -o $@ + k1-mbr-gcc -O2 -std=c99 $^ -o $@ %.s: %.c $(CCOMP) ccomp -O2 -S $< -o $@ test-ccomp: mmult.s $(subst .c,.s,$(PRNG)) - k1-gcc $^ -o $@ + k1-mbr-gcc $^ -o $@ .PHONY: unittest: unittest-x86 unittest-k1c diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index f94fe6b8..26c597be 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -13,19 +13,19 @@ all: $(ALL) gcc -g -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ %-test-k1c: %.c $(PRNG) - k1-gcc -g -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ + k1-mbr-gcc -g -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ test-x86: selection.c merge.c insertion.c test.c $(PRNG) gcc -g -O2 -std=c99 $^ -o $@ test-k1c: selection.c merge.c insertion.c test.c $(PRNG) - k1-gcc -g -O2 -std=c99 $^ -o $@ + k1-mbr-gcc -g -O2 -std=c99 $^ -o $@ %.s: %.c $(CCOMP) ccomp -O2 -S $< -o $@ test-ccomp: selection.s merge.s insertion.s test.s $(subst .c,.s,$(PRNG)) - k1-gcc $^ -o $@ + k1-mbr-gcc $^ -o $@ .PHONY: unittest: unittest-x86 unittest-k1c -- cgit From 622a211d4ebd47feb4d2c7dfe590d10c6d6ae834 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 9 Nov 2018 15:19:04 +0100 Subject: Fixing PRNG test --- test/mppa/lib/prng.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c index 59ec7ca6..af3903d6 100644 --- a/test/mppa/lib/prng.c +++ b/test/mppa/lib/prng.c @@ -29,14 +29,11 @@ char bytewise_sum(uint64_t to_check){ int main(void){ srand(42); - if (bytewise_sum(0xdeadbeefb00b1355ULL) != 91) - return 1; - for (int i = 0 ; i < 1000 ; i++) randlong(); uint64_t last = randlong(); - return !((unsigned char)bytewise_sum(last) == 251); + return !((unsigned char)bytewise_sum(last) == 155); } #endif // __UNIT_TEST_PRNG__ -- cgit From f24d303df6cb125ca19b953bb364955cc6e8c246 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 9 Nov 2018 17:07:13 +0100 Subject: Fixed consistency between the different tests mmult, prng and sort --- test/mppa/lib/.gitignore | 2 -- test/mppa/lib/Makefile | 30 ---------------- test/mppa/lib/prng.c | 39 --------------------- test/mppa/lib/prng.h | 10 ------ test/mppa/lib/types.h | 7 ---- test/mppa/mmult/Makefile | 72 ++++++++++++-------------------------- test/mppa/mmult/README.md | 17 +++++++++ test/mppa/mmult/mmult.c | 44 +++++++++++++---------- test/mppa/prng/.gitignore | 2 ++ test/mppa/prng/Makefile | 49 ++++++++++++++++++++++++++ test/mppa/prng/README.md | 17 +++++++++ test/mppa/prng/prng.c | 41 ++++++++++++++++++++++ test/mppa/prng/prng.h | 10 ++++++ test/mppa/prng/types.h | 7 ++++ test/mppa/sort/Makefile | 87 ++++++++++++++++++++-------------------------- test/mppa/sort/README.md | 17 +++++++++ test/mppa/sort/insertion.c | 17 +++++---- test/mppa/sort/main.c | 34 ++++++++++++++++++ test/mppa/sort/merge.c | 25 +++++++------ test/mppa/sort/selection.c | 21 ++++++----- test/mppa/sort/test.c | 33 ------------------ 21 files changed, 315 insertions(+), 266 deletions(-) delete mode 100644 test/mppa/lib/.gitignore delete mode 100644 test/mppa/lib/Makefile delete mode 100644 test/mppa/lib/prng.c delete mode 100644 test/mppa/lib/prng.h delete mode 100644 test/mppa/lib/types.h create mode 100644 test/mppa/mmult/README.md create mode 100644 test/mppa/prng/.gitignore create mode 100644 test/mppa/prng/Makefile create mode 100644 test/mppa/prng/README.md create mode 100644 test/mppa/prng/prng.c create mode 100644 test/mppa/prng/prng.h create mode 100644 test/mppa/prng/types.h create mode 100644 test/mppa/sort/README.md create mode 100644 test/mppa/sort/main.c delete mode 100644 test/mppa/sort/test.c (limited to 'test/mppa') diff --git a/test/mppa/lib/.gitignore b/test/mppa/lib/.gitignore deleted file mode 100644 index 1879eaee..00000000 --- a/test/mppa/lib/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -prng-test-k1c -prng-test-x86 diff --git a/test/mppa/lib/Makefile b/test/mppa/lib/Makefile deleted file mode 100644 index 74e7ca8b..00000000 --- a/test/mppa/lib/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -prng-test-x86: prng.c - gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ - -prng-test-k1c: prng.c - k1-mbr-gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ - -.PHONY: -test: test-x86 test-k1c - -.PHONY: -test-x86: prng-test-x86 - @if ! ./$<; then\ - >&2 echo "ERROR: $< failed";\ - exit;\ - else\ - echo "x86: Test Succeeded";\ - fi - -.PHONY: -test-k1c: prng-test-k1c - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR: $< failed";\ - exit;\ - else\ - echo "k1c: Test Succeeded";\ - fi - -.PHONY: -clean: - rm -f prng-test-x86 prng-test-k1c diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c deleted file mode 100644 index af3903d6..00000000 --- a/test/mppa/lib/prng.c +++ /dev/null @@ -1,39 +0,0 @@ -// https://en.wikipedia.org/wiki/Linear_congruential_generator -> MMIX Donald Knuth -// modulo 2^64 = no need to do it explicitly - -#include "types.h" - -#define MULTIPLIER 6364136223846793005LL -#define INCREMENT 1442695040888963407LL - -static uint64_t current; - -void srand(uint64_t seed){ - current = seed; -} - -uint64_t randlong(void){ - return (current = MULTIPLIER * current + INCREMENT); -} - -#ifdef __UNIT_TEST_PRNG__ -char bytewise_sum(uint64_t to_check){ - char sum = 0; - - for (int i = 0 ; i < 8 ; i++) - sum += (to_check & (uint64_t)(0xFFULL << i*8)) >> i*8; - - return sum; -} - -int main(void){ - srand(42); - - for (int i = 0 ; i < 1000 ; i++) - randlong(); - - uint64_t last = randlong(); - - return !((unsigned char)bytewise_sum(last) == 155); -} -#endif // __UNIT_TEST_PRNG__ diff --git a/test/mppa/lib/prng.h b/test/mppa/lib/prng.h deleted file mode 100644 index 6abdb45a..00000000 --- a/test/mppa/lib/prng.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __PRNG_H__ -#define __PRNG_H__ - -#include "types.h" - -void srand(uint64_t seed); - -uint64_t randlong(void); - -#endif // __PRNG_H__ diff --git a/test/mppa/lib/types.h b/test/mppa/lib/types.h deleted file mode 100644 index 584023e3..00000000 --- a/test/mppa/lib/types.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __TYPES_H__ -#define __TYPES_H__ - -#define uint64_t unsigned long long -#define int64_t signed long long - -#endif // __TYPES_H__ diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index 9c00f8b0..2e077f5e 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -1,44 +1,28 @@ -PRNG=../lib/prng.c -CCOMP=../../../ccomp +K1CC ?= k1-mbr-gcc +CC ?= gcc +CCOMP ?= ccomp +CFLAGS ?= -O2 -ALL= mmult-test-x86 mmult-test-k1c\ +PRNG=../prng/prng.c -all: $(ALL) - -%-test-x86: %.c $(PRNG) - gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ - -%-test-k1c: %.c $(PRNG) - k1-mbr-gcc -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ - -test-x86: mmult.c $(PRNG) - gcc -O2 -std=c99 $^ -o $@ - -test-k1c: mmult.c $(PRNG) - k1-mbr-gcc -O2 -std=c99 $^ -o $@ +ALL= mmult-test-gcc-x86 mmult-test-gcc-k1c mmult-test-ccomp-k1c\ -%.s: %.c $(CCOMP) - ccomp -O2 -S $< -o $@ +all: $(ALL) -test-ccomp: mmult.s $(subst .c,.s,$(PRNG)) - k1-mbr-gcc $^ -o $@ +mmult-test-gcc-x86: mmult.c $(PRNG) + $(CC) $(CFLAGS) $^ -o $@ -.PHONY: -unittest: unittest-x86 unittest-k1c +mmult-test-gcc-k1c: mmult.c $(PRNG) + $(K1CC) $(CFLAGS) $^ -o $@ -.PHONY: -check: check-x86 check-k1c +mmult-test-ccomp-k1c: mmult.c $(PRNG) + $(CCOMP) $(CFLAGS) $^ -o $@ .PHONY: -compc-check: test-ccomp - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR k1c: mmult $< failed";\ - else\ - echo "k1c: Test mmult $< succeeded";\ - fi +test: test-x86 test-k1c .PHONY: -check-x86: test-x86 +test-x86: mmult-test-gcc-x86 @if ! ./$<; then\ >&2 echo "ERROR x86: $< failed";\ else\ @@ -46,7 +30,7 @@ check-x86: test-x86 fi .PHONY: -check-k1c: test-k1c +test-k1c: mmult-test-gcc-k1c @if ! k1-cluster -- ./$<; then\ >&2 echo "ERROR k1c: $< failed";\ else\ @@ -54,24 +38,12 @@ check-k1c: test-k1c fi .PHONY: -unittest-x86: mmult-test-x86 - @for test in $^; do\ - if ! ./$$test; then\ - >&2 echo "ERROR x86: $$test failed";\ - else\ - echo "x86: Test $$test Succeeded";\ - fi;\ - done - -.PHONY: -unittest-k1c: mmult-test-k1c - @for test in $^; do\ - if ! k1-cluster -- ./$$test; then\ - >&2 echo "ERROR k1c: $$test failed";\ - else\ - echo "k1c: Test $$test Succeeded";\ - fi;\ - done +check: mmult-test-ccomp-k1c + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR k1c: mmult $< failed";\ + else\ + echo "k1c: Test mmult $< succeeded";\ + fi .PHONY: clean: diff --git a/test/mppa/mmult/README.md b/test/mppa/mmult/README.md new file mode 100644 index 00000000..ef2bff7e --- /dev/null +++ b/test/mppa/mmult/README.md @@ -0,0 +1,17 @@ +MMULT +===== + +Examples of matrix multiplication using different methods. + +We compute matrix multiplication using column-based matrix multiplication, then row-based, and finally block based. + +The test verifies that the result is the same on the three methods. If it is the same, 0 will be returned. + +The following commands can be run inside the folder: + +- `make`: produces the unitary test binaries + - `mmult-test-gcc-x86` : binary from gcc on x86 + - `mmult-test-k1c-x86` : binary from gcc on k1c + - `mmult-test-ccomp-x86` : binary from ccomp on k1c +- `make test`: tests the return value of the binaries produced by gcc. +- `make check`: tests the return value of the binary produced by CompCert. diff --git a/test/mppa/mmult/mmult.c b/test/mppa/mmult/mmult.c index b674ca80..aeb91d48 100644 --- a/test/mppa/mmult/mmult.c +++ b/test/mppa/mmult/mmult.c @@ -1,5 +1,5 @@ -#include "../lib/types.h" -#include "../lib/prng.h" +#include "../prng/types.h" +#include "../prng/prng.h" #define __UNIT_TEST_MMULT__ @@ -10,24 +10,28 @@ #endif void mmult_row(uint64_t C[][SIZE], uint64_t A[][SIZE], uint64_t B[][SIZE]){ - for (int i = 0 ; i < SIZE ; i++) - for (int j = 0 ; j < SIZE ; j++) + int i, j, k; + + for (i = 0 ; i < SIZE ; i++) + for (j = 0 ; j < SIZE ; j++) C[i][j] = 0; - for (int i = 0 ; i < SIZE ; i++) - for (int j = 0 ; j < SIZE ; j++) - for (int k = 0 ; k < SIZE ; k++) + for (i = 0 ; i < SIZE ; i++) + for (j = 0 ; j < SIZE ; j++) + for (k = 0 ; k < SIZE ; k++) C[i][j] += A[i][k] * B[k][j]; } void mmult_col(uint64_t C[][SIZE], uint64_t A[][SIZE], uint64_t B[][SIZE]){ - for (int i = 0 ; i < SIZE ; i++) - for (int j = 0 ; j < SIZE ; j++) + int i, j, k; + + for (i = 0 ; i < SIZE ; i++) + for (j = 0 ; j < SIZE ; j++) C[i][j] = 0; - for (int k = 0 ; k < SIZE ; k++) - for (int i = 0 ; i < SIZE ; i++) - for (int j = 0 ; j < SIZE ; j++) + for (k = 0 ; k < SIZE ; k++) + for (i = 0 ; i < SIZE ; i++) + for (j = 0 ; j < SIZE ; j++) C[i][j] += A[i][k] * B[k][j]; } @@ -41,10 +45,11 @@ typedef struct mblock { void divac_mul(mblock *C, const mblock *A, const mblock *B){ const int size = C->imax - C->imin; + int i, j, k; - for (int i = 0 ; i < size ; i++) - for (int j = 0 ; j < size ; j++) - for (int k = 0 ; k < size ; k++) + for (i = 0 ; i < size ; i++) + for (j = 0 ; j < size ; j++) + for (k = 0 ; k < size ; k++) MAT_IJ(C, i, j) += MAT_IJ(A, i, k) * MAT_IJ(B, k, j); } @@ -119,9 +124,10 @@ static uint64_t A[SIZE][SIZE], B[SIZE][SIZE]; int main(void){ srand(42); + int i, j; - for (int i = 0 ; i < SIZE ; i++) - for (int j = 0 ; j < SIZE ; j++){ + for (i = 0 ; i < SIZE ; i++) + for (j = 0 ; j < SIZE ; j++){ A[i][j] = randlong(); B[i][j] = randlong(); } @@ -130,8 +136,8 @@ int main(void){ mmult_col(C2, A, B); mmult_divac(C3, A, B); - for (int i = 0 ; i < SIZE ; i++) - for (int j = 0 ; j < SIZE ; j++) + for (i = 0 ; i < SIZE ; i++) + for (j = 0 ; j < SIZE ; j++) if (!(C1[i][j] == C2[i][j] && C1[i][j] == C3[i][j])) return -1; diff --git a/test/mppa/prng/.gitignore b/test/mppa/prng/.gitignore new file mode 100644 index 00000000..1879eaee --- /dev/null +++ b/test/mppa/prng/.gitignore @@ -0,0 +1,2 @@ +prng-test-k1c +prng-test-x86 diff --git a/test/mppa/prng/Makefile b/test/mppa/prng/Makefile new file mode 100644 index 00000000..481a3fca --- /dev/null +++ b/test/mppa/prng/Makefile @@ -0,0 +1,49 @@ +K1CC ?= k1-mbr-gcc +CC ?= gcc +CCOMP ?= ccomp +CFLAGS ?= -O2 + +all: prng-test-gcc-x86 prng-test-gcc-k1c prng-test-ccomp-k1c + +prng-test-gcc-x86: prng.c + $(CC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ + +prng-test-gcc-k1c: prng.c + $(K1CC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ + +prng-test-ccomp-k1c: prng.c + $(CCOMP) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ + +.PHONY: +test: test-x86 test-k1c + +.PHONY: +test-x86: prng-test-gcc-x86 + @if ! ./$<; then\ + >&2 echo "ERROR: $< failed";\ + exit;\ + else\ + echo "$< Succeeded";\ + fi + +.PHONY: +test-k1c: prng-test-gcc-k1c + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR: $< failed";\ + exit;\ + else\ + echo "$< Succeeded";\ + fi + +.PHONY: +check: prng-test-ccomp-k1c + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR: $< failed";\ + exit;\ + else\ + echo "$< Succeeded";\ + fi + +.PHONY: +clean: + rm -f prng-test-gcc-x86 prng-test-gcc-k1c prng-test-ccomp-k1c diff --git a/test/mppa/prng/README.md b/test/mppa/prng/README.md new file mode 100644 index 00000000..b4c2279b --- /dev/null +++ b/test/mppa/prng/README.md @@ -0,0 +1,17 @@ +PRNG +==== + +This is a simple Pseudo Random Number Generator. + +`prng.c` contains a simple unitary test that compares the sum of the "bytewise sum" +of 1000 generated numbers to a hardcoded result, that is the one obtained with +`gcc -O2` on a x86 processor, and returns 0 if the result is correct. + +The following commands can be run inside that folder: + +- `make`: produces the unitary test binaries + - `prng-test-gcc-x86` : binary from gcc on x86 + - `prng-test-k1c-x86` : binary from gcc on k1c + - `prng-test-ccomp-x86` : binary from ccomp on k1c +- `make test`: tests the return value of the binaries produced by gcc. +- `make check`: tests the return value of the binary produced by CompCert. diff --git a/test/mppa/prng/prng.c b/test/mppa/prng/prng.c new file mode 100644 index 00000000..71de1dc3 --- /dev/null +++ b/test/mppa/prng/prng.c @@ -0,0 +1,41 @@ +// https://en.wikipedia.org/wiki/Linear_congruential_generator -> MMIX Donald Knuth +// modulo 2^64 = no need to do it explicitly + +#include "types.h" + +#define MULTIPLIER 6364136223846793005LL +#define INCREMENT 1442695040888963407LL + +static uint64_t current; + +void srand(uint64_t seed){ + current = seed; +} + +uint64_t randlong(void){ + return (current = MULTIPLIER * current + INCREMENT); +} + +#ifdef __UNIT_TEST_PRNG__ +char bytewise_sum(uint64_t to_check){ + char sum = 0; + int i; + + for (i = 0 ; i < 8 ; i++) + sum += (to_check & (uint64_t)(0xFFULL << i*8)) >> i*8; + + return sum; +} + +int main(void){ + srand(42); + int i; + + for (i = 0 ; i < 1000 ; i++) + randlong(); + + uint64_t last = randlong(); + + return !((unsigned char)bytewise_sum(last) == 155); +} +#endif // __UNIT_TEST_PRNG__ diff --git a/test/mppa/prng/prng.h b/test/mppa/prng/prng.h new file mode 100644 index 00000000..6abdb45a --- /dev/null +++ b/test/mppa/prng/prng.h @@ -0,0 +1,10 @@ +#ifndef __PRNG_H__ +#define __PRNG_H__ + +#include "types.h" + +void srand(uint64_t seed); + +uint64_t randlong(void); + +#endif // __PRNG_H__ diff --git a/test/mppa/prng/types.h b/test/mppa/prng/types.h new file mode 100644 index 00000000..584023e3 --- /dev/null +++ b/test/mppa/prng/types.h @@ -0,0 +1,7 @@ +#ifndef __TYPES_H__ +#define __TYPES_H__ + +#define uint64_t unsigned long long +#define int64_t signed long long + +#endif // __TYPES_H__ diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index 26c597be..c0c9347d 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -1,64 +1,40 @@ -PRNG=../lib/prng.c -CCOMP=../../../ccomp +K1CC ?= k1-mbr-gcc +CC ?= gcc +CCOMP ?= ccomp +CFLAGS ?= -O2 -ALL= insertion-test-x86 insertion-test-k1c\ - selection-test-x86 selection-test-k1c\ - merge-test-x86 merge-test-k1c\ - test-x86 test-k1c\ - test-ccomp +PRNG=../prng/prng.c -all: $(ALL) - -%-test-x86: %.c $(PRNG) - gcc -g -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ +CFILES=insertion.c merge.c selection.c main.c -%-test-k1c: %.c $(PRNG) - k1-mbr-gcc -g -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ -O2 -std=c99 $^ -o $@ +ALL= insertion-test-gcc-x86 insertion-test-gcc-k1c\ + selection-test-gcc-x86 selection-test-gcc-k1c\ + merge-test-gcc-x86 merge-test-gcc-k1c\ + main-test-gcc-x86 main-test-gcc-k1c\ + main-test-ccomp-k1c -test-x86: selection.c merge.c insertion.c test.c $(PRNG) - gcc -g -O2 -std=c99 $^ -o $@ +all: $(ALL) -test-k1c: selection.c merge.c insertion.c test.c $(PRNG) - k1-mbr-gcc -g -O2 -std=c99 $^ -o $@ +main-test-gcc-x86: $(CFILES) $(PRNG) + $(CC) $(CFLAGS) $^ -o $@ -%.s: %.c $(CCOMP) - ccomp -O2 -S $< -o $@ +%-test-gcc-x86: %.c $(PRNG) + $(CC) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $^ -o $@ -test-ccomp: selection.s merge.s insertion.s test.s $(subst .c,.s,$(PRNG)) - k1-mbr-gcc $^ -o $@ +main-test-gcc-k1c: $(CFILES) $(PRNG) + $(K1CC) $(CFLAGS) $^ -o $@ -.PHONY: -unittest: unittest-x86 unittest-k1c +%-test-gcc-k1c: %.c $(PRNG) + $(K1CC) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $^ -o $@ -.PHONY: -check: check-x86 check-k1c +main-test-ccomp-k1c: $(CFILES) $(PRNG) + $(CCOMP) $(CFLAGS) $^ -o $@ -.PHONY: -compc-check: test-ccomp - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR k1c: sort $< failed";\ - else\ - echo "k1c: Test sort $< succeeded";\ - fi - -.PHONY: -check-x86: test-x86 - @if ! ./$<; then\ - >&2 echo "ERROR x86: $< failed";\ - else\ - echo "x86: Test $< succeeded";\ - fi +%-test-ccomp-k1c: %.c $(PRNG) + $(CCOMP) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $^ -o $@ .PHONY: -check-k1c: test-k1c - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR k1c: $< failed";\ - else\ - echo "k1c: Test $< succeeded";\ - fi - -.PHONY: -unittest-x86: insertion-test-x86 selection-test-x86 merge-test-x86 +test-x86: insertion-test-gcc-x86 selection-test-gcc-x86 merge-test-gcc-x86 main-test-gcc-x86 @for test in $^; do\ if ! ./$$test; then\ >&2 echo "ERROR x86: $$test failed";\ @@ -68,7 +44,7 @@ unittest-x86: insertion-test-x86 selection-test-x86 merge-test-x86 done .PHONY: -unittest-k1c: insertion-test-k1c selection-test-k1c merge-test-k1c +test-k1c: insertion-test-gcc-k1c selection-test-gcc-k1c merge-test-gcc-k1c main-test-gcc-k1c @for test in $^; do\ if ! k1-cluster -- ./$$test; then\ >&2 echo "ERROR k1c: $$test failed";\ @@ -77,6 +53,17 @@ unittest-k1c: insertion-test-k1c selection-test-k1c merge-test-k1c fi;\ done +.PHONY: +test: test-x86 test-k1c + +.PHONY: +check: main-test-ccomp-k1c + @if ! k1-cluster -- ./$<; then\ + >&2 echo "ERROR k1c: sort $< failed";\ + else\ + echo "k1c: Test sort $< succeeded";\ + fi + .PHONY: clean: rm -f $(ALL) diff --git a/test/mppa/sort/README.md b/test/mppa/sort/README.md new file mode 100644 index 00000000..b4c2279b --- /dev/null +++ b/test/mppa/sort/README.md @@ -0,0 +1,17 @@ +PRNG +==== + +This is a simple Pseudo Random Number Generator. + +`prng.c` contains a simple unitary test that compares the sum of the "bytewise sum" +of 1000 generated numbers to a hardcoded result, that is the one obtained with +`gcc -O2` on a x86 processor, and returns 0 if the result is correct. + +The following commands can be run inside that folder: + +- `make`: produces the unitary test binaries + - `prng-test-gcc-x86` : binary from gcc on x86 + - `prng-test-k1c-x86` : binary from gcc on k1c + - `prng-test-ccomp-x86` : binary from ccomp on k1c +- `make test`: tests the return value of the binaries produced by gcc. +- `make check`: tests the return value of the binary produced by CompCert. diff --git a/test/mppa/sort/insertion.c b/test/mppa/sort/insertion.c index 88093b64..bca09599 100644 --- a/test/mppa/sort/insertion.c +++ b/test/mppa/sort/insertion.c @@ -1,5 +1,5 @@ -#include "../lib/prng.h" -#include "../lib/types.h" +#include "../prng/prng.h" +#include "../prng/types.h" #ifdef __UNIT_TEST_INSERTION__ #define SIZE 100 @@ -14,16 +14,18 @@ void swap_ins(uint64_t *a, uint64_t *b){ } int insert_sort(uint64_t *res, const uint64_t *T){ + int i, j; + if (SIZE <= 0) return -1; - for (int i = 0 ; i < SIZE ; i++) + for (i = 0 ; i < SIZE ; i++) res[i] = T[i]; - for (int i = 0 ; i < SIZE-1 ; i++){ + for (i = 0 ; i < SIZE-1 ; i++){ if (res[i] > res[i+1]){ swap_ins(&res[i], &res[i+1]); - for (int j = i ; j > 0 ; j--) + for (j = i ; j > 0 ; j--) if (res[j-1] > res[j]) swap_ins(&res[j-1], &res[j]); } @@ -36,9 +38,10 @@ int insert_sort(uint64_t *res, const uint64_t *T){ int main(void){ uint64_t T[SIZE]; uint64_t res[SIZE]; + int i; srand(42); - for (int i = 0 ; i < SIZE ; i++) + for (i = 0 ; i < SIZE ; i++) T[i] = randlong(); /* Sorting the table */ @@ -46,7 +49,7 @@ int main(void){ /* Computing max(T) */ uint64_t max = T[0]; - for (int i = 1 ; i < SIZE ; i++) + for (i = 1 ; i < SIZE ; i++) if (T[i] > max) max = T[i]; diff --git a/test/mppa/sort/main.c b/test/mppa/sort/main.c new file mode 100644 index 00000000..aef419aa --- /dev/null +++ b/test/mppa/sort/main.c @@ -0,0 +1,34 @@ +#include "../prng/prng.h" +#include "../prng/types.h" + +#include "test.h" +#include "insertion.h" +#include "selection.h" +#include "merge.h" + +int main(void){ + uint64_t T[SIZE]; + uint64_t res1[SIZE], res2[SIZE], res3[SIZE]; + int i; + srand(42); + + for (i = 0 ; i < SIZE ; i++) + T[i] = randlong(); + + /* insertion sort */ + if (insert_sort(res1, T) < 0) return -1; + + /* selection sort */ + if (select_sort(res2, T) < 0) return -2; + + /* merge sort */ + if (merge_sort(res3, T) < 0) return -3; + + /* We should have: res1[i] == res2[i] == res3[i] */ + for (i = 0 ; i < SIZE ; i++){ + if (!(res1[i] == res2[i] && res2[i] == res3[i])) + return -4; + } + + return 0; +} diff --git a/test/mppa/sort/merge.c b/test/mppa/sort/merge.c index b2d41ce3..99f8ba85 100644 --- a/test/mppa/sort/merge.c +++ b/test/mppa/sort/merge.c @@ -1,5 +1,5 @@ -#include "../lib/prng.h" -#include "../lib/types.h" +#include "../prng/prng.h" +#include "../prng/types.h" //https://en.wikipedia.org/wiki/Merge_sort @@ -15,8 +15,8 @@ int min(int a, int b){ void BottomUpMerge(const uint64_t *A, int iLeft, int iRight, int iEnd, uint64_t *B) { - int i = iLeft, j = iRight; - for (int k = iLeft; k < iEnd; k++) { + int i = iLeft, j = iRight, k; + for (k = iLeft; k < iEnd; k++) { if (i < iRight && (j >= iEnd || A[i] <= A[j])) { B[k] = A[i]; i = i + 1; @@ -30,18 +30,20 @@ void BottomUpMerge(const uint64_t *A, int iLeft, int iRight, int iEnd, uint64_t void CopyArray(uint64_t *to, const uint64_t *from) { const int n = SIZE; + int i; - for(int i = 0; i < n; i++) + for(i = 0; i < n; i++) to[i] = from[i]; } void BottomUpMergeSort(uint64_t *A, uint64_t *B) { const int n = SIZE; + int width, i; - for (int width = 1; width < n; width = 2 * width) + for (width = 1; width < n; width = 2 * width) { - for (int i = 0; i < n; i = i + 2 * width) + for (i = 0; i < n; i = i + 2 * width) { BottomUpMerge(A, i, min(i+width, n), min(i+2*width, n), B); } @@ -50,12 +52,14 @@ void BottomUpMergeSort(uint64_t *A, uint64_t *B) } int merge_sort(uint64_t *res, const uint64_t *T){ + int i; + if (SIZE <= 0) return -1; uint64_t B[SIZE]; uint64_t *A = res; - for (int i = 0 ; i < SIZE ; i++) + for (i = 0 ; i < SIZE ; i++) A[i] = T[i]; BottomUpMergeSort(A, B); @@ -67,9 +71,10 @@ int merge_sort(uint64_t *res, const uint64_t *T){ int main(void){ uint64_t T[SIZE]; uint64_t res[SIZE]; + int i; srand(42); - for (int i = 0 ; i < SIZE ; i++) + for (i = 0 ; i < SIZE ; i++) T[i] = randlong(); /* Sorting the table */ @@ -77,7 +82,7 @@ int main(void){ /* Computing max(T) */ uint64_t max = T[0]; - for (int i = 1 ; i < SIZE ; i++) + for (i = 1 ; i < SIZE ; i++) if (T[i] > max) max = T[i]; diff --git a/test/mppa/sort/selection.c b/test/mppa/sort/selection.c index 89bc2c65..df4be04f 100644 --- a/test/mppa/sort/selection.c +++ b/test/mppa/sort/selection.c @@ -1,5 +1,5 @@ -#include "../lib/prng.h" -#include "../lib/types.h" +#include "../prng/prng.h" +#include "../prng/types.h" #ifdef __UNIT_TEST_SELECTION__ #define SIZE 100 @@ -14,15 +14,16 @@ void swap_sel(uint64_t *a, uint64_t *b){ } int select_sort(uint64_t *res, const uint64_t *T){ + int i, j, iMin; + if (SIZE <= 0) return -1; - for (int i = 0 ; i < SIZE ; i++) + for (i = 0 ; i < SIZE ; i++) res[i] = T[i]; - for (int j = 0 ; j < SIZE ; j++){ - int i; - int iMin = j; + for (j = 0 ; j < SIZE ; j++){ + iMin = j; for (i = j+1 ; i < SIZE ; i++) if (res[i] < res[iMin]) iMin = i; @@ -38,17 +39,19 @@ int select_sort(uint64_t *res, const uint64_t *T){ int main(void){ uint64_t T[SIZE]; uint64_t res[SIZE]; + uint64_t max; + int i; srand(42); - for (int i = 0 ; i < SIZE ; i++) + for (i = 0 ; i < SIZE ; i++) T[i] = randlong(); /* Sorting the table */ if (select_sort(res, T) < 0) return -1; /* Computing max(T) */ - uint64_t max = T[0]; - for (int i = 1 ; i < SIZE ; i++) + max = T[0]; + for (i = 1 ; i < SIZE ; i++) if (T[i] > max) max = T[i]; diff --git a/test/mppa/sort/test.c b/test/mppa/sort/test.c deleted file mode 100644 index e5e14fef..00000000 --- a/test/mppa/sort/test.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "../lib/prng.h" -#include "../lib/types.h" - -#include "test.h" -#include "insertion.h" -#include "selection.h" -#include "merge.h" - -int main(void){ - uint64_t T[SIZE]; - uint64_t res1[SIZE], res2[SIZE], res3[SIZE]; - srand(42); - - for (int i = 0 ; i < SIZE ; i++) - T[i] = randlong(); - - /* insertion sort */ - if (insert_sort(res1, T) < 0) return -1; - - /* selection sort */ - if (select_sort(res2, T) < 0) return -2; - - /* merge sort */ - if (merge_sort(res3, T) < 0) return -3; - - /* We should have: res1[i] == res2[i] == res3[i] */ - for (int i = 0 ; i < SIZE ; i++){ - if (!(res1[i] == res2[i] && res2[i] == res3[i])) - return -4; - } - - return 0; -} -- cgit 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 From 0c28f0900dae418d5beed6a82f7c72f88de83567 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 13 Nov 2018 13:44:55 +0100 Subject: Lancement des tests à partir d'un même script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/mppa/Makefile | 111 --------------------------------------------- test/mppa/check.sh | 6 +++ test/mppa/do_test.sh | 33 ++++++++++++++ test/mppa/instr/Makefile | 111 +++++++++++++++++++++++++++++++++++++++++++++ test/mppa/mmult/.gitignore | 6 +-- test/mppa/prng/.gitignore | 5 +- test/mppa/sort/.gitignore | 18 ++++---- test/mppa/test.sh | 6 +++ 8 files changed, 171 insertions(+), 125 deletions(-) delete mode 100644 test/mppa/Makefile create mode 100755 test/mppa/check.sh create mode 100644 test/mppa/do_test.sh create mode 100644 test/mppa/instr/Makefile create mode 100755 test/mppa/test.sh (limited to 'test/mppa') diff --git a/test/mppa/Makefile b/test/mppa/Makefile deleted file mode 100644 index 148b16b3..00000000 --- a/test/mppa/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -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))) - -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))) - -## -# Targets -## - -all: $(BIN) - -.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: -# 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) - $(K1CC) $(CFLAGS) -S $< -o $@ - -$(ASMDIR)/%.ccomp.s: $(SRCDIR)/%.c $(CCOMPPATH) - @mkdir -p $(@D) - $(CCOMP) $(CFLAGS) -S $< -o $@ diff --git a/test/mppa/check.sh b/test/mppa/check.sh new file mode 100755 index 00000000..8db50f1b --- /dev/null +++ b/test/mppa/check.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Tests the execution of the binaries produced by CompCert + +source do_test.sh + +do_test check diff --git a/test/mppa/do_test.sh b/test/mppa/do_test.sh new file mode 100644 index 00000000..ee7cbcf7 --- /dev/null +++ b/test/mppa/do_test.sh @@ -0,0 +1,33 @@ +do_test () { +cat << EOF + +## +# PRNG tests +## +EOF +(cd prng && make $1 -j8) + +cat << EOF + +## +# Matrix Multiplication tests +## +EOF +(cd mmult && make $1 -j8) + +cat << EOF + +## +# List sort tests +## +EOF +(cd sort && make $1 -j8) + +cat << EOF + +## +# Instruction unit tests +## +EOF +(cd instr && make $1 -j8) +} diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile new file mode 100644 index 00000000..4744ba23 --- /dev/null +++ b/test/mppa/instr/Makefile @@ -0,0 +1,111 @@ +K1CC ?= k1-mbr-gcc +CC ?= gcc +CCOMP ?= ccomp +CFLAGS ?= -O2 +SIMU ?= k1-cluster +TIMEOUT ?= 10s + +DIR=./ +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))) + +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))) + +## +# Targets +## + +all: $(BIN) + +.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: +# 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) + $(K1CC) $(CFLAGS) -S $< -o $@ + +$(ASMDIR)/%.ccomp.s: $(SRCDIR)/%.c $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) -S $< -o $@ diff --git a/test/mppa/mmult/.gitignore b/test/mppa/mmult/.gitignore index 5883d367..4d68861b 100644 --- a/test/mppa/mmult/.gitignore +++ b/test/mppa/mmult/.gitignore @@ -1,3 +1,3 @@ -mmult-test-k1c -mmult-test-x86 -test-ccomp +mmult-test-ccomp-k1c +mmult-test-gcc-k1c +mmult-test-gcc-x86 diff --git a/test/mppa/prng/.gitignore b/test/mppa/prng/.gitignore index 1879eaee..0792a78b 100644 --- a/test/mppa/prng/.gitignore +++ b/test/mppa/prng/.gitignore @@ -1,2 +1,3 @@ -prng-test-k1c -prng-test-x86 +prng-test-ccomp-k1c +prng-test-gcc-x86 +prng-test-gcc-k1c diff --git a/test/mppa/sort/.gitignore b/test/mppa/sort/.gitignore index c8f4f4e5..a8d6921c 100644 --- a/test/mppa/sort/.gitignore +++ b/test/mppa/sort/.gitignore @@ -1,9 +1,9 @@ -insertion-test-k1c -insertion-test-x86 -merge-test-k1c -selection-test-k1c -test-k1c -merge-test-x86 -selection-test-x86 -test-x86 -test-ccomp +main-test-ccomp-k1c +main-test-gcc-k1c +main-test-gcc-x86 +merge-test-gcc-k1c +merge-test-gcc-x86 +selection-test-gcc-k1c +selection-test-gcc-x86 +insertion-test-gcc-k1c +insertion-test-gcc-x86 diff --git a/test/mppa/test.sh b/test/mppa/test.sh new file mode 100755 index 00000000..dfeb153a --- /dev/null +++ b/test/mppa/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Tests the validity of the tests + +source do_test.sh + +do_test test -- cgit From 6e1ff91536ce40e16e0f6af7f2d032ffda2f752c Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 13 Nov 2018 18:15:42 +0100 Subject: Changed mmult to avoid recomputing + fixed potential source of bug in instr --- test/mppa/instr/Makefile | 6 +++--- test/mppa/mmult/.gitignore | 1 + test/mppa/mmult/Makefile | 53 ++++++++++++++++++++++++++++++---------------- 3 files changed, 39 insertions(+), 21 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 4744ba23..2be69db2 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -72,15 +72,15 @@ check: $(GCC_OUT) $(CCOMP_OUT) $(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin @mkdir -p $(@D) - timeout $(TIMEOUT) ./$< || { ret=$$?; } > $@; echo $$ret >> $@ + ret=0; timeout $(TIMEOUT) ./$< || { ret=$$?; } > $@; echo $$ret >> $@ $(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) @mkdir -p $(@D) - timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ $(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) @mkdir -p $(@D) - timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ # Assembly to binary diff --git a/test/mppa/mmult/.gitignore b/test/mppa/mmult/.gitignore index 4d68861b..c9cd4c65 100644 --- a/test/mppa/mmult/.gitignore +++ b/test/mppa/mmult/.gitignore @@ -1,3 +1,4 @@ mmult-test-ccomp-k1c mmult-test-gcc-k1c mmult-test-gcc-x86 +.zero diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index 2e077f5e..263ed276 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -2,49 +2,66 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 +SIMU ?= k1-cluster +TIMEOUT ?= 10s + +K1CCPATH=$(shell which $(K1CC)) +CCPATH=$(shell which $(CC)) +CCOMPPATH=$(shell which $(CCOMP)) +SIMUPATH=$(shell which $(SIMU)) PRNG=../prng/prng.c -ALL= mmult-test-gcc-x86 mmult-test-gcc-k1c mmult-test-ccomp-k1c\ +ALL= mmult-test-gcc-x86 mmult-test-gcc-k1c mmult-test-ccomp-k1c +CCOMP_OUT= mmult-test-ccomp-k1c.out +GCC_OUT= mmult-test-gcc-k1c.out +X86_GCC_OUT= mmult-test-gcc-x86.out +STUB_OUT=.zero all: $(ALL) -mmult-test-gcc-x86: mmult.c $(PRNG) +mmult-test-gcc-x86: mmult.c $(PRNG) $(CCPATH) $(CC) $(CFLAGS) $^ -o $@ -mmult-test-gcc-k1c: mmult.c $(PRNG) +mmult-test-gcc-k1c: mmult.c $(PRNG) $(K1CCPATH) $(K1CC) $(CFLAGS) $^ -o $@ -mmult-test-ccomp-k1c: mmult.c $(PRNG) +mmult-test-ccomp-k1c: mmult.c $(PRNG) $(CCOMPPATH) $(CCOMP) $(CFLAGS) $^ -o $@ +.SECONDARY: +%k1c.out: %k1c $(SIMUPATH) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ + +%x86.out: %x86 + ret=0; timeout $(TIMEOUT) ./$< || { ret=$$?; } > $@; echo $$ret >> $@ + +.zero: + @echo "0" > $@ + .PHONY: test: test-x86 test-k1c .PHONY: -test-x86: mmult-test-gcc-x86 - @if ! ./$<; then\ +test-x86: $(X86_GCC_OUT) $(STUB_OUT) + @if ! diff $< $(STUB_OUT); then\ >&2 echo "ERROR x86: $< failed";\ else\ - echo "x86: Test $< succeeded";\ + echo "GOOD x86: $< succeeded";\ fi .PHONY: -test-k1c: mmult-test-gcc-k1c - @if ! k1-cluster -- ./$<; then\ +test-k1c: $(GCC_OUT) $(STUB_OUT) + @if ! diff $< $(STUB_OUT); then\ >&2 echo "ERROR k1c: $< failed";\ else\ - echo "k1c: Test $< succeeded";\ + echo "GOOD k1c: $< succeeded";\ fi .PHONY: -check: mmult-test-ccomp-k1c - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR k1c: mmult $< failed";\ +check: $(CCOMP_OUT) $(STUB_OUT) + @if ! diff $< $(STUB_OUT); then\ + >&2 echo "ERROR k1c: $< failed";\ else\ - echo "k1c: Test mmult $< succeeded";\ + echo "GOOD k1c: $< succeeded";\ fi - -.PHONY: -clean: - rm -f $(ALL) -- cgit From 154230f3d9cad4f8de59e8fcaa9d0fe4ae151a98 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 14 Nov 2018 11:18:45 +0100 Subject: Updated Sort Makefile + fixed compilation command bug --- test/mppa/.gitignore | 19 ++++++++++ test/mppa/instr/Makefile | 6 ++-- test/mppa/mmult/Makefile | 10 +++--- test/mppa/prng/Makefile | 58 ++++++++++++++++++++---------- test/mppa/sort/Makefile | 92 ++++++++++++++++++++++++++++++------------------ 5 files changed, 123 insertions(+), 62 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/.gitignore b/test/mppa/.gitignore index f03fc12c..e8ebeff8 100644 --- a/test/mppa/.gitignore +++ b/test/mppa/.gitignore @@ -1 +1,20 @@ check +asm_coverage +instr/Makefile +mmult/Makefile +prng/Makefile +sort/Makefile +prng/.zero +sort/.zero +sort/insertion-ccomp-k1c +sort/insertion-gcc-k1c +sort/insertion-gcc-x86 +sort/main-ccomp-k1c +sort/main-gcc-k1c +sort/main-gcc-x86 +sort/merge-ccomp-k1c +sort/merge-gcc-k1c +sort/merge-gcc-x86 +sort/selection-ccomp-k1c +sort/selection-gcc-k1c +sort/selection-gcc-x86 diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 2be69db2..89ff9a73 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -72,15 +72,15 @@ check: $(GCC_OUT) $(CCOMP_OUT) $(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin @mkdir -p $(@D) - ret=0; timeout $(TIMEOUT) ./$< || { ret=$$?; } > $@; echo $$ret >> $@ + ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ $(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) @mkdir -p $(@D) - ret=0; timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ $(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) @mkdir -p $(@D) - ret=0; timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ # Assembly to binary diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index 263ed276..cf82e359 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -21,20 +21,20 @@ STUB_OUT=.zero all: $(ALL) mmult-test-gcc-x86: mmult.c $(PRNG) $(CCPATH) - $(CC) $(CFLAGS) $^ -o $@ + $(CC) $(CFLAGS) $(filter-out $(CCPATH),$^) -o $@ mmult-test-gcc-k1c: mmult.c $(PRNG) $(K1CCPATH) - $(K1CC) $(CFLAGS) $^ -o $@ + $(K1CC) $(CFLAGS) $(filter-out $(K1CCPATH),$^) -o $@ mmult-test-ccomp-k1c: mmult.c $(PRNG) $(CCOMPPATH) - $(CCOMP) $(CFLAGS) $^ -o $@ + $(CCOMP) $(CFLAGS) $(filter-out $(CCOMPPATH),$^) -o $@ .SECONDARY: %k1c.out: %k1c $(SIMUPATH) - ret=0; timeout $(TIMEOUT) $(SIMU) -- $< || { ret=$$?; } > $@; echo $$ret >> $@ + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ %x86.out: %x86 - ret=0; timeout $(TIMEOUT) ./$< || { ret=$$?; } > $@; echo $$ret >> $@ + ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ .zero: @echo "0" > $@ diff --git a/test/mppa/prng/Makefile b/test/mppa/prng/Makefile index 481a3fca..5580cd8e 100644 --- a/test/mppa/prng/Makefile +++ b/test/mppa/prng/Makefile @@ -2,46 +2,66 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 +SIMU ?= k1-cluster +TIMEOUT ?= 10s -all: prng-test-gcc-x86 prng-test-gcc-k1c prng-test-ccomp-k1c +K1CCPATH=$(shell which $(K1CC)) +CCPATH=$(shell which $(CC)) +CCOMPPATH=$(shell which $(CCOMP)) +SIMUPATH=$(shell which $(SIMU)) -prng-test-gcc-x86: prng.c +ALL= prng-test-gcc-x86 prng-test-gcc-k1c prng-test-ccomp-k1c +CCOMP_OUT= prng-test-ccomp-k1c.out +GCC_OUT= prng-test-gcc-k1c.out +X86_GCC_OUT= prng-test-gcc-x86.out +STUB_OUT=.zero + +all: $(ALL) + +prng-test-gcc-x86: prng.c $(CCPATH) $(CC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ -prng-test-gcc-k1c: prng.c +prng-test-gcc-k1c: prng.c $(K1CCPATH) $(K1CC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ -prng-test-ccomp-k1c: prng.c +prng-test-ccomp-k1c: prng.c $(CCOMPPATH) $(CCOMP) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ +.SECONDARY: +%k1c.out: %k1c $(SIMUPATH) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + +%x86.out: %x86 + ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +.zero: + @echo "0" > $@ + .PHONY: test: test-x86 test-k1c .PHONY: -test-x86: prng-test-gcc-x86 - @if ! ./$<; then\ - >&2 echo "ERROR: $< failed";\ - exit;\ +test-x86: $(X86_GCC_OUT) $(STUB_OUT) + @if ! diff $< $(STUB_OUT); then\ + >&2 echo "ERROR x86: $< failed";\ else\ - echo "$< Succeeded";\ + echo "GOOD x86: $< succeeded";\ fi .PHONY: -test-k1c: prng-test-gcc-k1c - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR: $< failed";\ - exit;\ +test-k1c: $(GCC_OUT) $(STUB_OUT) + @if ! diff $< $(STUB_OUT); then\ + >&2 echo "ERROR k1c: $< failed";\ else\ - echo "$< Succeeded";\ + echo "GOOD k1c: $< succeeded";\ fi .PHONY: -check: prng-test-ccomp-k1c - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR: $< failed";\ - exit;\ +check: $(CCOMP_OUT) $(STUB_OUT) + @if ! diff $< $(STUB_OUT); then\ + >&2 echo "ERROR k1c: $< failed";\ else\ - echo "$< Succeeded";\ + echo "GOOD k1c: $< succeeded";\ fi .PHONY: diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index c0c9347d..ebbad5b5 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -2,54 +2,78 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 +SIMU ?= k1-cluster +TIMEOUT ?= 10s + +K1CCPATH=$(shell which $(K1CC)) +CCPATH=$(shell which $(CC)) +CCOMPPATH=$(shell which $(CCOMP)) +SIMUPATH=$(shell which $(SIMU)) PRNG=../prng/prng.c CFILES=insertion.c merge.c selection.c main.c -ALL= insertion-test-gcc-x86 insertion-test-gcc-k1c\ - selection-test-gcc-x86 selection-test-gcc-k1c\ - merge-test-gcc-x86 merge-test-gcc-k1c\ - main-test-gcc-x86 main-test-gcc-k1c\ - main-test-ccomp-k1c +ALL= insertion-gcc-x86 insertion-gcc-k1c insertion-ccomp-k1c\ + selection-gcc-x86 selection-gcc-k1c selection-ccomp-k1c\ + merge-gcc-x86 merge-gcc-k1c merge-ccomp-k1c\ + main-gcc-x86 main-gcc-k1c main-ccomp-k1c + +CCOMP_OUT= insertion-ccomp-k1c.out selection-ccomp-k1c.out merge-ccomp-k1c.out\ + main-ccomp-k1c.out +GCC_OUT= insertion-gcc-k1c.out selection-gcc-k1c.out merge-gcc-k1c.out\ + main-gcc-k1c.out +X86_GCC_OUT= insertion-gcc-x86.out selection-gcc-x86.out merge-gcc-x86.out\ + main-gcc-x86.out +STUB_OUT= .zero all: $(ALL) -main-test-gcc-x86: $(CFILES) $(PRNG) - $(CC) $(CFLAGS) $^ -o $@ +main-gcc-x86: $(CFILES) $(PRNG) $(CCPATH) + $(CC) $(CFLAGS) $(filter-out $(CCPATH),$^) -o $@ + +%-gcc-x86: %.c $(PRNG) $(CCPATH) + $(CC) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $(filter-out $(CCPATH),$^) -o $@ -%-test-gcc-x86: %.c $(PRNG) - $(CC) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $^ -o $@ +main-gcc-k1c: $(CFILES) $(PRNG) $(CCPATH) + $(K1CC) $(CFLAGS) $(filter-out $(CCPATH),$^) -o $@ -main-test-gcc-k1c: $(CFILES) $(PRNG) - $(K1CC) $(CFLAGS) $^ -o $@ +%-gcc-k1c: %.c $(PRNG) $(K1CCPATH) + $(K1CC) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $(filter-out $(K1CCPATH),$^) -o $@ -%-test-gcc-k1c: %.c $(PRNG) - $(K1CC) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $^ -o $@ +main-ccomp-k1c: $(CFILES) $(PRNG) $(CCOMPPATH) + $(CCOMP) $(CFLAGS) $(filter-out $(CCOMPPATH),$^) -o $@ -main-test-ccomp-k1c: $(CFILES) $(PRNG) - $(CCOMP) $(CFLAGS) $^ -o $@ +%-ccomp-k1c: %.c $(PRNG) $(CCOMPPATH) + $(CCOMP) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $(filter-out $(CCOMPPATH),$^) -o $@ -%-test-ccomp-k1c: %.c $(PRNG) - $(CCOMP) -D__UNIT_TEST_$$(echo $(basename $<) | tr a-z A-Z)__ $(CFLAGS) $^ -o $@ +.SECONDARY: +%x86.out: %x86 + ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +%k1c.out: %k1c $(SIMUPATH) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + +.zero: + @echo "0" > $@ .PHONY: -test-x86: insertion-test-gcc-x86 selection-test-gcc-x86 merge-test-gcc-x86 main-test-gcc-x86 - @for test in $^; do\ - if ! ./$$test; then\ +test-x86: $(STUB_OUT) $(X86_GCC_OUT) + @for test in $(wordlist 2,100,$^); do\ + if ! diff $$test $(STUB_OUT); then\ >&2 echo "ERROR x86: $$test failed";\ else\ - echo "x86: Test $$test Succeeded";\ + echo "GOOD x86: $$test succeeded";\ fi;\ done .PHONY: -test-k1c: insertion-test-gcc-k1c selection-test-gcc-k1c merge-test-gcc-k1c main-test-gcc-k1c - @for test in $^; do\ - if ! k1-cluster -- ./$$test; then\ +test-k1c: $(STUB_OUT) $(GCC_OUT) + @for test in $(wordlist 2,100,$^); do\ + if ! diff $$test $(STUB_OUT); then\ >&2 echo "ERROR k1c: $$test failed";\ else\ - echo "k1c: Test $$test Succeeded";\ + echo "GOOD k1c: $$test succeeded";\ fi;\ done @@ -57,13 +81,11 @@ test-k1c: insertion-test-gcc-k1c selection-test-gcc-k1c merge-test-gcc-k1c main- test: test-x86 test-k1c .PHONY: -check: main-test-ccomp-k1c - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR k1c: sort $< failed";\ - else\ - echo "k1c: Test sort $< succeeded";\ - fi - -.PHONY: -clean: - rm -f $(ALL) +check: $(STUB_OUT) $(CCOMP_OUT) + @for test in $(wordlist 2,100,$^); do\ + if ! diff $$test $(STUB_OUT); then\ + >&2 echo "ERROR k1c: $$test failed";\ + else\ + echo "GOOD k1c: $$test succeeded";\ + fi;\ + done -- cgit From bdaa3eb0ad6486186519ba1ba574e8ac92505cf0 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 21 Nov 2018 17:03:24 +0100 Subject: Mise à jour vis à vis de CompCert 3.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/mppa/instr/Makefile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 89ff9a73..34b5e9ec 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -3,7 +3,7 @@ CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 SIMU ?= k1-cluster -TIMEOUT ?= 10s +TIMEOUT ?= --signal=SIGTERM 20s DIR=./ SRCDIR=$(DIR) @@ -37,7 +37,7 @@ BIN=$(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.bin,$(TESTNAMES)))\ all: $(BIN) -.PHONY: +.PHONY: test: $(X86_GCC_OUT) $(GCC_OUT) @echo "Comparing x86 gcc output to k1 gcc.." @for test in $(TESTNAMES); do\ @@ -70,6 +70,20 @@ check: $(GCC_OUT) $(CCOMP_OUT) .SECONDARY: # Generating output +## Version sans les timeout +#$(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin +# @mkdir -p $(@D) +# ./$< > $@; echo $$? >> $@ +# +#$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) +# @mkdir -p $(@D) +# $(SIMU) -- $< > $@ ; echo $$? >> $@ +# +#$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) +# @mkdir -p $(@D) +# $(SIMU) -- $< > $@ ; echo $$? >> $@ + +## Version avec timeout $(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ -- cgit From 0b9d1deb832dc93ce381f15f8e9774973f45e56e Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 23 Nov 2018 18:05:06 +0100 Subject: Fixed andd test not consistent with the rest --- test/mppa/instr/andd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/andd.c b/test/mppa/instr/andd.c index 4f503764..5a2c7863 100644 --- a/test/mppa/instr/andd.c +++ b/test/mppa/instr/andd.c @@ -1,5 +1,5 @@ #include "framework.h" BEGIN_TEST(long long) - return a&b; + c = a&b; END_TEST() -- cgit From f17faa9e318cb6e6c75b3c22387f13e57a9828f7 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 23 Nov 2018 18:06:26 +0100 Subject: Interoperability tests passed (no va_arg yet) --- test/mppa/do_test.sh | 8 ++ test/mppa/interop/.gitignore | 1 + test/mppa/interop/Makefile | 166 +++++++++++++++++++++++++++++++++++++ test/mppa/interop/common.c | 62 ++++++++++++++ test/mppa/interop/common.h | 24 ++++++ test/mppa/interop/framework.h | 37 +++++++++ test/mppa/interop/i_manyiargs.c | 9 ++ test/mppa/interop/i_multiiargs.c | 6 ++ test/mppa/interop/i_oneiarg.c | 6 ++ test/mppa/interop/ll_manyllargs.c | 8 ++ test/mppa/interop/ll_multillargs.c | 7 ++ test/mppa/interop/ll_onellarg.c | 7 ++ test/mppa/interop/ll_void.c | 7 ++ test/mppa/interop/void_void.c | 7 ++ 14 files changed, 355 insertions(+) create mode 100644 test/mppa/interop/.gitignore create mode 100644 test/mppa/interop/Makefile create mode 100644 test/mppa/interop/common.c create mode 100644 test/mppa/interop/common.h create mode 100644 test/mppa/interop/framework.h create mode 100644 test/mppa/interop/i_manyiargs.c create mode 100644 test/mppa/interop/i_multiiargs.c create mode 100644 test/mppa/interop/i_oneiarg.c create mode 100644 test/mppa/interop/ll_manyllargs.c create mode 100644 test/mppa/interop/ll_multillargs.c create mode 100644 test/mppa/interop/ll_onellarg.c create mode 100644 test/mppa/interop/ll_void.c create mode 100644 test/mppa/interop/void_void.c (limited to 'test/mppa') diff --git a/test/mppa/do_test.sh b/test/mppa/do_test.sh index ee7cbcf7..add87b66 100644 --- a/test/mppa/do_test.sh +++ b/test/mppa/do_test.sh @@ -30,4 +30,12 @@ cat << EOF ## EOF (cd instr && make $1 -j8) + +cat << EOF + +## +# Interoperability with GCC +## +EOF +(cd interop && make $1 -j8) } diff --git a/test/mppa/interop/.gitignore b/test/mppa/interop/.gitignore new file mode 100644 index 00000000..ea1472ec --- /dev/null +++ b/test/mppa/interop/.gitignore @@ -0,0 +1 @@ +output/ diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile new file mode 100644 index 00000000..18efaa24 --- /dev/null +++ b/test/mppa/interop/Makefile @@ -0,0 +1,166 @@ +K1CC ?= k1-mbr-gcc +CC ?= gcc +CCOMP ?= ccomp +CFLAGS ?= -O2 +SIMU ?= k1-cluster +TIMEOUT ?= --signal=SIGTERM 20s + +DIR=./ +SRCDIR=$(DIR) +OUTDIR=$(DIR)/out +BINDIR=$(DIR)/bin +ASMDIR=$(DIR)/asm +OBJDIR=$(DIR)/obj +COMMON=common + +## +# Intended flow : .c -> .gcc.s -> .gcc.o -> .gcc.bin -> .gcc.out +# -> .ccomp.s -> .ccomp.o -> .ccomp.bin -> .ccomp.out +# -> .x86-gcc.s -> .x86-gcc.o -> .x86-gcc.bin -> .x86-gcc.out +# +# The .o -> .bin part uses $(COMMON).gcc.o or $(COMMON).x86-gcc.o depending on the architecture +## + +K1CCPATH=$(shell which $(K1CC)) +CCPATH=$(shell which $(CC)) +CCOMPPATH=$(shell which $(CCOMP)) +SIMUPATH=$(shell which $(SIMU)) + +TESTNAMES=$(filter-out $(COMMON),$(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))) + +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))) + +## +# Targets +## + +all: $(BIN) + +.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: + +## +# Generating output +## + +## Version sans les timeout +#$(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin +# @mkdir -p $(@D) +# ./$< > $@; echo $$? >> $@ +# +#$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) +# @mkdir -p $(@D) +# $(SIMU) -- $< > $@ ; echo $$? >> $@ +# +#$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) +# @mkdir -p $(@D) +# $(SIMU) -- $< > $@ ; echo $$? >> $@ + +## Version avec timeout +$(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + +## +# Object to binary +## + +$(BINDIR)/$(COMMON).x86-gcc.bin: $(OBJDIR)/$(COMMON).x86-gcc.o $(CCPATH) + @mkdir -p $(@D) + $(CC) $(CFLAGS) $< -o $@ + +$(BINDIR)/$(COMMON).gcc.bin: $(OBJDIR)/$(COMMON).gcc.o $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) $< -o $@ + +$(BINDIR)/$(COMMON).ccomp.bin: $(OBJDIR)/$(COMMON).ccomp.o $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) $< -o $@ + +$(BINDIR)/%.x86-gcc.bin: $(OBJDIR)/%.x86-gcc.o $(OBJDIR)/$(COMMON).x86-gcc.o $(CCPATH) + @mkdir -p $(@D) + $(CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + +$(BINDIR)/%.gcc.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(COMMON).gcc.o $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + +$(BINDIR)/%.ccomp.bin: $(OBJDIR)/%.ccomp.o $(OBJDIR)/$(COMMON).ccomp.o $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + +## +# Assembly to object +## + +$(OBJDIR)/%.x86-gcc.o: $(ASMDIR)/%.x86-gcc.s $(CCPATH) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) $< -o $@ + +$(OBJDIR)/%.gcc.o: $(ASMDIR)/%.gcc.s $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) -c $(CFLAGS) $< -o $@ + +$(OBJDIR)/%.ccomp.o: $(ASMDIR)/%.ccomp.s $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) -c $(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) + $(K1CC) $(CFLAGS) -S $< -o $@ + +$(ASMDIR)/%.ccomp.s: $(SRCDIR)/%.c $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) -S $< -o $@ diff --git a/test/mppa/interop/common.c b/test/mppa/interop/common.c new file mode 100644 index 00000000..e3eea128 --- /dev/null +++ b/test/mppa/interop/common.c @@ -0,0 +1,62 @@ +#define STACK int a[100];\ + a[42] = 42; + +#define ONEARG_OP(arg) (3*arg+2) + +#define MULTIARG_OP(arg1, arg2, arg3, arg4) (arg1 ^ arg2 << arg3 - arg4) + +#define MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,\ + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,\ + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)\ + (a0 + a1 * a2 + a3 * a4 + a5 + a6 + a7 - a8 + a9 +\ + a10 + a11 - a12 ^ a13 + a14 - a15 + a16 ^ a17 + a18 + a19 +\ + a20 + a21 + a22 * a23 + a24 + a25 << a26 & a27 + a28 + a29) + +void void_void(){ + STACK; +} + +long long ll_void(){ + STACK; + return 0xdeadbeefdeadbeefULL; +} + +int i_oneiarg(int arg){ + STACK; + return ONEARG_OP(arg); +} + +int i_multiiargs(int arg1, char arg2, char arg3, int arg4){ + STACK; + return MULTIARG_OP(arg1, arg2, arg3, arg4); +} + +int i_manyiargs(char a0, int a1, char a2, int a3, char a4, char a5, int a6, int a7, char a8, int a9, + char a10, int a11, char a12, int a13, char a14, char a15, int a16, int a17, char a18, int a19, + char a20, int a21, char a22, int a23, char a24, char a25, int a26, int a27, char a28, int a29) +{ + STACK; + return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29); +} + +int ll_onellarg(long long arg){ + STACK; + return ONEARG_OP(arg); +} + +long long ll_multillargs(long long arg1, char arg2, char arg3, long long arg4){ + STACK; + return MULTIARG_OP(arg1, arg2, arg3, arg4); +} + +long long ll_manyllargs(char a0, long long a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, + char a10, long long a11, char a12, long long a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, + char a20, long long a21, char a22, long long a23, char a24, char a25, long long a26, long long a27, char a28, long long a29) +{ + STACK; + return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29); +} diff --git a/test/mppa/interop/common.h b/test/mppa/interop/common.h new file mode 100644 index 00000000..7b381671 --- /dev/null +++ b/test/mppa/interop/common.h @@ -0,0 +1,24 @@ +#ifndef __COMMON_H__ +#define __COMMON_H__ + +void void_void(void); + +long long ll_void(void); + +int i_oneiarg(int arg); + +int i_multiiargs(int arg1, char arg2, char arg3, int arg4); + +int i_manyiargs(char a0, int a1, char a2, int a3, char a4, char a5, int a6, int a7, char a8, int a9, + char a10, int a11, char a12, int a13, char a14, char a15, int a16, int a17, char a18, int a19, + char a20, int a21, char a22, int a23, char a24, char a25, int a26, int a27, char a28, int a29); + +int ll_onellarg(long long arg); + +long long ll_multillargs(long long arg1, char arg2, char arg3, long long arg4); + +long long ll_manyllargs(char a0, long long a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, + char a10, long long a11, char a12, long long a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, + char a20, long long a21, char a22, long long a23, char a24, char a25, long long a26, long long a27, char a28, long long a29); + +#endif diff --git a/test/mppa/interop/framework.h b/test/mppa/interop/framework.h new file mode 100644 index 00000000..52ba97bc --- /dev/null +++ b/test/mppa/interop/framework.h @@ -0,0 +1,37 @@ +#ifndef __FRAMEWORK_H__ +#define __FRAMEWORK_H__ + +#include "../prng/prng.c" + +#define BEGIN_TEST_N(type, N)\ + int main(void){\ + type t[N], c, i, j, S;\ + srand(0);\ + S = 0;\ + for (i = 0 ; i < 100 ; i++){\ + c = randlong();\ + for (j = 0 ; j < N ; j++)\ + t[j] = randlong();\ + /* END BEGIN_TEST_N */ + +#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/interop/i_manyiargs.c b/test/mppa/interop/i_manyiargs.c new file mode 100644 index 00000000..d674c26f --- /dev/null +++ b/test/mppa/interop/i_manyiargs.c @@ -0,0 +1,9 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(int) + c = i_manyiargs(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, + -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, + -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); +END_TEST() + diff --git a/test/mppa/interop/i_multiiargs.c b/test/mppa/interop/i_multiiargs.c new file mode 100644 index 00000000..0e8c8936 --- /dev/null +++ b/test/mppa/interop/i_multiiargs.c @@ -0,0 +1,6 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(int) + c = i_multiiargs(a, b, a-b, a+b); +END_TEST() diff --git a/test/mppa/interop/i_oneiarg.c b/test/mppa/interop/i_oneiarg.c new file mode 100644 index 00000000..42cd1540 --- /dev/null +++ b/test/mppa/interop/i_oneiarg.c @@ -0,0 +1,6 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(int) + c = i_oneiarg(a); +END_TEST() diff --git a/test/mppa/interop/ll_manyllargs.c b/test/mppa/interop/ll_manyllargs.c new file mode 100644 index 00000000..6e0b3b36 --- /dev/null +++ b/test/mppa/interop/ll_manyllargs.c @@ -0,0 +1,8 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = ll_manyllargs(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, + -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, + -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); +END_TEST() diff --git a/test/mppa/interop/ll_multillargs.c b/test/mppa/interop/ll_multillargs.c new file mode 100644 index 00000000..edb03b12 --- /dev/null +++ b/test/mppa/interop/ll_multillargs.c @@ -0,0 +1,7 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = ll_multillargs(a, b, a-b, a+b); +END_TEST() + diff --git a/test/mppa/interop/ll_onellarg.c b/test/mppa/interop/ll_onellarg.c new file mode 100644 index 00000000..0d182166 --- /dev/null +++ b/test/mppa/interop/ll_onellarg.c @@ -0,0 +1,7 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = ll_onellarg(a); +END_TEST() + diff --git a/test/mppa/interop/ll_void.c b/test/mppa/interop/ll_void.c new file mode 100644 index 00000000..fa350c9b --- /dev/null +++ b/test/mppa/interop/ll_void.c @@ -0,0 +1,7 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = ll_void(); + c += a; +END_TEST() diff --git a/test/mppa/interop/void_void.c b/test/mppa/interop/void_void.c new file mode 100644 index 00000000..e729edb2 --- /dev/null +++ b/test/mppa/interop/void_void.c @@ -0,0 +1,7 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + void_void(); + c = a; +END_TEST() -- cgit From 309db6bc63539f2ba10c0cd4088ef3ac2e237551 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 27 Nov 2018 17:17:47 +0100 Subject: Added tests where GCC calls CompCert functions --- test/mppa/instr/Makefile | 2 +- test/mppa/interop/Makefile | 27 ++++++++++++++++++++++----- test/mppa/mmult/Makefile | 2 +- test/mppa/prng/Makefile | 2 +- test/mppa/sort/Makefile | 2 +- 5 files changed, 26 insertions(+), 9 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 34b5e9ec..27449e88 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -2,7 +2,7 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -SIMU ?= k1-cluster +SIMU ?= k1-mppa TIMEOUT ?= --signal=SIGTERM 20s DIR=./ diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile index 18efaa24..ed3bd23f 100644 --- a/test/mppa/interop/Makefile +++ b/test/mppa/interop/Makefile @@ -2,7 +2,7 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -SIMU ?= k1-cluster +SIMU ?= k1-mppa TIMEOUT ?= --signal=SIGTERM 20s DIR=./ @@ -29,12 +29,14 @@ SIMUPATH=$(shell which $(SIMU)) TESTNAMES=$(filter-out $(COMMON),$(notdir $(subst .c,,$(wildcard $(DIR)/*.c)))) X86_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .x86-gcc.out,$(TESTNAMES))) GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.out,$(TESTNAMES))) +GCC_REV_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.out,$(TESTNAMES))) CCOMP_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.out,$(TESTNAMES))) -OUT=$(X86_GCC_OUT) $(GCC_OUT) $(CCOMP_OUT) +OUT=$(X86_GCC_OUT) $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) BIN=$(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.bin,$(TESTNAMES)))\ $(addprefix $(BINDIR)/,$(addsuffix .gcc.bin,$(TESTNAMES)))\ - $(addprefix $(BINDIR)/,$(addsuffix .ccomp.bin,$(TESTNAMES))) + $(addprefix $(BINDIR)/,$(addsuffix .ccomp.bin,$(TESTNAMES)))\ + $(addprefix $(BINDIR)/,$(addsuffix .gcc.rev.bin,$(TESTNAMES))) ## # Targets @@ -56,16 +58,22 @@ test: $(X86_GCC_OUT) $(GCC_OUT) done .PHONY: -check: $(GCC_OUT) $(CCOMP_OUT) +check: $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) @echo "Comparing k1 gcc output to ccomp.." @for test in $(TESTNAMES); do\ gccout=$(OUTDIR)/$$test.gcc.out;\ ccompout=$(OUTDIR)/$$test.ccomp.out;\ + gccrevout=$(OUTDIR)/$$test.gcc.rev.out;\ if ! diff $$ccompout $$gccout; then\ >&2 echo "ERROR: $$ccompout and $$gccout differ";\ else\ echo "GOOD: $$ccompout and $$gccout concur";\ fi;\ + if ! diff $$gccrevout $$gccout; then\ + >&2 echo "ERROR: $$gccrevout and $$gccout differ";\ + else\ + echo "GOOD: $$gccrevout and $$gccout concur";\ + fi;\ done ## @@ -100,6 +108,10 @@ $(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ +$(OUTDIR)/%.gcc.rev.out: $(BINDIR)/%.gcc.rev.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + $(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ @@ -128,10 +140,15 @@ $(BINDIR)/%.gcc.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(COMMON).gcc.o $(K1CCPATH) @mkdir -p $(@D) $(K1CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ -$(BINDIR)/%.ccomp.bin: $(OBJDIR)/%.ccomp.o $(OBJDIR)/$(COMMON).ccomp.o $(CCOMPPATH) +$(BINDIR)/%.gcc.rev.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(COMMON).ccomp.o $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + +$(BINDIR)/%.ccomp.bin: $(OBJDIR)/%.ccomp.o $(OBJDIR)/$(COMMON).gcc.o $(CCOMPPATH) @mkdir -p $(@D) $(CCOMP) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + ## # Assembly to object ## diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index cf82e359..5895ce3d 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -2,7 +2,7 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -SIMU ?= k1-cluster +SIMU ?= k1-mppa TIMEOUT ?= 10s K1CCPATH=$(shell which $(K1CC)) diff --git a/test/mppa/prng/Makefile b/test/mppa/prng/Makefile index 5580cd8e..4770c901 100644 --- a/test/mppa/prng/Makefile +++ b/test/mppa/prng/Makefile @@ -2,7 +2,7 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -SIMU ?= k1-cluster +SIMU ?= k1-mppa TIMEOUT ?= 10s K1CCPATH=$(shell which $(K1CC)) diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index ebbad5b5..5173528c 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -2,7 +2,7 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -SIMU ?= k1-cluster +SIMU ?= k1-mppa TIMEOUT ?= 10s K1CCPATH=$(shell which $(K1CC)) -- cgit From 5a26a29335042b2b7d841f04d74de3151ca8cc8d Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 28 Nov 2018 12:09:41 +0100 Subject: Added GCC-compcert call test with a very high register pressure --- test/mppa/do_test.sh | 10 +-- test/mppa/interop/Makefile | 2 +- test/mppa/interop/common.c | 197 +++++++++++++++++++++++++++++++++++++++++- test/mppa/interop/common.h | 4 + test/mppa/interop/stackhell.c | 8 ++ 5 files changed, 212 insertions(+), 9 deletions(-) create mode 100644 test/mppa/interop/stackhell.c (limited to 'test/mppa') diff --git a/test/mppa/do_test.sh b/test/mppa/do_test.sh index add87b66..41302116 100644 --- a/test/mppa/do_test.sh +++ b/test/mppa/do_test.sh @@ -5,7 +5,7 @@ cat << EOF # PRNG tests ## EOF -(cd prng && make $1 -j8) +(cd prng && make $1 -j4) cat << EOF @@ -13,7 +13,7 @@ cat << EOF # Matrix Multiplication tests ## EOF -(cd mmult && make $1 -j8) +(cd mmult && make $1 -j4) cat << EOF @@ -21,7 +21,7 @@ cat << EOF # List sort tests ## EOF -(cd sort && make $1 -j8) +(cd sort && make $1 -j4) cat << EOF @@ -29,7 +29,7 @@ cat << EOF # Instruction unit tests ## EOF -(cd instr && make $1 -j8) +(cd instr && make $1 -j4) cat << EOF @@ -37,5 +37,5 @@ cat << EOF # Interoperability with GCC ## EOF -(cd interop && make $1 -j8) +(cd interop && make $1 -j4) } diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile index ed3bd23f..5800ce9d 100644 --- a/test/mppa/interop/Makefile +++ b/test/mppa/interop/Makefile @@ -3,7 +3,7 @@ CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 SIMU ?= k1-mppa -TIMEOUT ?= --signal=SIGTERM 20s +TIMEOUT ?= --signal=SIGTERM 40s DIR=./ SRCDIR=$(DIR) diff --git a/test/mppa/interop/common.c b/test/mppa/interop/common.c index e3eea128..2b5f5b5e 100644 --- a/test/mppa/interop/common.c +++ b/test/mppa/interop/common.c @@ -51,12 +51,203 @@ long long ll_multillargs(long long arg1, char arg2, char arg3, long long arg4){ return MULTIARG_OP(arg1, arg2, arg3, arg4); } -long long ll_manyllargs(char a0, long long a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, - char a10, long long a11, char a12, long long a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, - char a20, long long a21, char a22, long long a23, char a24, char a25, long long a26, long long a27, char a28, long long a29) +long long ll_manyllargs(char a0, int a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, + char a10, long long a11, char a12, int a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, + char a20, int a21, char a22, long long a23, char a24, char a25, long long a26, int a27, char a28, long long a29) { STACK; return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29); } + +long long stackhell(char a0, int a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, + char a10, long long a11, char a12, int a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, + char a20, int a21, char a22, long long a23, char a24, char a25, long long a26, int a27, char a28, long long a29) +{ + long long b0 = a0; + long long b1 = a1 + b0; + long long b2 = a2 + b1; + int b3 = a3 + b2; + int b4 = a4 + b3; + int b5 = a5 + b4; + int b6 = a6 + b5; + int b7 = a7 + b6; + char b8 = a8 + b7; + char b9 = a9 + b8; + char b10 = a10 + b9; + char b11 = a11 + b10; + char b12 = a12 + b11; + int b13 = a13 + b12; + long long b14 = a14 + b13; + long long b15 = a15 + b14; + long long b16 = a16 + b15; + long long b17 = a17 + b16; + long long b18 = a18 + b17; + long long b19 = a19 + b18; + long long b20 = a20 + b19; + long long b21 = a21 + b20; + long long b22 = a22 + b21; + long long b23 = a23 + b22; + long long b24 = a24 + b23; + long long b25 = a25 + b24; + long long b26 = a26 + b25; + long long b27 = a27 + b26; + int b28 = a28 + b27; + int b29 = a29 + b28; + int b30 = b0 + b29; + int b31 = b1 + b30; + int b32 = b2 + b31; + char b33 = b3 + b32; + char b34 = b4 + b33; + char b35 = b5 + b34; + char b36 = b6 + b35; + char b37 = b7 + b36; + int b38 = b8 + b37; + int b39 = b9 + b38; + int b40 = b0 + b39; + int b41 = b1 + b40; + int b42 = b2 + b41; + int b43 = b3 + b42; + int b44 = b4 + b43; + int b45 = b5 + b44; + int b46 = b6 + b45; + int b47 = b7 + b46; + int b48 = b8 + b47; + long long b49 = b9 + b48; + long long b50 = b0 + b49; + long long b51 = b1 + b50; + long long b52 = b2 + b51; + long long b53 = b3 + b52; + long long b54 = b4 + b53; + long long b55 = b5 + b54; + long long b56 = b6 + b55; + long long b57 = b7 + b56; + int b58 = b8 + b57; + int b59 = b9 + b58; + int b60 = b0 + b59; + int b61 = b1 + b60; + int b62 = b2 + b61; + int b63 = b3 + b62; + int b64 = b4 + b63; + int b65 = b5 + b64; + int b66 = b6 + b65; + int b67 = b7 + b66; + int b68 = b8 + b67; + int b69 = b9 + b68; + char b70 = b0 + b69; + char b71 = b1 + b70; + char b72 = b2 + b71; + char b73 = b3 + b72; + char b74 = b4 + b73; + char b75 = b5 + b74; + char b76 = b6 + b75; + char b77 = b7 + b76; + char b78 = b8 + b77; + char b79 = b9 + b78; + char b80 = b0 + b79; + char b81 = b1 + b80; + char b82 = b2 + b81; + char b83 = b3 + b82; + char b84 = b4 + b83; + int b85 = b5 + b84; + int b86 = b6 + b85; + int b87 = b7 + b86; + int b88 = b8 + b87; + int b89 = b9 + b88; + int b90 = b0 + b89; + int b91 = b1 + b90; + int b92 = b2 + b91; + int b93 = b3 + b92; + int b94 = b4 + b93; + long long b95 = b5 + b94; + long long b96 = b6 + b95; + long long b97 = b7 + b96; + long long b98 = b8 + b97; + long long b99 = b9 + b98; + long long b100 = b0 + b99; + long long b101 = b1 + b100; + long long b102 = b2 + b101; + long long b103 = b3 + b102; + long long b104 = b4 + b103; + long long b105 = b5 + b104; + long long b106 = b6 + b105; + long long b107 = b7 + b106; + long long b108 = b8 + b107; + long long b109 = b9 + b108; + long long b110 = b0 + b109; + long long b111 = b1 + b110; + long long b112 = b2 + b111; + long long b113 = b3 + b112; + long long b114 = b4 + b113; + int b115 = b5 + b114; + int b116 = b6 + b115; + int b117 = b7 + b116; + int b118 = b8 + b117; + int b119 = b9 + b118; + int b120 = b0 + b119; + int b121 = b1 + b120; + int b122 = b2 + b121; + int b123 = b3 + b122; + int b124 = b4 + b123; + int b125 = b5 + b124; + char b126 = b6 + b125; + char b127 = b7 + b126; + char b128 = b8 + b127; + char b129 = b9 + b128; + char b130 = b0 + b129; + char b131 = b1 + b130; + char b132 = b2 + b131; + char b133 = b3 + b132; + char b134 = b4 + b133; + char b135 = b5 + b134; + char b136 = b6 + b135; + char b137 = b7 + b136; + char b138 = b8 + b137; + char b139 = b9 + b138; + char b140 = b0 + b139; + char b141 = b1 + b140; + char b142 = b2 + b141; + char b143 = b3 + b142; + char b144 = b4 + b143; + char b145 = b5 + b144; + char b146 = b6 + b145; + char b147 = b7 + b146; + int b148 = b8 + b147; + int b149 = b9 + b148; + int b150 = b0 + b149; + int b151 = b1 + b150; + int b152 = b2 + b151; + int b153 = b3 + b152; + int b154 = b4 + b153; + int b155 = b5 + b154; + int b156 = b6 + b155; + int b157 = b7 + b156; + int b158 = b8 + b157; + int b159 = b9 + b158; + int b160 = b0 + b159; + int b161 = b1 + b160; + int b162 = b2 + b161; + return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) + + b0 + b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8 + b9 + + b10 + b11 + b12 + b13 + b14 + b15 + b16 + b17 + b18 + b19 + + b20 + b21 + b22 + b23 + b24 + b25 + b26 + b27 + b28 + b29 + + b30 + b31 + b32 + b33 + b34 + b35 + b36 + b37 + b38 + b39 + + b40 + b41 + b42 + b43 + b44 + b45 + b46 + b47 + b48 + b49 + + b50 + b51 + b52 + b53 + b54 + b55 + b56 + b57 + b58 + b59 + + b60 + b61 + b62 + b63 + b64 + b65 + b66 + b67 + b68 + b69 + + b70 + b71 + b72 + b73 + b74 + b75 + b76 + b77 + b78 + b79 + + b80 + b81 + b82 + b83 + b84 + b85 + b86 + b87 + b88 + b89 + + b90 + b91 + b92 + b93 + b94 + b95 + b96 + b97 + b98 + b99 + + b100 + b101 + b102 + b103 + b104 + b105 + b106 + b107 + b108 + b109 + + b110 + b111 + b112 + b113 + b114 + b115 + b116 + b117 + b118 + b119 + + b120 + b121 + b122 + b123 + b124 + b125 + b126 + b127 + b128 + b129 + + b130 + b131 + b132 + b133 + b134 + b135 + b136 + b137 + b138 + b139 + + b140 + b141 + b142 + b143 + b144 + b145 + b146 + b147 + b148 + b149 + + b150 + b151 + b152 + b153 + b154 + b155 + b156 + b157 + b158 + b159 + + b160 + b161 + b162 + ; +} + diff --git a/test/mppa/interop/common.h b/test/mppa/interop/common.h index 7b381671..4e4a692a 100644 --- a/test/mppa/interop/common.h +++ b/test/mppa/interop/common.h @@ -21,4 +21,8 @@ long long ll_manyllargs(char a0, long long a1, char a2, long long a3, char a4, c char a10, long long a11, char a12, long long a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, char a20, long long a21, char a22, long long a23, char a24, char a25, long long a26, long long a27, char a28, long long a29); +long long stackhell(char a0, long long a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, + char a10, long long a11, char a12, long long a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, + char a20, long long a21, char a22, long long a23, char a24, char a25, long long a26, long long a27, char a28, long long a29); + #endif diff --git a/test/mppa/interop/stackhell.c b/test/mppa/interop/stackhell.c new file mode 100644 index 00000000..fbe7d56b --- /dev/null +++ b/test/mppa/interop/stackhell.c @@ -0,0 +1,8 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = stackhell(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, + -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, + -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); +END_TEST() -- cgit From 0ea925ecc01d3da88c1c2b8cb03b318af2720a92 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 28 Nov 2018 14:24:18 +0100 Subject: Added a jobs parameter to the test scripts --- test/mppa/check.sh | 2 +- test/mppa/delout.sh | 6 ++++++ test/mppa/do_test.sh | 10 +++++----- test/mppa/test.sh | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) create mode 100755 test/mppa/delout.sh (limited to 'test/mppa') diff --git a/test/mppa/check.sh b/test/mppa/check.sh index 8db50f1b..f25c3e31 100755 --- a/test/mppa/check.sh +++ b/test/mppa/check.sh @@ -3,4 +3,4 @@ source do_test.sh -do_test check +do_test check $1 diff --git a/test/mppa/delout.sh b/test/mppa/delout.sh new file mode 100755 index 00000000..e9c72e1c --- /dev/null +++ b/test/mppa/delout.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +for folder in prng mmult sort instr interop; do + rm -f $folder/*.out + rm -f $folder/out/* +done diff --git a/test/mppa/do_test.sh b/test/mppa/do_test.sh index 41302116..bb626203 100644 --- a/test/mppa/do_test.sh +++ b/test/mppa/do_test.sh @@ -5,7 +5,7 @@ cat << EOF # PRNG tests ## EOF -(cd prng && make $1 -j4) +(cd prng && make $1 -j$2) cat << EOF @@ -13,7 +13,7 @@ cat << EOF # Matrix Multiplication tests ## EOF -(cd mmult && make $1 -j4) +(cd mmult && make $1 -j$2) cat << EOF @@ -21,7 +21,7 @@ cat << EOF # List sort tests ## EOF -(cd sort && make $1 -j4) +(cd sort && make $1 -j$2) cat << EOF @@ -29,7 +29,7 @@ cat << EOF # Instruction unit tests ## EOF -(cd instr && make $1 -j4) +(cd instr && make $1 -j$2) cat << EOF @@ -37,5 +37,5 @@ cat << EOF # Interoperability with GCC ## EOF -(cd interop && make $1 -j4) +(cd interop && make $1 -j$2) } diff --git a/test/mppa/test.sh b/test/mppa/test.sh index dfeb153a..30806a6b 100755 --- a/test/mppa/test.sh +++ b/test/mppa/test.sh @@ -3,4 +3,4 @@ source do_test.sh -do_test test +do_test test $1 -- cgit From 30e8e1618e59bdb585b1fb36cddce41eefe12364 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 28 Nov 2018 17:31:46 +0100 Subject: Wrote some tests on va_arg, need to implement __compcert_va_int32 & cie --- test/mppa/interop/Makefile | 101 ++++++++++- test/mppa/interop/vaarg_common.c | 373 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 467 insertions(+), 7 deletions(-) create mode 100644 test/mppa/interop/vaarg_common.c (limited to 'test/mppa') diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile index 5800ce9d..f4dc259e 100644 --- a/test/mppa/interop/Makefile +++ b/test/mppa/interop/Makefile @@ -1,7 +1,7 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp -CFLAGS ?= -O2 +CFLAGS ?= -O2 -Wno-varargs SIMU ?= k1-mppa TIMEOUT ?= --signal=SIGTERM 40s @@ -12,6 +12,7 @@ BINDIR=$(DIR)/bin ASMDIR=$(DIR)/asm OBJDIR=$(DIR)/obj COMMON=common +VAARG_COMMON=vaarg_common ## # Intended flow : .c -> .gcc.s -> .gcc.o -> .gcc.bin -> .gcc.out @@ -19,6 +20,7 @@ COMMON=common # -> .x86-gcc.s -> .x86-gcc.o -> .x86-gcc.bin -> .x86-gcc.out # # The .o -> .bin part uses $(COMMON).gcc.o or $(COMMON).x86-gcc.o depending on the architecture +# There is also a $(VAARG_COMMON) that is the same than $(COMMON) but with va_arg ## K1CCPATH=$(shell which $(K1CC)) @@ -26,17 +28,28 @@ CCPATH=$(shell which $(CC)) CCOMPPATH=$(shell which $(CCOMP)) SIMUPATH=$(shell which $(SIMU)) -TESTNAMES=$(filter-out $(COMMON),$(notdir $(subst .c,,$(wildcard $(DIR)/*.c)))) +TESTNAMES=$(filter-out $(VAARG_COMMON),$(filter-out $(COMMON),$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))))) + X86_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .x86-gcc.out,$(TESTNAMES))) GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.out,$(TESTNAMES))) GCC_REV_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.out,$(TESTNAMES))) CCOMP_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.out,$(TESTNAMES))) -OUT=$(X86_GCC_OUT) $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) +VAARG_X86_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .x86-gcc.vaarg.out,$(TESTNAMES))) +VAARG_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.vaarg.out,$(TESTNAMES))) +VAARG_GCC_REV_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.vaarg.out,$(TESTNAMES))) +VAARG_CCOMP_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.vaarg.out,$(TESTNAMES))) + +OUT=$(X86_GCC_OUT) $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT)\ + $(VAARG_GCC_OUT) $(VAARG_GCC_OUT) $(VAARG_CCOMP_OUT) $(VAARG_GCC_REV_OUT) BIN=$(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.bin,$(TESTNAMES)))\ $(addprefix $(BINDIR)/,$(addsuffix .gcc.bin,$(TESTNAMES)))\ $(addprefix $(BINDIR)/,$(addsuffix .ccomp.bin,$(TESTNAMES)))\ - $(addprefix $(BINDIR)/,$(addsuffix .gcc.rev.bin,$(TESTNAMES))) + $(addprefix $(BINDIR)/,$(addsuffix .gcc.rev.bin,$(TESTNAMES)))\ + $(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.vaarg.bin,$(TESTNAMES)))\ + $(addprefix $(BINDIR)/,$(addsuffix .gcc.vaarg.bin,$(TESTNAMES)))\ + $(addprefix $(BINDIR)/,$(addsuffix .ccomp.vaarg.bin,$(TESTNAMES)))\ + $(addprefix $(BINDIR)/,$(addsuffix .gcc.rev.vaarg.bin,$(TESTNAMES))) ## # Targets @@ -45,25 +58,35 @@ BIN=$(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.bin,$(TESTNAMES)))\ all: $(BIN) .PHONY: -test: $(X86_GCC_OUT) $(GCC_OUT) +test: $(X86_GCC_OUT) $(GCC_OUT) $(VAARG_X86_GCC_OUT) $(VAARG_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;\ + 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";\ else\ echo "GOOD: $$x86out and $$gccout concur";\ fi;\ + if ! diff $$vaarg_x86out $$vaarg_gccout; then\ + >&2 echo "ERROR: $$vaarg_x86out and $$vaarg_gccout differ";\ + else\ + echo "GOOD: $$vaarg_x86out and $$vaarg_gccout concur";\ + fi;\ done .PHONY: -check: $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) +check: $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) $(VAARG_GCC_OUT) $(VAARG_CCOMP_OUT) $(VAARG_GCC_REV_OUT) @echo "Comparing k1 gcc output to ccomp.." @for test in $(TESTNAMES); do\ gccout=$(OUTDIR)/$$test.gcc.out;\ ccompout=$(OUTDIR)/$$test.ccomp.out;\ gccrevout=$(OUTDIR)/$$test.gcc.rev.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";\ else\ @@ -74,6 +97,16 @@ check: $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) else\ echo "GOOD: $$gccrevout and $$gccout concur";\ fi;\ + if ! diff $$vaarg_ccompout $$vaarg_gccout; then\ + >&2 echo "ERROR: $$vaarg_ccompout and $$vaarg_gccout differ";\ + else\ + echo "GOOD: $$vaarg_ccompout and $$vaarg_gccout concur";\ + fi;\ + if ! diff $$vaarg_gccrevout $$vaarg_gccout; then\ + >&2 echo "ERROR: $$vaarg_gccrevout and $$vaarg_gccout differ";\ + else\ + echo "GOOD: $$vaarg_gccrevout and $$vaarg_gccout concur";\ + fi;\ done ## @@ -99,7 +132,8 @@ check: $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) # @mkdir -p $(@D) # $(SIMU) -- $< > $@ ; echo $$? >> $@ -## Version avec timeout +## No vaarg + $(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ @@ -116,10 +150,30 @@ $(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ +## With vaarg + +$(OUTDIR)/%.x86-gcc.vaarg.out: $(BINDIR)/%.x86-gcc.vaarg.bin + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.gcc.vaarg.out: $(BINDIR)/%.gcc.vaarg.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.gcc.rev.vaarg.out: $(BINDIR)/%.gcc.rev.vaarg.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.ccomp.vaarg.out: $(BINDIR)/%.ccomp.vaarg.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + ## # Object to binary ## +## common + $(BINDIR)/$(COMMON).x86-gcc.bin: $(OBJDIR)/$(COMMON).x86-gcc.o $(CCPATH) @mkdir -p $(@D) $(CC) $(CFLAGS) $< -o $@ @@ -132,6 +186,22 @@ $(BINDIR)/$(COMMON).ccomp.bin: $(OBJDIR)/$(COMMON).ccomp.o $(CCOMPPATH) @mkdir -p $(@D) $(CCOMP) $(CFLAGS) $< -o $@ +## vaarg_common + +$(BINDIR)/$(VAARG_COMMON).x86-gcc.bin: $(OBJDIR)/$(VAARG_COMMON).x86-gcc.o $(CCPATH) + @mkdir -p $(@D) + $(CC) $(CFLAGS) $< -o $@ + +$(BINDIR)/$(VAARG_COMMON).gcc.bin: $(OBJDIR)/$(VAARG_COMMON).gcc.o $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) $< -o $@ + +$(BINDIR)/$(VAARG_COMMON).ccomp.bin: $(OBJDIR)/$(VAARG_COMMON).ccomp.o $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) $< -o $@ + +## no vaarg + $(BINDIR)/%.x86-gcc.bin: $(OBJDIR)/%.x86-gcc.o $(OBJDIR)/$(COMMON).x86-gcc.o $(CCPATH) @mkdir -p $(@D) $(CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ @@ -148,6 +218,23 @@ $(BINDIR)/%.ccomp.bin: $(OBJDIR)/%.ccomp.o $(OBJDIR)/$(COMMON).gcc.o $(CCOMPPATH @mkdir -p $(@D) $(CCOMP) $(CFLAGS) $(wordlist 1,2,$^) -o $@ +## with vaarg + +$(BINDIR)/%.x86-gcc.vaarg.bin: $(OBJDIR)/%.x86-gcc.o $(OBJDIR)/$(VAARG_COMMON).x86-gcc.o $(CCPATH) + @mkdir -p $(@D) + $(CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + +$(BINDIR)/%.gcc.vaarg.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(VAARG_COMMON).gcc.o $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + +$(BINDIR)/%.gcc.rev.vaarg.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(VAARG_COMMON).ccomp.o $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + +$(BINDIR)/%.ccomp.vaarg.bin: $(OBJDIR)/%.ccomp.o $(OBJDIR)/$(VAARG_COMMON).gcc.o $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) $(wordlist 1,2,$^) -o $@ ## # Assembly to object diff --git a/test/mppa/interop/vaarg_common.c b/test/mppa/interop/vaarg_common.c new file mode 100644 index 00000000..a04b67bf --- /dev/null +++ b/test/mppa/interop/vaarg_common.c @@ -0,0 +1,373 @@ +#include + +#define STACK int a[100];\ + a[42] = 42; + +#define ONEARG_OP(arg) (3*arg+2) + +#define MULTIARG_OP(arg1, arg2, arg3, arg4) (arg1 ^ arg2 << arg3 - arg4) + +#define MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,\ + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,\ + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)\ + (a0 + a1 * a2 + a3 * a4 + a5 + a6 + a7 - a8 + a9 +\ + a10 + a11 - a12 ^ a13 + a14 - a15 + a16 ^ a17 + a18 + a19 +\ + a20 + a21 + a22 * a23 + a24 + a25 << a26 & a27 + a28 + a29) + +#define VA_START(vl, n) va_list vl; va_start(vl, n) +#define VA_END(vl) va_end(vl) + +void void_void(void){ + STACK; +} + +long long ll_void(void){ + STACK; + return 0xdeadbeefdeadbeefULL; +} + +// int i_oneiarg(int arg){ +int i_oneiarg(int arg, ...){ + STACK; + VA_START(vl, 0); + VA_END(vl); + return ONEARG_OP(arg); +} + +//int i_multiiargs(int arg1, char arg2, char arg3, int arg4){ +int i_multiiargs(int arg1, ...){ + STACK; + VA_START(vl, 3); + char arg2 = va_arg(vl, int); + char arg3 = va_arg(vl, int); + int arg4 = va_arg(vl, int); + VA_END(vl); + return MULTIARG_OP(arg1, arg2, arg3, arg4); +} + +//int i_manyiargs(char a0, int a1, char a2, int a3, char a4, char a5, int a6, int a7, char a8, int a9, +// char a10, int a11, char a12, int a13, char a14, char a15, int a16, int a17, char a18, int a19, +// char a20, int a21, char a22, int a23, char a24, char a25, int a26, int a27, char a28, int a29) +int i_manyiargs(char a0, ...) +{ + STACK; + VA_START(vl, 29); + int a1 = va_arg(vl, int); + char a2 = va_arg(vl, int); + int a3 = va_arg(vl, int); + char a4 = va_arg(vl, int); + char a5 = va_arg(vl, int); + int a6 = va_arg(vl, int); + int a7 = va_arg(vl, int); + char a8 = va_arg(vl, int); + int a9 = va_arg(vl, int); + char a10 = va_arg(vl, int); + int a11 = va_arg(vl, int); + char a12 = va_arg(vl, int); + int a13 = va_arg(vl, int); + char a14 = va_arg(vl, int); + char a15 = va_arg(vl, int); + int a16 = va_arg(vl, int); + int a17 = va_arg(vl, int); + char a18 = va_arg(vl, int); + int a19 = va_arg(vl, int); + char a20 = va_arg(vl, int); + int a21 = va_arg(vl, int); + char a22 = va_arg(vl, int); + int a23 = va_arg(vl, int); + char a24 = va_arg(vl, int); + char a25 = va_arg(vl, int); + int a26 = va_arg(vl, int); + int a27 = va_arg(vl, int); + char a28 = va_arg(vl, int); + int a29 = va_arg(vl, int); + VA_END(vl); + return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29); +} + +//int ll_onellarg(long long arg){ +int ll_onellarg(long long arg, ...){ + STACK; + VA_START(vl, 0); + VA_END(vl); + return ONEARG_OP(arg); +} + +//long long ll_multillargs(long long arg1, char arg2, char arg3, long long arg4){ +long long ll_multillargs(long long arg1, ...){ + STACK; + VA_START(vl, 3); + char arg2 = va_arg(vl, int); + char arg3 = va_arg(vl, int); + long long arg4 = va_arg(vl, long long); + VA_END(vl); + return MULTIARG_OP(arg1, arg2, arg3, arg4); +} + +//long long ll_manyllargs(char a0, int a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, +// char a10, long long a11, char a12, int a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, +// char a20, int a21, char a22, long long a23, char a24, char a25, long long a26, int a27, char a28, long long a29) +long long ll_manyllargs(char a0, ...) +{ + STACK; + VA_START(vl, 29); + int a1 = va_arg(vl, int); + char a2 = va_arg(vl, int); + long long a3 = va_arg(vl, long long); + char a4 = va_arg(vl, int); + char a5 = va_arg(vl, int); + long long a6 = va_arg(vl, long long); + long long a7 = va_arg(vl, long long); + char a8 = va_arg(vl, int); + long long a9 = va_arg(vl, long long); + char a10 = va_arg(vl, int); + long long a11 = va_arg(vl, long long); + char a12 = va_arg(vl, int); + int a13 = va_arg(vl, int); + char a14 = va_arg(vl, int); + char a15 = va_arg(vl, int); + long long a16 = va_arg(vl, long long); + long long a17 = va_arg(vl, long long); + char a18 = va_arg(vl, int); + long long a19 = va_arg(vl, long long); + char a20 = va_arg(vl, int); + int a21 = va_arg(vl, int); + char a22 = va_arg(vl, int); + long long a23 = va_arg(vl, long long); + char a24 = va_arg(vl, int); + char a25 = va_arg(vl, int); + long long a26 = va_arg(vl, long long); + int a27 = va_arg(vl, int); + char a28 = va_arg(vl, int); + long long a29 = va_arg(vl, long long); + VA_END(vl); + return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29); +} + +//long long stackhell(char a0, int a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, +// char a10, long long a11, char a12, int a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, +// char a20, int a21, char a22, long long a23, char a24, char a25, long long a26, int a27, char a28, long long a29) +long long stackhell(char a0, ...) +{ + VA_START(vl, 29); + int a1 = va_arg(vl, int); + char a2 = va_arg(vl, int); + long long a3 = va_arg(vl, long long); + char a4 = va_arg(vl, int); + char a5 = va_arg(vl, int); + long long a6 = va_arg(vl, long long); + long long a7 = va_arg(vl, long long); + char a8 = va_arg(vl, int); + long long a9 = va_arg(vl, long long); + char a10 = va_arg(vl, int); + long long a11 = va_arg(vl, long long); + char a12 = va_arg(vl, int); + int a13 = va_arg(vl, int); + char a14 = va_arg(vl, int); + char a15 = va_arg(vl, int); + long long a16 = va_arg(vl, long long); + long long a17 = va_arg(vl, long long); + char a18 = va_arg(vl, int); + long long a19 = va_arg(vl, long long); + char a20 = va_arg(vl, int); + int a21 = va_arg(vl, int); + char a22 = va_arg(vl, int); + long long a23 = va_arg(vl, long long); + char a24 = va_arg(vl, int); + char a25 = va_arg(vl, int); + long long a26 = va_arg(vl, long long); + int a27 = va_arg(vl, int); + char a28 = va_arg(vl, int); + long long a29 = va_arg(vl, long long); + VA_END(vl); + + long long b0 = a0; + long long b1 = a1 + b0; + long long b2 = a2 + b1; + int b3 = a3 + b2; + int b4 = a4 + b3; + int b5 = a5 + b4; + int b6 = a6 + b5; + int b7 = a7 + b6; + char b8 = a8 + b7; + char b9 = a9 + b8; + char b10 = a10 + b9; + char b11 = a11 + b10; + char b12 = a12 + b11; + int b13 = a13 + b12; + long long b14 = a14 + b13; + long long b15 = a15 + b14; + long long b16 = a16 + b15; + long long b17 = a17 + b16; + long long b18 = a18 + b17; + long long b19 = a19 + b18; + long long b20 = a20 + b19; + long long b21 = a21 + b20; + long long b22 = a22 + b21; + long long b23 = a23 + b22; + long long b24 = a24 + b23; + long long b25 = a25 + b24; + long long b26 = a26 + b25; + long long b27 = a27 + b26; + int b28 = a28 + b27; + int b29 = a29 + b28; + int b30 = b0 + b29; + int b31 = b1 + b30; + int b32 = b2 + b31; + char b33 = b3 + b32; + char b34 = b4 + b33; + char b35 = b5 + b34; + char b36 = b6 + b35; + char b37 = b7 + b36; + int b38 = b8 + b37; + int b39 = b9 + b38; + int b40 = b0 + b39; + int b41 = b1 + b40; + int b42 = b2 + b41; + int b43 = b3 + b42; + int b44 = b4 + b43; + int b45 = b5 + b44; + int b46 = b6 + b45; + int b47 = b7 + b46; + int b48 = b8 + b47; + long long b49 = b9 + b48; + long long b50 = b0 + b49; + long long b51 = b1 + b50; + long long b52 = b2 + b51; + long long b53 = b3 + b52; + long long b54 = b4 + b53; + long long b55 = b5 + b54; + long long b56 = b6 + b55; + long long b57 = b7 + b56; + int b58 = b8 + b57; + int b59 = b9 + b58; + int b60 = b0 + b59; + int b61 = b1 + b60; + int b62 = b2 + b61; + int b63 = b3 + b62; + int b64 = b4 + b63; + int b65 = b5 + b64; + int b66 = b6 + b65; + int b67 = b7 + b66; + int b68 = b8 + b67; + int b69 = b9 + b68; + char b70 = b0 + b69; + char b71 = b1 + b70; + char b72 = b2 + b71; + char b73 = b3 + b72; + char b74 = b4 + b73; + char b75 = b5 + b74; + char b76 = b6 + b75; + char b77 = b7 + b76; + char b78 = b8 + b77; + char b79 = b9 + b78; + char b80 = b0 + b79; + char b81 = b1 + b80; + char b82 = b2 + b81; + char b83 = b3 + b82; + char b84 = b4 + b83; + int b85 = b5 + b84; + int b86 = b6 + b85; + int b87 = b7 + b86; + int b88 = b8 + b87; + int b89 = b9 + b88; + int b90 = b0 + b89; + int b91 = b1 + b90; + int b92 = b2 + b91; + int b93 = b3 + b92; + int b94 = b4 + b93; + long long b95 = b5 + b94; + long long b96 = b6 + b95; + long long b97 = b7 + b96; + long long b98 = b8 + b97; + long long b99 = b9 + b98; + long long b100 = b0 + b99; + long long b101 = b1 + b100; + long long b102 = b2 + b101; + long long b103 = b3 + b102; + long long b104 = b4 + b103; + long long b105 = b5 + b104; + long long b106 = b6 + b105; + long long b107 = b7 + b106; + long long b108 = b8 + b107; + long long b109 = b9 + b108; + long long b110 = b0 + b109; + long long b111 = b1 + b110; + long long b112 = b2 + b111; + long long b113 = b3 + b112; + long long b114 = b4 + b113; + int b115 = b5 + b114; + int b116 = b6 + b115; + int b117 = b7 + b116; + int b118 = b8 + b117; + int b119 = b9 + b118; + int b120 = b0 + b119; + int b121 = b1 + b120; + int b122 = b2 + b121; + int b123 = b3 + b122; + int b124 = b4 + b123; + int b125 = b5 + b124; + char b126 = b6 + b125; + char b127 = b7 + b126; + char b128 = b8 + b127; + char b129 = b9 + b128; + char b130 = b0 + b129; + char b131 = b1 + b130; + char b132 = b2 + b131; + char b133 = b3 + b132; + char b134 = b4 + b133; + char b135 = b5 + b134; + char b136 = b6 + b135; + char b137 = b7 + b136; + char b138 = b8 + b137; + char b139 = b9 + b138; + char b140 = b0 + b139; + char b141 = b1 + b140; + char b142 = b2 + b141; + char b143 = b3 + b142; + char b144 = b4 + b143; + char b145 = b5 + b144; + char b146 = b6 + b145; + char b147 = b7 + b146; + int b148 = b8 + b147; + int b149 = b9 + b148; + int b150 = b0 + b149; + int b151 = b1 + b150; + int b152 = b2 + b151; + int b153 = b3 + b152; + int b154 = b4 + b153; + int b155 = b5 + b154; + int b156 = b6 + b155; + int b157 = b7 + b156; + int b158 = b8 + b157; + int b159 = b9 + b158; + int b160 = b0 + b159; + int b161 = b1 + b160; + int b162 = b2 + b161; + return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) + + b0 + b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8 + b9 + + b10 + b11 + b12 + b13 + b14 + b15 + b16 + b17 + b18 + b19 + + b20 + b21 + b22 + b23 + b24 + b25 + b26 + b27 + b28 + b29 + + b30 + b31 + b32 + b33 + b34 + b35 + b36 + b37 + b38 + b39 + + b40 + b41 + b42 + b43 + b44 + b45 + b46 + b47 + b48 + b49 + + b50 + b51 + b52 + b53 + b54 + b55 + b56 + b57 + b58 + b59 + + b60 + b61 + b62 + b63 + b64 + b65 + b66 + b67 + b68 + b69 + + b70 + b71 + b72 + b73 + b74 + b75 + b76 + b77 + b78 + b79 + + b80 + b81 + b82 + b83 + b84 + b85 + b86 + b87 + b88 + b89 + + b90 + b91 + b92 + b93 + b94 + b95 + b96 + b97 + b98 + b99 + + b100 + b101 + b102 + b103 + b104 + b105 + b106 + b107 + b108 + b109 + + b110 + b111 + b112 + b113 + b114 + b115 + b116 + b117 + b118 + b119 + + b120 + b121 + b122 + b123 + b124 + b125 + b126 + b127 + b128 + b129 + + b130 + b131 + b132 + b133 + b134 + b135 + b136 + b137 + b138 + b139 + + b140 + b141 + b142 + b143 + b144 + b145 + b146 + b147 + b148 + b149 + + b150 + b151 + b152 + b153 + b154 + b155 + b156 + b157 + b158 + b159 + + b160 + b161 + b162 + ; +} + -- cgit From 79a2dac7e5317e515ce9610db1d48d0fc9ff0708 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 30 Nov 2018 17:31:11 +0100 Subject: Finished implementation of va_arg + testing done --- test/mppa/instr/Makefile | 2 +- test/mppa/interop/Makefile | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 27449e88..9d1fbb5f 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -3,7 +3,7 @@ CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 SIMU ?= k1-mppa -TIMEOUT ?= --signal=SIGTERM 20s +TIMEOUT ?= --signal=SIGTERM 60s DIR=./ SRCDIR=$(DIR) diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile index f4dc259e..78271a4e 100644 --- a/test/mppa/interop/Makefile +++ b/test/mppa/interop/Makefile @@ -3,7 +3,7 @@ CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -Wno-varargs SIMU ?= k1-mppa -TIMEOUT ?= --signal=SIGTERM 40s +TIMEOUT ?= --signal=SIGTERM 80s DIR=./ SRCDIR=$(DIR) @@ -212,7 +212,7 @@ $(BINDIR)/%.gcc.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(COMMON).gcc.o $(K1CCPATH) $(BINDIR)/%.gcc.rev.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(COMMON).ccomp.o $(K1CCPATH) @mkdir -p $(@D) - $(K1CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + $(CCOMP) $(CFLAGS) $(wordlist 1,2,$^) -o $@ $(BINDIR)/%.ccomp.bin: $(OBJDIR)/%.ccomp.o $(OBJDIR)/$(COMMON).gcc.o $(CCOMPPATH) @mkdir -p $(@D) @@ -230,7 +230,7 @@ $(BINDIR)/%.gcc.vaarg.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(VAARG_COMMON).gcc.o $(K $(BINDIR)/%.gcc.rev.vaarg.bin: $(OBJDIR)/%.gcc.o $(OBJDIR)/$(VAARG_COMMON).ccomp.o $(K1CCPATH) @mkdir -p $(@D) - $(K1CC) $(CFLAGS) $(wordlist 1,2,$^) -o $@ + $(CCOMP) $(CFLAGS) $(wordlist 1,2,$^) -o $@ $(BINDIR)/%.ccomp.vaarg.bin: $(OBJDIR)/%.ccomp.o $(OBJDIR)/$(VAARG_COMMON).gcc.o $(CCOMPPATH) @mkdir -p $(@D) -- cgit From e925d4d2ed91ddd08337b6bb9ecb5064803e1981 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 7 Dec 2018 14:45:57 +0100 Subject: Added a printf wrapper in test/mppa/lib --- test/mppa/do_test.sh | 9 +++ test/mppa/lib/Makefile | 133 ++++++++++++++++++++++++++++++++++++++++++++ test/mppa/lib/printf-test.c | 9 +++ test/mppa/lib/printf.c | 9 +++ 4 files changed, 160 insertions(+) create mode 100644 test/mppa/lib/Makefile create mode 100644 test/mppa/lib/printf-test.c create mode 100644 test/mppa/lib/printf.c (limited to 'test/mppa') diff --git a/test/mppa/do_test.sh b/test/mppa/do_test.sh index bb626203..5cc23dee 100644 --- a/test/mppa/do_test.sh +++ b/test/mppa/do_test.sh @@ -38,4 +38,13 @@ cat << EOF ## EOF (cd interop && make $1 -j$2) + +cat << EOF + +## +# printf wrapper test +## +(cd lib && make $1 -j$2) +EOF + } diff --git a/test/mppa/lib/Makefile b/test/mppa/lib/Makefile new file mode 100644 index 00000000..affc1afd --- /dev/null +++ b/test/mppa/lib/Makefile @@ -0,0 +1,133 @@ +K1CC ?= k1-mbr-gcc +K1AR ?= k1-mbr-ar +CC ?= gcc +AR ?= gcc-ar +CCOMP ?= ccomp +CFLAGS ?= -O1 -Wl,--wrap=printf +SIMU ?= k1-mppa +TIMEOUT ?= --signal=SIGTERM 60s + +DIR=./ +SRCDIR=$(DIR) +OUTDIR=$(DIR)/out +BINDIR=$(DIR)/bin +ASMDIR=$(DIR)/asm +OBJDIR=$(DIR)/obj + +K1CCPATH=$(shell which $(K1CC)) +K1ARPATH=$(shell which $(K1AR)) +CCPATH=$(shell which $(CC)) +ARPATH=$(shell which $(AR)) +SIMUPATH=$(shell which $(SIMU)) + +TESTNAMES=printf-test +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))) + +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))) + +## +# Targets +## + +all: $(BIN) system.x86-gcc.a system.gcc.a + +.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: + +# Generating output + +## Version avec timeout +$(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ + +# Object to binary + +$(BINDIR)/%.x86-gcc.bin: $(OBJDIR)/%.x86-gcc.o system.x86-gcc.a $(CCPATH) + @mkdir -p $(@D) + $(CC) $(CFLAGS) $(filter-out $(CCPATH),$^) -o $@ + +$(BINDIR)/%.gcc.bin: $(OBJDIR)/%.gcc.o system.gcc.a $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) $(filter-out $(K1CCPATH),$^) -o $@ + +$(BINDIR)/%.ccomp.bin: $(OBJDIR)/%.ccomp.o system.gcc.a $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) $(filter-out $(CCOMPPATH),$^) -o $@ + +# Generating libraries +system.x86-gcc.a: $(OBJDIR)/printf.x86-gcc.o $(ARPATH) + $(AR) rcs $@ $< + +system.gcc.a: $(OBJDIR)/printf.gcc.o $(K1ARPATH) + $(K1AR) rcs $@ $< + +# Assembly to object + +$(OBJDIR)/%.x86-gcc.o: $(ASMDIR)/%.x86-gcc.s $(CCPATH) + @mkdir -p $(@D) + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/%.gcc.o: $(ASMDIR)/%.gcc.s $(K1CCPATH) + @mkdir -p $(@D) + $(K1CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/%.ccomp.o: $(ASMDIR)/%.ccomp.s $(CCOMPPATH) + $(CCOMP) $(CFLAGS) -c $< -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) + $(K1CC) $(CFLAGS) -S $< -o $@ + +$(ASMDIR)/%.ccomp.s: $(SRCDIR)/%.c $(CCOMPPATH) + @mkdir -p $(@D) + $(CCOMP) $(CFLAGS) -S $< -o $@ + diff --git a/test/mppa/lib/printf-test.c b/test/mppa/lib/printf-test.c new file mode 100644 index 00000000..25afd436 --- /dev/null +++ b/test/mppa/lib/printf-test.c @@ -0,0 +1,9 @@ +int printf(const char *, ...); + +int main(void){ + int a = 42; + char *str = "Hi there"; + printf("%s, I am %u\n", str, a); + + return 0; +} diff --git a/test/mppa/lib/printf.c b/test/mppa/lib/printf.c new file mode 100644 index 00000000..79984ef6 --- /dev/null +++ b/test/mppa/lib/printf.c @@ -0,0 +1,9 @@ +#include +#include + +int __wrap_printf(const char *format, ...){ + va_list args; + va_start(args, format); + vprintf(format, args); + va_end(args); +} -- cgit From a045315a8d1da5c4f726512b0dd972897afe9971 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 7 Dec 2018 16:43:08 +0100 Subject: Added printf to the unitary tests for instructions --- test/mppa/instr/Makefile | 53 ++++++++++++++++++++++----------------------- test/mppa/instr/framework.h | 3 +++ 2 files changed, 29 insertions(+), 27 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 9d1fbb5f..336f3dcb 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -1,15 +1,17 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp -CFLAGS ?= -O2 +CFLAGS ?= -O2 -Wl,--wrap=printf SIMU ?= k1-mppa -TIMEOUT ?= --signal=SIGTERM 60s +TIMEOUT ?= --signal=SIGTERM 120s DIR=./ SRCDIR=$(DIR) OUTDIR=$(DIR)/out BINDIR=$(DIR)/bin ASMDIR=$(DIR)/asm +LIB=../lib/system.x86-gcc.a +K1LIB=../lib/system.gcc.a ## # Intended flow : .c -> .gcc.s -> .gcc.bin -> .gcc.out @@ -37,16 +39,20 @@ 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) @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";\ + if diff -q $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; 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;\ done @@ -56,10 +62,10 @@ check: $(GCC_OUT) $(CCOMP_OUT) @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";\ + if diff -q $$ccompout $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; 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;\ done @@ -68,20 +74,13 @@ check: $(GCC_OUT) $(CCOMP_OUT) ## .SECONDARY: -# Generating output +$(LIB): + (cd $(dir $(LIB)) && make) -## Version sans les timeout -#$(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin -# @mkdir -p $(@D) -# ./$< > $@; echo $$? >> $@ -# -#$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) -# @mkdir -p $(@D) -# $(SIMU) -- $< > $@ ; echo $$? >> $@ -# -#$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) -# @mkdir -p $(@D) -# $(SIMU) -- $< > $@ ; echo $$? >> $@ +$(K1LIB): + (cd $(dir $(LIB)) && make) + +# Generating output ## Version avec timeout $(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin @@ -98,17 +97,17 @@ $(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) # Assembly to binary -$(BINDIR)/%.x86-gcc.bin: $(ASMDIR)/%.x86-gcc.s $(CCPATH) +$(BINDIR)/%.x86-gcc.bin: $(ASMDIR)/%.x86-gcc.s $(LIB) $(CCPATH) @mkdir -p $(@D) - $(CC) $(CFLAGS) $< -o $@ + $(CC) $(CFLAGS) $(filter-out $(CCPATH),$^) -o $@ -$(BINDIR)/%.gcc.bin: $(ASMDIR)/%.gcc.s $(K1CCPATH) +$(BINDIR)/%.gcc.bin: $(ASMDIR)/%.gcc.s $(K1LIB) $(K1CCPATH) @mkdir -p $(@D) - $(K1CC) $(CFLAGS) $< -o $@ + $(K1CC) $(CFLAGS) $(filter-out $(K1CCPATH),$^) -o $@ -$(BINDIR)/%.ccomp.bin: $(ASMDIR)/%.ccomp.s $(CCOMPPATH) +$(BINDIR)/%.ccomp.bin: $(ASMDIR)/%.ccomp.s $(K1LIB) $(CCOMPPATH) @mkdir -p $(@D) - $(CCOMP) $(CFLAGS) $< -o $@ + $(CCOMP) $(CFLAGS) $(filter-out $(CCOMPPATH),$^) -o $@ # Source to assembly diff --git a/test/mppa/instr/framework.h b/test/mppa/instr/framework.h index 52ba97bc..f43ec616 100644 --- a/test/mppa/instr/framework.h +++ b/test/mppa/instr/framework.h @@ -3,6 +3,8 @@ #include "../prng/prng.c" +int printf(const char *, ...); + #define BEGIN_TEST_N(type, N)\ int main(void){\ type t[N], c, i, j, S;\ @@ -28,6 +30,7 @@ /* In between BEGIN_TEST and END_TEST : definition of c */ #define END_TEST()\ + printf("%llu\n", c);\ S += c;\ }\ return S;\ -- cgit From 51a27f176b0eb5fb2943807a5cb95f2024420936 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 11 Dec 2018 14:26:46 +0100 Subject: Fixed div64 and mod64 --- test/mppa/instr/Makefile | 5 +++-- test/mppa/interop/Makefile | 40 ++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 20 deletions(-) (limited to 'test/mppa') 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 -- cgit From 16c895f9cbef271e6f7711a83de06f02d4eeeb02 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 11 Dec 2018 17:27:02 +0100 Subject: In va_arg tests, 2nd argument of va_start is now correct --- test/mppa/interop/Makefile | 2 +- test/mppa/interop/vaarg_common.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile index e8c88ed8..5818cbcb 100644 --- a/test/mppa/interop/Makefile +++ b/test/mppa/interop/Makefile @@ -3,7 +3,7 @@ CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -Wno-varargs SIMU ?= k1-mppa -TIMEOUT ?= --signal=SIGTERM 80s +TIMEOUT ?= --signal=SIGTERM 120s DIR=./ SRCDIR=$(DIR) diff --git a/test/mppa/interop/vaarg_common.c b/test/mppa/interop/vaarg_common.c index a04b67bf..e213a20b 100644 --- a/test/mppa/interop/vaarg_common.c +++ b/test/mppa/interop/vaarg_common.c @@ -14,7 +14,7 @@ a10 + a11 - a12 ^ a13 + a14 - a15 + a16 ^ a17 + a18 + a19 +\ a20 + a21 + a22 * a23 + a24 + a25 << a26 & a27 + a28 + a29) -#define VA_START(vl, n) va_list vl; va_start(vl, n) +#define VA_START(vl, arg) va_list vl; va_start(vl, arg) #define VA_END(vl) va_end(vl) void void_void(void){ @@ -29,7 +29,7 @@ long long ll_void(void){ // int i_oneiarg(int arg){ int i_oneiarg(int arg, ...){ STACK; - VA_START(vl, 0); + VA_START(vl, arg); VA_END(vl); return ONEARG_OP(arg); } @@ -37,7 +37,7 @@ int i_oneiarg(int arg, ...){ //int i_multiiargs(int arg1, char arg2, char arg3, int arg4){ int i_multiiargs(int arg1, ...){ STACK; - VA_START(vl, 3); + VA_START(vl, arg1); char arg2 = va_arg(vl, int); char arg3 = va_arg(vl, int); int arg4 = va_arg(vl, int); @@ -51,7 +51,7 @@ int i_multiiargs(int arg1, ...){ int i_manyiargs(char a0, ...) { STACK; - VA_START(vl, 29); + VA_START(vl, a0); int a1 = va_arg(vl, int); char a2 = va_arg(vl, int); int a3 = va_arg(vl, int); @@ -90,7 +90,7 @@ int i_manyiargs(char a0, ...) //int ll_onellarg(long long arg){ int ll_onellarg(long long arg, ...){ STACK; - VA_START(vl, 0); + VA_START(vl, arg); VA_END(vl); return ONEARG_OP(arg); } @@ -98,7 +98,7 @@ int ll_onellarg(long long arg, ...){ //long long ll_multillargs(long long arg1, char arg2, char arg3, long long arg4){ long long ll_multillargs(long long arg1, ...){ STACK; - VA_START(vl, 3); + VA_START(vl, arg1); char arg2 = va_arg(vl, int); char arg3 = va_arg(vl, int); long long arg4 = va_arg(vl, long long); @@ -112,7 +112,7 @@ long long ll_multillargs(long long arg1, ...){ long long ll_manyllargs(char a0, ...) { STACK; - VA_START(vl, 29); + VA_START(vl, a0); int a1 = va_arg(vl, int); char a2 = va_arg(vl, int); long long a3 = va_arg(vl, long long); @@ -153,7 +153,7 @@ long long ll_manyllargs(char a0, ...) // char a20, int a21, char a22, long long a23, char a24, char a25, long long a26, int a27, char a28, long long a29) long long stackhell(char a0, ...) { - VA_START(vl, 29); + VA_START(vl, a0); int a1 = va_arg(vl, int); char a2 = va_arg(vl, int); long long a3 = va_arg(vl, long long); -- cgit From fe3fc2fd3d5a312ac526c5596e851e315782d9f6 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 11 Dec 2018 17:38:57 +0100 Subject: Added the use of two va_list in a va_arg test --- test/mppa/interop/vaarg_common.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/interop/vaarg_common.c b/test/mppa/interop/vaarg_common.c index e213a20b..9033893b 100644 --- a/test/mppa/interop/vaarg_common.c +++ b/test/mppa/interop/vaarg_common.c @@ -52,18 +52,22 @@ int i_manyiargs(char a0, ...) { STACK; VA_START(vl, a0); + VA_START(vl2, a0); int a1 = va_arg(vl, int); char a2 = va_arg(vl, int); int a3 = va_arg(vl, int); char a4 = va_arg(vl, int); char a5 = va_arg(vl, int); + char b1 = va_arg(vl2, int); int a6 = va_arg(vl, int); int a7 = va_arg(vl, int); char a8 = va_arg(vl, int); + char b2 = va_arg(vl2, int); int a9 = va_arg(vl, int); char a10 = va_arg(vl, int); int a11 = va_arg(vl, int); char a12 = va_arg(vl, int); + char b3 = va_arg(vl2, int); int a13 = va_arg(vl, int); char a14 = va_arg(vl, int); char a15 = va_arg(vl, int); @@ -78,13 +82,15 @@ int i_manyiargs(char a0, ...) char a24 = va_arg(vl, int); char a25 = va_arg(vl, int); int a26 = va_arg(vl, int); + char b4 = va_arg(vl2, int); int a27 = va_arg(vl, int); char a28 = va_arg(vl, int); int a29 = va_arg(vl, int); VA_END(vl); - return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, - a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, - a20, a21, a22, a23, a24, a25, a26, a27, a28, a29); + VA_END(vl); + return MANYARG_OP(a0, a1, a2, a3, a4, (a5*b2), a6, a7, a8, a9, + (a10*b3), a11, a12, a13, a14, a15, a16, a17, a18, a19, + a20, (a21*b1), a22, a23, (a24*b3), a25, a26, a27, a28, a29); } //int ll_onellarg(long long arg){ -- cgit From 576dac0317ae5e9930fb2cdfbaa36efce28d17e2 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 17 Jan 2019 14:39:59 +0100 Subject: Fixed the forvar test --- test/mppa/instr/forvar.c | 6 +++--- test/mppa/instr/framework.h | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/forvar.c b/test/mppa/instr/forvar.c index 57548274..9e43c198 100644 --- a/test/mppa/instr/forvar.c +++ b/test/mppa/instr/forvar.c @@ -2,8 +2,8 @@ BEGIN_TEST(int) { - int j; - for (j = 0 ; j < (b & 0x8) ; j++) + int k; + for (k = 0 ; k < (b & 0x8) ; k++) c += a; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/framework.h b/test/mppa/instr/framework.h index f43ec616..d1c652bd 100644 --- a/test/mppa/instr/framework.h +++ b/test/mppa/instr/framework.h @@ -37,4 +37,14 @@ int printf(const char *, ...); } /* END END_TEST */ +#define END_TEST32()\ + printf("%u\n", c);\ + S += c;\ + }\ + return S;\ + } + /* END END_TEST32 */ + #endif + + -- cgit From 6acefcbbc51aa7d2edb7b2098a5b15d06e742604 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 22 Jan 2019 16:18:22 +0100 Subject: Added sxwd and zxwd support --- test/mppa/instr/cast_S32_S64.c | 7 +++++++ test/mppa/instr/cast_S64_U32.c | 7 +++++++ test/mppa/instr/cast_U32_S64.c | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 test/mppa/instr/cast_S32_S64.c create mode 100644 test/mppa/instr/cast_S64_U32.c create mode 100644 test/mppa/instr/cast_U32_S64.c (limited to 'test/mppa') diff --git a/test/mppa/instr/cast_S32_S64.c b/test/mppa/instr/cast_S32_S64.c new file mode 100644 index 00000000..09c97e00 --- /dev/null +++ b/test/mppa/instr/cast_S32_S64.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (long long) a; +} +END_TEST32() diff --git a/test/mppa/instr/cast_S64_U32.c b/test/mppa/instr/cast_S64_U32.c new file mode 100644 index 00000000..da49b2a8 --- /dev/null +++ b/test/mppa/instr/cast_S64_U32.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = (unsigned int) a; +} +END_TEST() diff --git a/test/mppa/instr/cast_U32_S64.c b/test/mppa/instr/cast_U32_S64.c new file mode 100644 index 00000000..b6bcdf6a --- /dev/null +++ b/test/mppa/instr/cast_U32_S64.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (long long) a; +} +END_TEST() -- cgit From 0a693ac9dd3b181ba42566996531438ef205815c Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 25 Jan 2019 17:53:48 +0100 Subject: Adding indirect calls (icall instruction) --- test/mppa/instr/indirect_call.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/mppa/instr/indirect_call.c (limited to 'test/mppa') diff --git a/test/mppa/instr/indirect_call.c b/test/mppa/instr/indirect_call.c new file mode 100644 index 00000000..3a45ce52 --- /dev/null +++ b/test/mppa/instr/indirect_call.c @@ -0,0 +1,33 @@ +#include "framework.h" + +long long sum(long long a, long long b){ + return a+b; +} + +long long diff(long long a, long long b){ + return a-b; +} + +long long mul(long long a, long long b){ + return a*b; +} + +long long make(long long a){ + return a; +} + +BEGIN_TEST(long long) +{ + long long d = 3; + long long (*op)(long long, long long); + + if (a % d == 0) + op = sum; + else if (a % d == 1) + op = diff; + else + op = mul; + + c += op(make(a), make(b)); +} +END_TEST() -- cgit From 66f236124907af065fc8396f8cefd5726a46b06a Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 8 Feb 2019 15:39:48 +0100 Subject: Added indirect tailcalls --- test/mppa/instr/indirect_tailcall.c | 33 +++++++++++++++++++++++++++++++++ test/mppa/instr/tailcall.c | 16 ++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 test/mppa/instr/indirect_tailcall.c create mode 100644 test/mppa/instr/tailcall.c (limited to 'test/mppa') diff --git a/test/mppa/instr/indirect_tailcall.c b/test/mppa/instr/indirect_tailcall.c new file mode 100644 index 00000000..69295117 --- /dev/null +++ b/test/mppa/instr/indirect_tailcall.c @@ -0,0 +1,33 @@ +#include "framework.h" + +long long sum(long long a, long long b){ + return a+b; +} + +long long diff(long long a, long long b){ + return a-b; +} + +long long mul(long long a, long long b){ + return a*b; +} + +long long random_op(long long a, long long b){ + long long d = 3; + long long (*op)(long long, long long); + + if (a % d == 0) + op = sum; + else if (a % d == 1) + op = diff; + else + op = mul; + + return op(a, b); +} + +BEGIN_TEST(long long) +{ + c += random_op(a, b); +} +END_TEST() diff --git a/test/mppa/instr/tailcall.c b/test/mppa/instr/tailcall.c new file mode 100644 index 00000000..0d15d9e0 --- /dev/null +++ b/test/mppa/instr/tailcall.c @@ -0,0 +1,16 @@ +#include "framework.h" + +int make(int a){ + return a; +} + +int sum(int a, int b){ + return make(a+b); +} + +BEGIN_TEST(int) +{ + c = sum(a, b); +} +END_TEST() +/* RETURN VALUE: 60 */ -- cgit From 685c2f76b5f8b320495868cfdcadbf203f50a0bd Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 12 Feb 2019 16:47:18 +0100 Subject: Added Ointofsingle + floatconv unit test --- test/mppa/instr/floatconv.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/mppa/instr/floatconv.c (limited to 'test/mppa') diff --git a/test/mppa/instr/floatconv.c b/test/mppa/instr/floatconv.c new file mode 100644 index 00000000..025f968b --- /dev/null +++ b/test/mppa/instr/floatconv.c @@ -0,0 +1,9 @@ +#include "framework.h" + +float int2float(int v){ + return v; +} + +BEGIN_TEST(int) + c = (int) int2float(a) + (int) int2float(b) + (int) int2float(42.3); +END_TEST() -- cgit From adfc93550f1e4948ed4f39d52a4f6eece9c8a35d Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 12 Feb 2019 17:05:04 +0100 Subject: Added Olongoffloat, Ofloatoflong and doubleconv test --- test/mppa/instr/doubleconv.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/mppa/instr/doubleconv.c (limited to 'test/mppa') diff --git a/test/mppa/instr/doubleconv.c b/test/mppa/instr/doubleconv.c new file mode 100644 index 00000000..e40c65e5 --- /dev/null +++ b/test/mppa/instr/doubleconv.c @@ -0,0 +1,9 @@ +#include "framework.h" + +double long2double(long v){ + return v; +} + +BEGIN_TEST(long) + c = (long) long2double(a) + (long) long2double(b) + (long) long2double(42.3); +END_TEST() -- cgit From 3baf98aa8fe0fff0414772176ce0a0095e8b0b32 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 15 Feb 2019 18:05:54 +0100 Subject: Rajout d'opérateurs flottants, travail sur les tests --> à continuer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/mppa/instr/Makefile | 2 +- test/mppa/instr/addw.c | 2 +- test/mppa/instr/andd.c | 2 +- test/mppa/instr/andw.c | 2 +- test/mppa/instr/branch.c | 2 +- test/mppa/instr/branchz.c | 2 +- test/mppa/instr/branchzu.c | 2 +- test/mppa/instr/call.c | 2 +- test/mppa/instr/cast_S64_U32.c | 2 +- test/mppa/instr/cast_U32_S64.c | 2 +- test/mppa/instr/cb.deqz.c | 2 +- test/mppa/instr/cb.dgez.c | 2 +- test/mppa/instr/cb.dgtz.c | 2 +- test/mppa/instr/cb.dlez.c | 2 +- test/mppa/instr/cb.dltz.c | 2 +- test/mppa/instr/cb.dnez.c | 2 +- test/mppa/instr/cb.wgez.c | 2 +- test/mppa/instr/cb.wgtz.c | 2 +- test/mppa/instr/cb.wlez.c | 2 +- test/mppa/instr/cb.wltz.c | 2 +- test/mppa/instr/compd.eq.c | 2 +- test/mppa/instr/compd.geu.c | 2 +- test/mppa/instr/compd.gt.c | 2 +- test/mppa/instr/compd.gtu.c | 2 +- test/mppa/instr/compd.le.c | 2 +- test/mppa/instr/compd.leu.c | 2 +- test/mppa/instr/compd.lt.c | 2 +- test/mppa/instr/compd.ltu.c | 2 +- test/mppa/instr/compd.ne.c | 2 +- test/mppa/instr/compw.eq.c | 2 +- test/mppa/instr/compw.geu.c | 2 +- test/mppa/instr/compw.gt.c | 2 +- test/mppa/instr/compw.gtu.c | 2 +- test/mppa/instr/compw.le.c | 2 +- test/mppa/instr/compw.leu.c | 2 +- test/mppa/instr/compw.lt.c | 2 +- test/mppa/instr/compw.ltu.c | 2 +- test/mppa/instr/compw.ne.c | 2 +- test/mppa/instr/div2.c | 2 +- test/mppa/instr/doubleconv.c | 2 +- test/mppa/instr/faddd.c | 5 +++++ test/mppa/instr/faddw.c | 5 +++++ test/mppa/instr/floatconv.c | 2 +- test/mppa/instr/fmuld.c | 7 +++++++ test/mppa/instr/fmulw.c | 7 +++++++ test/mppa/instr/fnegd.c | 7 +++++++ test/mppa/instr/fnegw.c | 7 +++++++ test/mppa/instr/for.c | 2 +- test/mppa/instr/forvarl.c | 2 +- test/mppa/instr/framework.h | 30 +++++++++++++++++++++++------- test/mppa/instr/fsbfd.c | 7 +++++++ test/mppa/instr/fsbfw.c | 7 +++++++ test/mppa/instr/indirect_call.c | 2 +- test/mppa/instr/indirect_tailcall.c | 2 +- test/mppa/instr/lbs.c | 2 +- test/mppa/instr/lbz.c | 2 +- test/mppa/instr/muld.c | 2 +- test/mppa/instr/mulw.c | 2 +- test/mppa/instr/negd.c | 2 +- test/mppa/instr/ord.c | 2 +- test/mppa/instr/sbfd.c | 2 +- test/mppa/instr/sbfw.c | 2 +- test/mppa/instr/simple.c | 2 +- test/mppa/instr/sllw.c | 2 +- test/mppa/instr/srad.c | 2 +- test/mppa/instr/srld.c | 2 +- test/mppa/instr/tailcall.c | 2 +- test/mppa/instr/udivd.c | 2 +- test/mppa/instr/umodd.c | 2 +- test/mppa/instr/xord.c | 2 +- 70 files changed, 136 insertions(+), 68 deletions(-) create mode 100644 test/mppa/instr/faddd.c create mode 100644 test/mppa/instr/faddw.c create mode 100644 test/mppa/instr/fmuld.c create mode 100644 test/mppa/instr/fmulw.c create mode 100644 test/mppa/instr/fnegd.c create mode 100644 test/mppa/instr/fnegw.c create mode 100644 test/mppa/instr/fsbfd.c create mode 100644 test/mppa/instr/fsbfw.c (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 66e40365..b4abb6a4 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -2,7 +2,7 @@ K1CC ?= k1-mbr-gcc CC ?= gcc CCOMP ?= ccomp OPTIM ?= -O2 -CFLAGS ?= $(OPTIM) -Wl,--wrap=printf +CFLAGS ?= $(OPTIM) SIMU ?= k1-mppa TIMEOUT ?= --signal=SIGTERM 120s diff --git a/test/mppa/instr/addw.c b/test/mppa/instr/addw.c index be8afc67..e22024cf 100644 --- a/test/mppa/instr/addw.c +++ b/test/mppa/instr/addw.c @@ -2,4 +2,4 @@ BEGIN_TEST(int) c = a+b; -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/andd.c b/test/mppa/instr/andd.c index 5a2c7863..e3221bd7 100644 --- a/test/mppa/instr/andd.c +++ b/test/mppa/instr/andd.c @@ -2,4 +2,4 @@ BEGIN_TEST(long long) c = a&b; -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/andw.c b/test/mppa/instr/andw.c index 99de0049..799dc7fb 100644 --- a/test/mppa/instr/andw.c +++ b/test/mppa/instr/andw.c @@ -2,4 +2,4 @@ BEGIN_TEST(int) c = a&b; -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/branch.c b/test/mppa/instr/branch.c index 72e7e20e..c9937e31 100644 --- a/test/mppa/instr/branch.c +++ b/test/mppa/instr/branch.c @@ -7,4 +7,4 @@ BEGIN_TEST(int) else c = 1; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/branchz.c b/test/mppa/instr/branchz.c index fb86d357..d3e021b5 100644 --- a/test/mppa/instr/branchz.c +++ b/test/mppa/instr/branchz.c @@ -7,4 +7,4 @@ BEGIN_TEST(int) else c = 1; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/branchzu.c b/test/mppa/instr/branchzu.c index 97adb605..d0169174 100644 --- a/test/mppa/instr/branchzu.c +++ b/test/mppa/instr/branchzu.c @@ -8,4 +8,4 @@ BEGIN_TEST(int) else c = 1; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/call.c b/test/mppa/instr/call.c index 727cef63..ba2ec323 100644 --- a/test/mppa/instr/call.c +++ b/test/mppa/instr/call.c @@ -12,5 +12,5 @@ BEGIN_TEST(int) { c = sum(make(a), make(b)); } -END_TEST() +END_TEST32() /* RETURN VALUE: 60 */ diff --git a/test/mppa/instr/cast_S64_U32.c b/test/mppa/instr/cast_S64_U32.c index da49b2a8..2d9dc723 100644 --- a/test/mppa/instr/cast_S64_U32.c +++ b/test/mppa/instr/cast_S64_U32.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = (unsigned int) a; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/cast_U32_S64.c b/test/mppa/instr/cast_U32_S64.c index b6bcdf6a..6f9cd059 100644 --- a/test/mppa/instr/cast_U32_S64.c +++ b/test/mppa/instr/cast_U32_S64.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned int) { c = (long long) a; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/cb.deqz.c b/test/mppa/instr/cb.deqz.c index c56733f0..6da2ab07 100644 --- a/test/mppa/instr/cb.deqz.c +++ b/test/mppa/instr/cb.deqz.c @@ -7,4 +7,4 @@ BEGIN_TEST(long long) else c = 0; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/cb.dgez.c b/test/mppa/instr/cb.dgez.c index abb6ec57..7bef25ad 100644 --- a/test/mppa/instr/cb.dgez.c +++ b/test/mppa/instr/cb.dgez.c @@ -7,4 +7,4 @@ BEGIN_TEST(long long) else c = 0; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/cb.dgtz.c b/test/mppa/instr/cb.dgtz.c index d4271845..1a43fb1f 100644 --- a/test/mppa/instr/cb.dgtz.c +++ b/test/mppa/instr/cb.dgtz.c @@ -7,4 +7,4 @@ BEGIN_TEST(long long) else c = 0; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/cb.dlez.c b/test/mppa/instr/cb.dlez.c index 18e67f06..2fb97939 100644 --- a/test/mppa/instr/cb.dlez.c +++ b/test/mppa/instr/cb.dlez.c @@ -7,4 +7,4 @@ BEGIN_TEST(long long) else c = 0; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/cb.dltz.c b/test/mppa/instr/cb.dltz.c index 366aea49..a431d5d0 100644 --- a/test/mppa/instr/cb.dltz.c +++ b/test/mppa/instr/cb.dltz.c @@ -7,4 +7,4 @@ BEGIN_TEST(long long) else c = 0; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/cb.dnez.c b/test/mppa/instr/cb.dnez.c index 81c2cd29..44516cbe 100644 --- a/test/mppa/instr/cb.dnez.c +++ b/test/mppa/instr/cb.dnez.c @@ -7,4 +7,4 @@ BEGIN_TEST(long long) else c = 0; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/cb.wgez.c b/test/mppa/instr/cb.wgez.c index 477f4bc6..5779ad92 100644 --- a/test/mppa/instr/cb.wgez.c +++ b/test/mppa/instr/cb.wgez.c @@ -7,4 +7,4 @@ BEGIN_TEST(int) else c = 0; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/cb.wgtz.c b/test/mppa/instr/cb.wgtz.c index c9ab9a06..abb695bd 100644 --- a/test/mppa/instr/cb.wgtz.c +++ b/test/mppa/instr/cb.wgtz.c @@ -7,4 +7,4 @@ BEGIN_TEST(int) else c = 0; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/cb.wlez.c b/test/mppa/instr/cb.wlez.c index c3069fda..3a2e08c1 100644 --- a/test/mppa/instr/cb.wlez.c +++ b/test/mppa/instr/cb.wlez.c @@ -7,4 +7,4 @@ BEGIN_TEST(int) else c = 0; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/cb.wltz.c b/test/mppa/instr/cb.wltz.c index 6cf5fcf0..5d52c72a 100644 --- a/test/mppa/instr/cb.wltz.c +++ b/test/mppa/instr/cb.wltz.c @@ -7,4 +7,4 @@ BEGIN_TEST(int) else c = 0; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compd.eq.c b/test/mppa/instr/compd.eq.c index d19a4d20..4fe8de2a 100644 --- a/test/mppa/instr/compd.eq.c +++ b/test/mppa/instr/compd.eq.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = ((a & 0x1LL) == (b & 0x1LL)); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compd.geu.c b/test/mppa/instr/compd.geu.c index edc31183..fccf0804 100644 --- a/test/mppa/instr/compd.geu.c +++ b/test/mppa/instr/compd.geu.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned long long) { c = (a >= b); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compd.gt.c b/test/mppa/instr/compd.gt.c index 24147779..b9901436 100644 --- a/test/mppa/instr/compd.gt.c +++ b/test/mppa/instr/compd.gt.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = (a > b); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compd.gtu.c b/test/mppa/instr/compd.gtu.c index 5ce82569..7b2b96a6 100644 --- a/test/mppa/instr/compd.gtu.c +++ b/test/mppa/instr/compd.gtu.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned long long) { c = (a > b); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compd.le.c b/test/mppa/instr/compd.le.c index a84aad97..6fa0f103 100644 --- a/test/mppa/instr/compd.le.c +++ b/test/mppa/instr/compd.le.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = (a <= b); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compd.leu.c b/test/mppa/instr/compd.leu.c index e386bc27..1ad18281 100644 --- a/test/mppa/instr/compd.leu.c +++ b/test/mppa/instr/compd.leu.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned long long) { c = (a <= b); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compd.lt.c b/test/mppa/instr/compd.lt.c index df07a708..c42cda56 100644 --- a/test/mppa/instr/compd.lt.c +++ b/test/mppa/instr/compd.lt.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = (a < b); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compd.ltu.c b/test/mppa/instr/compd.ltu.c index dfaa8921..b03d4d53 100644 --- a/test/mppa/instr/compd.ltu.c +++ b/test/mppa/instr/compd.ltu.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned long long) { c = (a < b); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compd.ne.c b/test/mppa/instr/compd.ne.c index 19ce0a69..fd9d0b28 100644 --- a/test/mppa/instr/compd.ne.c +++ b/test/mppa/instr/compd.ne.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned long long) { c = ((a & 0x1ULL) != (b & 0x1ULL)); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/compw.eq.c b/test/mppa/instr/compw.eq.c index dc7a3ab1..cd93f365 100644 --- a/test/mppa/instr/compw.eq.c +++ b/test/mppa/instr/compw.eq.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = ((a & 0x1) == (b & 0x1)); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compw.geu.c b/test/mppa/instr/compw.geu.c index d72ca56c..b8fb1adf 100644 --- a/test/mppa/instr/compw.geu.c +++ b/test/mppa/instr/compw.geu.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned int) { c = (a >= b); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compw.gt.c b/test/mppa/instr/compw.gt.c index 9ad02610..5f6bc907 100644 --- a/test/mppa/instr/compw.gt.c +++ b/test/mppa/instr/compw.gt.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = (a > b); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compw.gtu.c b/test/mppa/instr/compw.gtu.c index 77f04989..947f6a14 100644 --- a/test/mppa/instr/compw.gtu.c +++ b/test/mppa/instr/compw.gtu.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned int) { c = (a > b); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compw.le.c b/test/mppa/instr/compw.le.c index b7a7a432..35ec6b7d 100644 --- a/test/mppa/instr/compw.le.c +++ b/test/mppa/instr/compw.le.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = (a <= b); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compw.leu.c b/test/mppa/instr/compw.leu.c index 4892f06c..74ebfb42 100644 --- a/test/mppa/instr/compw.leu.c +++ b/test/mppa/instr/compw.leu.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned int) { c = (a <= b); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compw.lt.c b/test/mppa/instr/compw.lt.c index 2cc151bf..cb1f30bd 100644 --- a/test/mppa/instr/compw.lt.c +++ b/test/mppa/instr/compw.lt.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = (a < b); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compw.ltu.c b/test/mppa/instr/compw.ltu.c index b524127f..6a0c5af1 100644 --- a/test/mppa/instr/compw.ltu.c +++ b/test/mppa/instr/compw.ltu.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned int) { c = (a < b); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/compw.ne.c b/test/mppa/instr/compw.ne.c index 433b0b86..7035e2c7 100644 --- a/test/mppa/instr/compw.ne.c +++ b/test/mppa/instr/compw.ne.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned int) { c = ((a & 0x1U) != (b & 0x1U)); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/div2.c b/test/mppa/instr/div2.c index 01a4b575..b5dfe63a 100644 --- a/test/mppa/instr/div2.c +++ b/test/mppa/instr/div2.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = (a + b) / 2; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/doubleconv.c b/test/mppa/instr/doubleconv.c index e40c65e5..55b1ddab 100644 --- a/test/mppa/instr/doubleconv.c +++ b/test/mppa/instr/doubleconv.c @@ -6,4 +6,4 @@ double long2double(long v){ BEGIN_TEST(long) c = (long) long2double(a) + (long) long2double(b) + (long) long2double(42.3); -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/faddd.c b/test/mppa/instr/faddd.c new file mode 100644 index 00000000..35b7fc92 --- /dev/null +++ b/test/mppa/instr/faddd.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(double) + c = ((double)a + (double)b); +END_TESTF64() diff --git a/test/mppa/instr/faddw.c b/test/mppa/instr/faddw.c new file mode 100644 index 00000000..a00e9afe --- /dev/null +++ b/test/mppa/instr/faddw.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(double) + c = ((float)a + (float)b); +END_TESTF64() diff --git a/test/mppa/instr/floatconv.c b/test/mppa/instr/floatconv.c index 025f968b..32b798e1 100644 --- a/test/mppa/instr/floatconv.c +++ b/test/mppa/instr/floatconv.c @@ -6,4 +6,4 @@ float int2float(int v){ BEGIN_TEST(int) c = (int) int2float(a) + (int) int2float(b) + (int) int2float(42.3); -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/fmuld.c b/test/mppa/instr/fmuld.c new file mode 100644 index 00000000..03c990fa --- /dev/null +++ b/test/mppa/instr/fmuld.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = ((double)a * (double)b); +} +END_TESTF64() diff --git a/test/mppa/instr/fmulw.c b/test/mppa/instr/fmulw.c new file mode 100644 index 00000000..030a6d9c --- /dev/null +++ b/test/mppa/instr/fmulw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = ((float)a * (float)b); +} +END_TESTF64() diff --git a/test/mppa/instr/fnegd.c b/test/mppa/instr/fnegd.c new file mode 100644 index 00000000..974eb7e8 --- /dev/null +++ b/test/mppa/instr/fnegd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = (-(double)a); +} +END_TESTF64() diff --git a/test/mppa/instr/fnegw.c b/test/mppa/instr/fnegw.c new file mode 100644 index 00000000..acbabf68 --- /dev/null +++ b/test/mppa/instr/fnegw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = (-(float)a); +} +END_TESTF64() diff --git a/test/mppa/instr/for.c b/test/mppa/instr/for.c index d6870afb..373ab6bd 100644 --- a/test/mppa/instr/for.c +++ b/test/mppa/instr/for.c @@ -6,4 +6,4 @@ BEGIN_TEST(int) for (j = 0 ; j < 10 ; j++) c += a; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/forvarl.c b/test/mppa/instr/forvarl.c index 30717a51..c1fe90fd 100644 --- a/test/mppa/instr/forvarl.c +++ b/test/mppa/instr/forvarl.c @@ -7,4 +7,4 @@ BEGIN_TEST(long long int) for (j = 0 ; j < (b & 0x8LL) ; j++) c += a; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/framework.h b/test/mppa/instr/framework.h index d1c652bd..d4f36f6b 100644 --- a/test/mppa/instr/framework.h +++ b/test/mppa/instr/framework.h @@ -1,10 +1,9 @@ #ifndef __FRAMEWORK_H__ #define __FRAMEWORK_H__ +#include #include "../prng/prng.c" -int printf(const char *, ...); - #define BEGIN_TEST_N(type, N)\ int main(void){\ type t[N], c, i, j, S;\ @@ -18,7 +17,8 @@ int printf(const char *, ...); #define BEGIN_TEST(type)\ int main(void){\ - type a, b, c, i, S;\ + type a, b, c, S;\ + int i;\ srand(0);\ S = 0;\ for (i = 0 ; i < 100 ; i++){\ @@ -29,22 +29,38 @@ int printf(const char *, ...); /* In between BEGIN_TEST and END_TEST : definition of c */ -#define END_TEST()\ - printf("%llu\n", c);\ +#define END_TEST64()\ + printf("%llu\t%llu\t%llu\n", a, b, c);\ S += c;\ }\ return S;\ } - /* END END_TEST */ + /* END END_TEST64 */ #define END_TEST32()\ - printf("%u\n", c);\ + printf("%u\t%u\t%u\n", a, b, c);\ S += c;\ }\ return S;\ } /* END END_TEST32 */ +#define END_TESTF32()\ + printf("%f\t%f\t%f\n", a, b, c);\ + S += c;\ + }\ + return 0;\ + } + /* END END_TESTF32 */ + +#define END_TESTF64()\ + printf("%lf\t%lf\t%lf\n", a, b, c);\ + S += c;\ + }\ + return 0;\ + } + /* END END_TESTF64 */ + #endif diff --git a/test/mppa/instr/fsbfd.c b/test/mppa/instr/fsbfd.c new file mode 100644 index 00000000..f80c1efe --- /dev/null +++ b/test/mppa/instr/fsbfd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = ((double)a - (double)b); +} +END_TESTF64() diff --git a/test/mppa/instr/fsbfw.c b/test/mppa/instr/fsbfw.c new file mode 100644 index 00000000..835963d5 --- /dev/null +++ b/test/mppa/instr/fsbfw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = ((float)a - (float)b); +} +END_TESTF64() diff --git a/test/mppa/instr/indirect_call.c b/test/mppa/instr/indirect_call.c index 3a45ce52..f376c00a 100644 --- a/test/mppa/instr/indirect_call.c +++ b/test/mppa/instr/indirect_call.c @@ -30,4 +30,4 @@ BEGIN_TEST(long long) c += op(make(a), make(b)); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/indirect_tailcall.c b/test/mppa/instr/indirect_tailcall.c index 69295117..e6c16ea1 100644 --- a/test/mppa/instr/indirect_tailcall.c +++ b/test/mppa/instr/indirect_tailcall.c @@ -30,4 +30,4 @@ BEGIN_TEST(long long) { c += random_op(a, b); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/lbs.c b/test/mppa/instr/lbs.c index f104d62b..22a50632 100644 --- a/test/mppa/instr/lbs.c +++ b/test/mppa/instr/lbs.c @@ -6,4 +6,4 @@ BEGIN_TEST(int) c = s[(a & (sizeof(s)-1))]; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/lbz.c b/test/mppa/instr/lbz.c index 2deeaebe..04ba098d 100644 --- a/test/mppa/instr/lbz.c +++ b/test/mppa/instr/lbz.c @@ -6,4 +6,4 @@ BEGIN_TEST(int) c = s[a & (sizeof(s) - 1)]; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/muld.c b/test/mppa/instr/muld.c index 9a40f389..f7e23850 100644 --- a/test/mppa/instr/muld.c +++ b/test/mppa/instr/muld.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = a*b; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/mulw.c b/test/mppa/instr/mulw.c index bf517ce8..a91d966e 100644 --- a/test/mppa/instr/mulw.c +++ b/test/mppa/instr/mulw.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = a * b; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/negd.c b/test/mppa/instr/negd.c index a8e8ff45..837b9828 100644 --- a/test/mppa/instr/negd.c +++ b/test/mppa/instr/negd.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = -a; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/ord.c b/test/mppa/instr/ord.c index eaedcb28..cae1ae8b 100644 --- a/test/mppa/instr/ord.c +++ b/test/mppa/instr/ord.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = a | b; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/sbfd.c b/test/mppa/instr/sbfd.c index 912f1fdb..77c28c77 100644 --- a/test/mppa/instr/sbfd.c +++ b/test/mppa/instr/sbfd.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = a-b; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/sbfw.c b/test/mppa/instr/sbfw.c index feffd497..e38a1fff 100644 --- a/test/mppa/instr/sbfw.c +++ b/test/mppa/instr/sbfw.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = a-b; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/simple.c b/test/mppa/instr/simple.c index 89bba27e..944f09c9 100644 --- a/test/mppa/instr/simple.c +++ b/test/mppa/instr/simple.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = a+b; } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/sllw.c b/test/mppa/instr/sllw.c index df55c9e8..6dd41a6c 100644 --- a/test/mppa/instr/sllw.c +++ b/test/mppa/instr/sllw.c @@ -4,4 +4,4 @@ BEGIN_TEST(int) { c = a << (b & 0x8); } -END_TEST() +END_TEST32() diff --git a/test/mppa/instr/srad.c b/test/mppa/instr/srad.c index b4047bc7..00be9d0c 100644 --- a/test/mppa/instr/srad.c +++ b/test/mppa/instr/srad.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = a >> (b & 0x8LL); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/srld.c b/test/mppa/instr/srld.c index 71e82b2a..14970efd 100644 --- a/test/mppa/instr/srld.c +++ b/test/mppa/instr/srld.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned long long) { c = a >> (b & 0x8ULL); } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/tailcall.c b/test/mppa/instr/tailcall.c index 0d15d9e0..6c659a01 100644 --- a/test/mppa/instr/tailcall.c +++ b/test/mppa/instr/tailcall.c @@ -12,5 +12,5 @@ BEGIN_TEST(int) { c = sum(a, b); } -END_TEST() +END_TEST32() /* RETURN VALUE: 60 */ diff --git a/test/mppa/instr/udivd.c b/test/mppa/instr/udivd.c index 52e0d412..cfb31881 100644 --- a/test/mppa/instr/udivd.c +++ b/test/mppa/instr/udivd.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned long long) { c = a/b; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/umodd.c b/test/mppa/instr/umodd.c index e7dd506f..a7f25f1c 100644 --- a/test/mppa/instr/umodd.c +++ b/test/mppa/instr/umodd.c @@ -4,4 +4,4 @@ BEGIN_TEST(unsigned long long) { c = a%b; } -END_TEST() +END_TEST64() diff --git a/test/mppa/instr/xord.c b/test/mppa/instr/xord.c index b9d86f06..b6a90cb0 100644 --- a/test/mppa/instr/xord.c +++ b/test/mppa/instr/xord.c @@ -4,4 +4,4 @@ BEGIN_TEST(long long) { c = a^b; } -END_TEST() +END_TEST64() -- cgit From 3c72ae21ae10f3f3f379cc45ef145bc7d90feed7 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 27 Feb 2019 12:06:09 +0100 Subject: Changing the way floats are compared (script using reltol and abstol comparison) --- test/mppa/instr/Makefile | 5 ++- test/mppa/instr/floatcmp.py | 93 +++++++++++++++++++++++++++++++++++++++++++++ test/mppa/instr/fmulw.c | 2 +- test/mppa/instr/framework.h | 4 +- 4 files changed, 99 insertions(+), 5 deletions(-) create mode 100755 test/mppa/instr/floatcmp.py (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index b4abb6a4..ea86114c 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -5,6 +5,7 @@ OPTIM ?= -O2 CFLAGS ?= $(OPTIM) SIMU ?= k1-mppa TIMEOUT ?= --signal=SIGTERM 120s +DIFF ?= python2.7 floatcmp.py -reltol .00001 DIR=./ SRCDIR=$(DIR) @@ -50,7 +51,7 @@ test: $(X86_GCC_OUT) $(GCC_OUT) @for test in $(TESTNAMES); do\ x86out=$(OUTDIR)/$$test.x86-gcc.out;\ gccout=$(OUTDIR)/$$test.gcc.out;\ - if diff -q $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ + if $(DIFF) $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ >&2 printf "$(RED)ERROR: $$x86out and $$gccout differ$(NC)\n";\ else\ printf "$(GREEN)GOOD: $$x86out and $$gccout concur$(NC)\n";\ @@ -63,7 +64,7 @@ check: $(GCC_OUT) $(CCOMP_OUT) @for test in $(TESTNAMES); do\ gccout=$(OUTDIR)/$$test.gcc.out;\ ccompout=$(OUTDIR)/$$test.ccomp.out;\ - if diff -q $$ccompout $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ + if $(DIFF) $$ccompout $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ >&2 printf "$(RED)ERROR: $$ccompout and $$gccout differ$(NC)\n";\ else\ printf "$(GREEN)GOOD: $$ccompout and $$gccout concur$(NC)\n";\ diff --git a/test/mppa/instr/floatcmp.py b/test/mppa/instr/floatcmp.py new file mode 100755 index 00000000..49f1bc13 --- /dev/null +++ b/test/mppa/instr/floatcmp.py @@ -0,0 +1,93 @@ +#!/usr/bin/python2.7 + +import argparse as ap +import sys + +parser = ap.ArgumentParser() +parser.add_argument("file1", help="First file to compare") +parser.add_argument("file2", help="Second file to compare") +parser.add_argument("-reltol", help="Relative error") +parser.add_argument("-abstol", help="Absolute error") +parser.add_argument("-s", help="Silent output", action="store_true") +args = parser.parse_args() + +reltol = float(args.reltol) if args.reltol else None +abstol = float(args.abstol) if args.abstol else None +silent = args.s + +if silent: + sys.stdout = open("/dev/null", "w") + +import re +from math import fabs + +def floatcmp(f1, f2): + if abstol: + if fabs(f1 - f2) > abstol: + return False + if reltol: + if f2 != 0. and fabs((f1 - f2) / f2) > reltol: + return False + return True + +class Parsed(list): + def __eq__(self, other): + if len(self) != len(other): + return False + comps = zip(self, other) + for comp in comps: + if all(isinstance(compElt, str) for compElt in comp): + if comp[0] != comp[1]: + return False + elif all (isinstance(compElt, float) for compElt in comp): + if not floatcmp(comp[0], comp[1]): + return False + else: + return False + return True + + def __ne__(self, other): + return not self.__eq__(other) + +parseLine = re.compile(r"\s*(\S+)") +def readline(line): + words = parseLine.findall(line) + parsed = Parsed([]) + for word in words: + try: + parse = float(word) + parsed.append(parse) + except ValueError: + parsed.append(word) + return parsed + +def readfile(filename): + L = [] + try: + with open(filename) as f: + for line in f: + L.append(readline(line)) + except IOError: + print "Unable to read {}".format(filename) + sys.exit(2) + return L + +L1 = readfile(args.file1) +L2 = readfile(args.file2) + +if len(L1) != len(L2): + print "The files have different amount of lines" + print "\t{}: {} lines".format(args.file1, len(L1)) + print "\t{}: {} lines".format(args.file2, len(L2)) + sys.exit(1) + +cmpL = zip(L1, L2) +for i, cmpElt in enumerate(cmpL): + if cmpElt[0] != cmpElt[1]: + print "The files differ at line {}".format(i) + print "\t{}: {}".format(args.file1, cmpElt[0]) + print "\t{}: {}".format(args.file2, cmpElt[1]) + sys.exit(1) + +print "Comparison succeeded" +sys.exit(0) diff --git a/test/mppa/instr/fmulw.c b/test/mppa/instr/fmulw.c index 030a6d9c..67d645c3 100644 --- a/test/mppa/instr/fmulw.c +++ b/test/mppa/instr/fmulw.c @@ -4,4 +4,4 @@ BEGIN_TEST(double) { c = ((float)a * (float)b); } -END_TESTF64() +END_TESTF32() diff --git a/test/mppa/instr/framework.h b/test/mppa/instr/framework.h index d4f36f6b..3bbfa271 100644 --- a/test/mppa/instr/framework.h +++ b/test/mppa/instr/framework.h @@ -46,7 +46,7 @@ /* END END_TEST32 */ #define END_TESTF32()\ - printf("%f\t%f\t%f\n", a, b, c);\ + printf("%e\t%e\t%e\n", a, b, c);\ S += c;\ }\ return 0;\ @@ -54,7 +54,7 @@ /* END END_TESTF32 */ #define END_TESTF64()\ - printf("%lf\t%lf\t%lf\n", a, b, c);\ + printf("%e\t%e\t%e\n", a, b, c);\ S += c;\ }\ return 0;\ -- cgit From f50d5b2e7d689a0033943fca270d322b33c1a781 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 27 Feb 2019 18:02:33 +0100 Subject: Float conversion fixes + some more conversions --- test/mppa/instr/faddw.c | 4 ++-- test/mppa/instr/fmulw.c | 2 +- test/mppa/instr/fnegw.c | 2 +- test/mppa/instr/fsbfw.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/faddw.c b/test/mppa/instr/faddw.c index a00e9afe..e0e635ae 100644 --- a/test/mppa/instr/faddw.c +++ b/test/mppa/instr/faddw.c @@ -1,5 +1,5 @@ #include "framework.h" -BEGIN_TEST(double) +BEGIN_TEST(float) c = ((float)a + (float)b); -END_TESTF64() +END_TESTF32() diff --git a/test/mppa/instr/fmulw.c b/test/mppa/instr/fmulw.c index 67d645c3..f85eba64 100644 --- a/test/mppa/instr/fmulw.c +++ b/test/mppa/instr/fmulw.c @@ -1,6 +1,6 @@ #include "framework.h" -BEGIN_TEST(double) +BEGIN_TEST(float) { c = ((float)a * (float)b); } diff --git a/test/mppa/instr/fnegw.c b/test/mppa/instr/fnegw.c index acbabf68..fbeaab8e 100644 --- a/test/mppa/instr/fnegw.c +++ b/test/mppa/instr/fnegw.c @@ -1,6 +1,6 @@ #include "framework.h" -BEGIN_TEST(double) +BEGIN_TEST(float) { c = (-(float)a); } diff --git a/test/mppa/instr/fsbfw.c b/test/mppa/instr/fsbfw.c index 835963d5..067c40b5 100644 --- a/test/mppa/instr/fsbfw.c +++ b/test/mppa/instr/fsbfw.c @@ -1,6 +1,6 @@ #include "framework.h" -BEGIN_TEST(double) +BEGIN_TEST(float) { c = ((float)a - (float)b); } -- cgit From 23fb9970915ab586a3c5c3a55c5d3ec372604f7b Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 19 Mar 2019 11:56:19 +0100 Subject: Small improvements to interop test Makefile --- test/mppa/interop/Makefile | 2 +- test/mppa/interop/framework.h | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile index 5818cbcb..a405ebd6 100644 --- a/test/mppa/interop/Makefile +++ b/test/mppa/interop/Makefile @@ -28,7 +28,7 @@ CCPATH=$(shell which $(CC)) CCOMPPATH=$(shell which $(CCOMP)) SIMUPATH=$(shell which $(SIMU)) -TESTNAMES=$(filter-out $(VAARG_COMMON),$(filter-out $(COMMON),$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))))) +TESTNAMES ?= $(filter-out $(VAARG_COMMON),$(filter-out $(COMMON),$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))))) X86_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .x86-gcc.out,$(TESTNAMES))) GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.out,$(TESTNAMES))) diff --git a/test/mppa/interop/framework.h b/test/mppa/interop/framework.h index 52ba97bc..3bbfa271 100644 --- a/test/mppa/interop/framework.h +++ b/test/mppa/interop/framework.h @@ -1,6 +1,7 @@ #ifndef __FRAMEWORK_H__ #define __FRAMEWORK_H__ +#include #include "../prng/prng.c" #define BEGIN_TEST_N(type, N)\ @@ -16,7 +17,8 @@ #define BEGIN_TEST(type)\ int main(void){\ - type a, b, c, i, S;\ + type a, b, c, S;\ + int i;\ srand(0);\ S = 0;\ for (i = 0 ; i < 100 ; i++){\ @@ -27,11 +29,38 @@ /* In between BEGIN_TEST and END_TEST : definition of c */ -#define END_TEST()\ +#define END_TEST64()\ + printf("%llu\t%llu\t%llu\n", a, b, c);\ S += c;\ }\ return S;\ } - /* END END_TEST */ + /* END END_TEST64 */ + +#define END_TEST32()\ + printf("%u\t%u\t%u\n", a, b, c);\ + S += c;\ + }\ + return S;\ + } + /* END END_TEST32 */ + +#define END_TESTF32()\ + printf("%e\t%e\t%e\n", a, b, c);\ + S += c;\ + }\ + return 0;\ + } + /* END END_TESTF32 */ + +#define END_TESTF64()\ + printf("%e\t%e\t%e\n", a, b, c);\ + S += c;\ + }\ + return 0;\ + } + /* END END_TESTF64 */ #endif + + -- cgit From e5780e9879b31e5847edfdab1b5fb4876e642c6f Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 19 Mar 2019 11:57:59 +0100 Subject: [TEST BROKEN] Trying to replace some int by float in stackhell interop test --- test/mppa/interop/common.c | 130 +++++++++++++++++++++--------------------- test/mppa/interop/common.h | 2 +- test/mppa/interop/stackhell.c | 5 +- 3 files changed, 69 insertions(+), 68 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/interop/common.c b/test/mppa/interop/common.c index 2b5f5b5e..b8f9d858 100644 --- a/test/mppa/interop/common.c +++ b/test/mppa/interop/common.c @@ -8,9 +8,9 @@ #define MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,\ a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,\ a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)\ - (a0 + a1 * a2 + a3 * a4 + a5 + a6 + a7 - a8 + a9 +\ - a10 + a11 - a12 ^ a13 + a14 - a15 + a16 ^ a17 + a18 + a19 +\ - a20 + a21 + a22 * a23 + a24 + a25 << a26 & a27 + a28 + a29) + (a0 - a1 + a2 + a3 * a4 + a5 - a6 + a7 - a8 + a9 -\ + a10 + a11 + a12 + a13 - a14 + a15 + a16 + a17 - a18 + a19 -\ + a20 + a21 - a22 + a23 - a24 + a25 - a26 + a27 - a28 + a29) void void_void(){ STACK; @@ -61,22 +61,22 @@ long long ll_manyllargs(char a0, int a1, char a2, long long a3, char a4, char a5 a20, a21, a22, a23, a24, a25, a26, a27, a28, a29); } -long long stackhell(char a0, int a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, - char a10, long long a11, char a12, int a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, - char a20, int a21, char a22, long long a23, char a24, char a25, long long a26, int a27, char a28, long long a29) +double stackhell(char a0, int a1, float a2, long long a3, double a4, char a5, long long a6, long long a7, float a8, long long a9, + double a10, long long a11, char a12, int a13, float a14, double a15, long long a16, long long a17, float a18, long long a19, + char a20, int a21, char a22, long long a23, float a24, char a25, long long a26, int a27, double a28, long long a29) { long long b0 = a0; long long b1 = a1 + b0; long long b2 = a2 + b1; - int b3 = a3 + b2; + float b3 = a3 + b2; int b4 = a4 + b3; - int b5 = a5 + b4; + double b5 = a5 + b4; int b6 = a6 + b5; - int b7 = a7 + b6; + float b7 = a7 + b6; char b8 = a8 + b7; - char b9 = a9 + b8; + double b9 = a9 + b8; char b10 = a10 + b9; - char b11 = a11 + b10; + float b11 = a11 + b10; char b12 = a12 + b11; int b13 = a13 + b12; long long b14 = a14 + b13; @@ -94,25 +94,25 @@ long long stackhell(char a0, int a1, char a2, long long a3, char a4, char a5, lo long long b26 = a26 + b25; long long b27 = a27 + b26; int b28 = a28 + b27; - int b29 = a29 + b28; - int b30 = b0 + b29; - int b31 = b1 + b30; + double b29 = a29 + b28; + float b30 = b0 + b29; + double b31 = b1 + b30; int b32 = b2 + b31; char b33 = b3 + b32; - char b34 = b4 + b33; + float b34 = b4 + b33; char b35 = b5 + b34; - char b36 = b6 + b35; - char b37 = b7 + b36; + double b36 = b6 + b35; + float b37 = b7 + b36; int b38 = b8 + b37; - int b39 = b9 + b38; - int b40 = b0 + b39; + double b39 = b9 + b38; + float b40 = b0 + b39; int b41 = b1 + b40; - int b42 = b2 + b41; - int b43 = b3 + b42; + double b42 = b2 + b41; + float b43 = b3 + b42; int b44 = b4 + b43; - int b45 = b5 + b44; + double b45 = b5 + b44; int b46 = b6 + b45; - int b47 = b7 + b46; + double b47 = b7 + b46; int b48 = b8 + b47; long long b49 = b9 + b48; long long b50 = b0 + b49; @@ -124,40 +124,40 @@ long long stackhell(char a0, int a1, char a2, long long a3, char a4, char a5, lo long long b56 = b6 + b55; long long b57 = b7 + b56; int b58 = b8 + b57; - int b59 = b9 + b58; + float b59 = b9 + b58; int b60 = b0 + b59; - int b61 = b1 + b60; - int b62 = b2 + b61; + float b61 = b1 + b60; + float b62 = b2 + b61; int b63 = b3 + b62; - int b64 = b4 + b63; + double b64 = b4 + b63; int b65 = b5 + b64; int b66 = b6 + b65; - int b67 = b7 + b66; - int b68 = b8 + b67; + double b67 = b7 + b66; + double b68 = b8 + b67; int b69 = b9 + b68; char b70 = b0 + b69; char b71 = b1 + b70; - char b72 = b2 + b71; - char b73 = b3 + b72; + double b72 = b2 + b71; + double b73 = b3 + b72; char b74 = b4 + b73; - char b75 = b5 + b74; - char b76 = b6 + b75; - char b77 = b7 + b76; + float b75 = b5 + b74; + float b76 = b6 + b75; + double b77 = b7 + b76; char b78 = b8 + b77; - char b79 = b9 + b78; - char b80 = b0 + b79; + float b79 = b9 + b78; + float b80 = b0 + b79; char b81 = b1 + b80; char b82 = b2 + b81; - char b83 = b3 + b82; + float b83 = b3 + b82; char b84 = b4 + b83; int b85 = b5 + b84; int b86 = b6 + b85; - int b87 = b7 + b86; - int b88 = b8 + b87; - int b89 = b9 + b88; + double b87 = b7 + b86; + float b88 = b8 + b87; + double b89 = b9 + b88; int b90 = b0 + b89; - int b91 = b1 + b90; - int b92 = b2 + b91; + float b91 = b1 + b90; + double b92 = b2 + b91; int b93 = b3 + b92; int b94 = b4 + b93; long long b95 = b5 + b94; @@ -183,50 +183,50 @@ long long stackhell(char a0, int a1, char a2, long long a3, char a4, char a5, lo int b115 = b5 + b114; int b116 = b6 + b115; int b117 = b7 + b116; - int b118 = b8 + b117; - int b119 = b9 + b118; + float b118 = b8 + b117; + float b119 = b9 + b118; int b120 = b0 + b119; - int b121 = b1 + b120; - int b122 = b2 + b121; + double b121 = b1 + b120; + float b122 = b2 + b121; int b123 = b3 + b122; - int b124 = b4 + b123; + double b124 = b4 + b123; int b125 = b5 + b124; char b126 = b6 + b125; - char b127 = b7 + b126; + double b127 = b7 + b126; char b128 = b8 + b127; - char b129 = b9 + b128; + float b129 = b9 + b128; char b130 = b0 + b129; - char b131 = b1 + b130; + double b131 = b1 + b130; char b132 = b2 + b131; - char b133 = b3 + b132; + float b133 = b3 + b132; char b134 = b4 + b133; - char b135 = b5 + b134; + double b135 = b5 + b134; char b136 = b6 + b135; - char b137 = b7 + b136; + float b137 = b7 + b136; char b138 = b8 + b137; - char b139 = b9 + b138; + double b139 = b9 + b138; char b140 = b0 + b139; - char b141 = b1 + b140; + float b141 = b1 + b140; char b142 = b2 + b141; - char b143 = b3 + b142; + double b143 = b3 + b142; char b144 = b4 + b143; - char b145 = b5 + b144; + float b145 = b5 + b144; char b146 = b6 + b145; - char b147 = b7 + b146; + double b147 = b7 + b146; int b148 = b8 + b147; - int b149 = b9 + b148; + float b149 = b9 + b148; int b150 = b0 + b149; - int b151 = b1 + b150; + double b151 = b1 + b150; int b152 = b2 + b151; - int b153 = b3 + b152; + float b153 = b3 + b152; int b154 = b4 + b153; - int b155 = b5 + b154; + double b155 = b5 + b154; int b156 = b6 + b155; - int b157 = b7 + b156; + float b157 = b7 + b156; int b158 = b8 + b157; - int b159 = b9 + b158; + double b159 = b9 + b158; int b160 = b0 + b159; - int b161 = b1 + b160; + float b161 = b1 + b160; int b162 = b2 + b161; return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, diff --git a/test/mppa/interop/common.h b/test/mppa/interop/common.h index 4e4a692a..055ce7ea 100644 --- a/test/mppa/interop/common.h +++ b/test/mppa/interop/common.h @@ -21,7 +21,7 @@ long long ll_manyllargs(char a0, long long a1, char a2, long long a3, char a4, c char a10, long long a11, char a12, long long a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, char a20, long long a21, char a22, long long a23, char a24, char a25, long long a26, long long a27, char a28, long long a29); -long long stackhell(char a0, long long a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, +double stackhell(char a0, long long a1, char a2, long long a3, char a4, char a5, long long a6, long long a7, char a8, long long a9, char a10, long long a11, char a12, long long a13, char a14, char a15, long long a16, long long a17, char a18, long long a19, char a20, long long a21, char a22, long long a23, char a24, char a25, long long a26, long long a27, char a28, long long a29); diff --git a/test/mppa/interop/stackhell.c b/test/mppa/interop/stackhell.c index fbe7d56b..849367d1 100644 --- a/test/mppa/interop/stackhell.c +++ b/test/mppa/interop/stackhell.c @@ -1,8 +1,9 @@ #include "framework.h" #include "common.h" -BEGIN_TEST(long long) +BEGIN_TEST(double) c = stackhell(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); -END_TEST() + +END_TESTF64() -- cgit From 4cc89880cb0ace13faf73009e839e71930912f15 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 19 Mar 2019 12:11:01 +0100 Subject: Trying to replace all the + by - --- test/mppa/interop/common.c | 364 +++++++++++++++++++++--------------------- test/mppa/interop/stackhell.c | 6 +- 2 files changed, 185 insertions(+), 185 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/interop/common.c b/test/mppa/interop/common.c index b8f9d858..07111361 100644 --- a/test/mppa/interop/common.c +++ b/test/mppa/interop/common.c @@ -8,9 +8,9 @@ #define MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,\ a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,\ a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)\ - (a0 - a1 + a2 + a3 * a4 + a5 - a6 + a7 - a8 + a9 -\ - a10 + a11 + a12 + a13 - a14 + a15 + a16 + a17 - a18 + a19 -\ - a20 + a21 - a22 + a23 - a24 + a25 - a26 + a27 - a28 + a29) + (a0 - a1 - a2 - a3 - a4 - a5 - a6 - a7 - a8 - a9 -\ + a10 - a11 - a12 - a13 - a14 - a15 - a16 - a17 - a18 - a19 -\ + a20 - a21 - a22 - a23 - a24 - a25 - a26 - a27 - a28 - a29) void void_void(){ STACK; @@ -66,188 +66,188 @@ double stackhell(char a0, int a1, float a2, long long a3, double a4, char a5, lo char a20, int a21, char a22, long long a23, float a24, char a25, long long a26, int a27, double a28, long long a29) { long long b0 = a0; - long long b1 = a1 + b0; - long long b2 = a2 + b1; - float b3 = a3 + b2; - int b4 = a4 + b3; - double b5 = a5 + b4; - int b6 = a6 + b5; - float b7 = a7 + b6; - char b8 = a8 + b7; - double b9 = a9 + b8; - char b10 = a10 + b9; - float b11 = a11 + b10; - char b12 = a12 + b11; - int b13 = a13 + b12; - long long b14 = a14 + b13; - long long b15 = a15 + b14; - long long b16 = a16 + b15; - long long b17 = a17 + b16; - long long b18 = a18 + b17; - long long b19 = a19 + b18; - long long b20 = a20 + b19; - long long b21 = a21 + b20; - long long b22 = a22 + b21; - long long b23 = a23 + b22; - long long b24 = a24 + b23; - long long b25 = a25 + b24; - long long b26 = a26 + b25; - long long b27 = a27 + b26; - int b28 = a28 + b27; - double b29 = a29 + b28; - float b30 = b0 + b29; - double b31 = b1 + b30; - int b32 = b2 + b31; - char b33 = b3 + b32; - float b34 = b4 + b33; - char b35 = b5 + b34; - double b36 = b6 + b35; - float b37 = b7 + b36; - int b38 = b8 + b37; - double b39 = b9 + b38; - float b40 = b0 + b39; - int b41 = b1 + b40; - double b42 = b2 + b41; - float b43 = b3 + b42; - int b44 = b4 + b43; - double b45 = b5 + b44; - int b46 = b6 + b45; - double b47 = b7 + b46; - int b48 = b8 + b47; - long long b49 = b9 + b48; - long long b50 = b0 + b49; - long long b51 = b1 + b50; - long long b52 = b2 + b51; - long long b53 = b3 + b52; - long long b54 = b4 + b53; - long long b55 = b5 + b54; - long long b56 = b6 + b55; - long long b57 = b7 + b56; - int b58 = b8 + b57; - float b59 = b9 + b58; - int b60 = b0 + b59; - float b61 = b1 + b60; - float b62 = b2 + b61; - int b63 = b3 + b62; - double b64 = b4 + b63; - int b65 = b5 + b64; - int b66 = b6 + b65; - double b67 = b7 + b66; - double b68 = b8 + b67; - int b69 = b9 + b68; - char b70 = b0 + b69; - char b71 = b1 + b70; - double b72 = b2 + b71; - double b73 = b3 + b72; - char b74 = b4 + b73; - float b75 = b5 + b74; - float b76 = b6 + b75; - double b77 = b7 + b76; - char b78 = b8 + b77; - float b79 = b9 + b78; - float b80 = b0 + b79; - char b81 = b1 + b80; - char b82 = b2 + b81; - float b83 = b3 + b82; - char b84 = b4 + b83; - int b85 = b5 + b84; - int b86 = b6 + b85; - double b87 = b7 + b86; - float b88 = b8 + b87; - double b89 = b9 + b88; - int b90 = b0 + b89; - float b91 = b1 + b90; - double b92 = b2 + b91; - int b93 = b3 + b92; - int b94 = b4 + b93; - long long b95 = b5 + b94; - long long b96 = b6 + b95; - long long b97 = b7 + b96; - long long b98 = b8 + b97; - long long b99 = b9 + b98; - long long b100 = b0 + b99; - long long b101 = b1 + b100; - long long b102 = b2 + b101; - long long b103 = b3 + b102; - long long b104 = b4 + b103; - long long b105 = b5 + b104; - long long b106 = b6 + b105; - long long b107 = b7 + b106; - long long b108 = b8 + b107; - long long b109 = b9 + b108; - long long b110 = b0 + b109; - long long b111 = b1 + b110; - long long b112 = b2 + b111; - long long b113 = b3 + b112; - long long b114 = b4 + b113; - int b115 = b5 + b114; - int b116 = b6 + b115; - int b117 = b7 + b116; - float b118 = b8 + b117; - float b119 = b9 + b118; - int b120 = b0 + b119; - double b121 = b1 + b120; - float b122 = b2 + b121; - int b123 = b3 + b122; - double b124 = b4 + b123; - int b125 = b5 + b124; - char b126 = b6 + b125; - double b127 = b7 + b126; - char b128 = b8 + b127; - float b129 = b9 + b128; - char b130 = b0 + b129; - double b131 = b1 + b130; - char b132 = b2 + b131; - float b133 = b3 + b132; - char b134 = b4 + b133; - double b135 = b5 + b134; - char b136 = b6 + b135; - float b137 = b7 + b136; - char b138 = b8 + b137; - double b139 = b9 + b138; - char b140 = b0 + b139; - float b141 = b1 + b140; - char b142 = b2 + b141; - double b143 = b3 + b142; - char b144 = b4 + b143; - float b145 = b5 + b144; - char b146 = b6 + b145; - double b147 = b7 + b146; - int b148 = b8 + b147; - float b149 = b9 + b148; - int b150 = b0 + b149; - double b151 = b1 + b150; - int b152 = b2 + b151; - float b153 = b3 + b152; - int b154 = b4 + b153; - double b155 = b5 + b154; - int b156 = b6 + b155; - float b157 = b7 + b156; - int b158 = b8 + b157; - double b159 = b9 + b158; - int b160 = b0 + b159; - float b161 = b1 + b160; - int b162 = b2 + b161; + long long b1 = a1 - b0; + long long b2 = a2 - b1; + float b3 = a3 - b2; + int b4 = a4 - b3; + double b5 = a5 - b4; + int b6 = a6 - b5; + float b7 = a7 - b6; + char b8 = a8 - b7; + double b9 = a9 - b8; + char b10 = a10 - b9; + float b11 = a11 - b10; + char b12 = a12 - b11; + int b13 = a13 - b12; + long long b14 = a14 - b13; + long long b15 = a15 - b14; + long long b16 = a16 - b15; + long long b17 = a17 - b16; + long long b18 = a18 - b17; + long long b19 = a19 - b18; + long long b20 = a20 - b19; + long long b21 = a21 - b20; + long long b22 = a22 - b21; + long long b23 = a23 - b22; + long long b24 = a24 - b23; + long long b25 = a25 - b24; + long long b26 = a26 - b25; + long long b27 = a27 - b26; + int b28 = a28 - b27; + double b29 = a29 - b28; + float b30 = b0 - b29; + double b31 = b1 - b30; + int b32 = b2 - b31; + char b33 = b3 - b32; + float b34 = b4 - b33; + char b35 = b5 - b34; + double b36 = b6 - b35; + float b37 = b7 - b36; + int b38 = b8 - b37; + double b39 = b9 - b38; + float b40 = b0 - b39; + int b41 = b1 - b40; + double b42 = b2 - b41; + float b43 = b3 - b42; + int b44 = b4 - b43; + double b45 = b5 - b44; + int b46 = b6 - b45; + double b47 = b7 - b46; + int b48 = b8 - b47; + long long b49 = b9 - b48; + long long b50 = b0 - b49; + long long b51 = b1 - b50; + long long b52 = b2 - b51; + long long b53 = b3 - b52; + long long b54 = b4 - b53; + long long b55 = b5 - b54; + long long b56 = b6 - b55; + long long b57 = b7 - b56; + int b58 = b8 - b57; + float b59 = b9 - b58; + int b60 = b0 - b59; + float b61 = b1 - b60; + float b62 = b2 - b61; + int b63 = b3 - b62; + double b64 = b4 - b63; + int b65 = b5 - b64; + int b66 = b6 - b65; + double b67 = b7 - b66; + double b68 = b8 - b67; + int b69 = b9 - b68; + char b70 = b0 - b69; + char b71 = b1 - b70; + double b72 = b2 - b71; + double b73 = b3 - b72; + char b74 = b4 - b73; + float b75 = b5 - b74; + float b76 = b6 - b75; + double b77 = b7 - b76; + char b78 = b8 - b77; + float b79 = b9 - b78; + float b80 = b0 - b79; + char b81 = b1 - b80; + char b82 = b2 - b81; + float b83 = b3 - b82; + char b84 = b4 - b83; + int b85 = b5 - b84; + int b86 = b6 - b85; + double b87 = b7 - b86; + float b88 = b8 - b87; + double b89 = b9 - b88; + int b90 = b0 - b89; + float b91 = b1 - b90; + double b92 = b2 - b91; + int b93 = b3 - b92; + int b94 = b4 - b93; + long long b95 = b5 - b94; + long long b96 = b6 - b95; + long long b97 = b7 - b96; + long long b98 = b8 - b97; + long long b99 = b9 - b98; + long long b100 = b0 - b99; + long long b101 = b1 - b100; + long long b102 = b2 - b101; + long long b103 = b3 - b102; + long long b104 = b4 - b103; + long long b105 = b5 - b104; + long long b106 = b6 - b105; + long long b107 = b7 - b106; + long long b108 = b8 - b107; + long long b109 = b9 - b108; + long long b110 = b0 - b109; + long long b111 = b1 - b110; + long long b112 = b2 - b111; + long long b113 = b3 - b112; + long long b114 = b4 - b113; + int b115 = b5 - b114; + int b116 = b6 - b115; + int b117 = b7 - b116; + float b118 = b8 - b117; + float b119 = b9 - b118; + int b120 = b0 - b119; + double b121 = b1 - b120; + float b122 = b2 - b121; + int b123 = b3 - b122; + double b124 = b4 - b123; + int b125 = b5 - b124; + char b126 = b6 - b125; + double b127 = b7 - b126; + char b128 = b8 - b127; + float b129 = b9 - b128; + char b130 = b0 - b129; + double b131 = b1 - b130; + char b132 = b2 - b131; + float b133 = b3 - b132; + char b134 = b4 - b133; + double b135 = b5 - b134; + char b136 = b6 - b135; + float b137 = b7 - b136; + char b138 = b8 - b137; + double b139 = b9 - b138; + char b140 = b0 - b139; + float b141 = b1 - b140; + char b142 = b2 - b141; + double b143 = b3 - b142; + char b144 = b4 - b143; + float b145 = b5 - b144; + char b146 = b6 - b145; + double b147 = b7 - b146; + int b148 = b8 - b147; + float b149 = b9 - b148; + int b150 = b0 - b149; + double b151 = b1 - b150; + int b152 = b2 - b151; + float b153 = b3 - b152; + int b154 = b4 - b153; + double b155 = b5 - b154; + int b156 = b6 - b155; + float b157 = b7 - b156; + int b158 = b8 - b157; + double b159 = b9 - b158; + int b160 = b0 - b159; + float b161 = b1 - b160; + int b162 = b2 - b161; return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) - + b0 + b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8 + b9 - + b10 + b11 + b12 + b13 + b14 + b15 + b16 + b17 + b18 + b19 - + b20 + b21 + b22 + b23 + b24 + b25 + b26 + b27 + b28 + b29 - + b30 + b31 + b32 + b33 + b34 + b35 + b36 + b37 + b38 + b39 - + b40 + b41 + b42 + b43 + b44 + b45 + b46 + b47 + b48 + b49 - + b50 + b51 + b52 + b53 + b54 + b55 + b56 + b57 + b58 + b59 - + b60 + b61 + b62 + b63 + b64 + b65 + b66 + b67 + b68 + b69 - + b70 + b71 + b72 + b73 + b74 + b75 + b76 + b77 + b78 + b79 - + b80 + b81 + b82 + b83 + b84 + b85 + b86 + b87 + b88 + b89 - + b90 + b91 + b92 + b93 + b94 + b95 + b96 + b97 + b98 + b99 - + b100 + b101 + b102 + b103 + b104 + b105 + b106 + b107 + b108 + b109 - + b110 + b111 + b112 + b113 + b114 + b115 + b116 + b117 + b118 + b119 - + b120 + b121 + b122 + b123 + b124 + b125 + b126 + b127 + b128 + b129 - + b130 + b131 + b132 + b133 + b134 + b135 + b136 + b137 + b138 + b139 - + b140 + b141 + b142 + b143 + b144 + b145 + b146 + b147 + b148 + b149 - + b150 + b151 + b152 + b153 + b154 + b155 + b156 + b157 + b158 + b159 - + b160 + b161 + b162 + - b0 - b1 - b2 - b3 - b4 - b5 - b6 - b7 - b8 - b9 + - b10 - b11 - b12 - b13 - b14 - b15 - b16 - b17 - b18 - b19 + - b20 - b21 - b22 - b23 - b24 - b25 - b26 - b27 - b28 - b29 + - b30 - b31 - b32 - b33 - b34 - b35 - b36 - b37 - b38 - b39 + - b40 - b41 - b42 - b43 - b44 - b45 - b46 - b47 - b48 - b49 + - b50 - b51 - b52 - b53 - b54 - b55 - b56 - b57 - b58 - b59 + - b60 - b61 - b62 - b63 - b64 - b65 - b66 - b67 - b68 - b69 + - b70 - b71 - b72 - b73 - b74 - b75 - b76 - b77 - b78 - b79 + - b80 - b81 - b82 - b83 - b84 - b85 - b86 - b87 - b88 - b89 + - b90 - b91 - b92 - b93 - b94 - b95 - b96 - b97 - b98 - b99 + - b100 - b101 - b102 - b103 - b104 - b105 - b106 - b107 - b108 - b109 + - b110 - b111 - b112 - b113 - b114 - b115 - b116 - b117 - b118 - b119 + - b120 - b121 - b122 - b123 - b124 - b125 - b126 - b127 - b128 - b129 + - b130 - b131 - b132 - b133 - b134 - b135 - b136 - b137 - b138 - b139 + - b140 - b141 - b142 - b143 - b144 - b145 - b146 - b147 - b148 - b149 + - b150 - b151 - b152 - b153 - b154 - b155 - b156 - b157 - b158 - b159 + - b160 - b161 - b162 ; } diff --git a/test/mppa/interop/stackhell.c b/test/mppa/interop/stackhell.c index 849367d1..7be2ed30 100644 --- a/test/mppa/interop/stackhell.c +++ b/test/mppa/interop/stackhell.c @@ -2,8 +2,8 @@ #include "common.h" BEGIN_TEST(double) - c = stackhell(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, - -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, - -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); + c = stackhell(a, b, a-b, a-b, a*2, b*2, a*2-b, a-b*2, (a-b)*2, (a-b)*2, + -2*a, -2*b, a-b, a-b, a*3, b*3, a*3-b, a-b*3, (a-b)*3, (a-b)*3, + -3*a, -3*b, a-b, a-b, a*4, b*4, a*4-b, a-b*4, (a-b)*4, (a-b)*4); END_TESTF64() -- cgit From b169a1c8b88feee186d96c107562aff847caf235 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 19 Mar 2019 12:13:27 +0100 Subject: Replacing all the - by * : it works! --- test/mppa/interop/common.c | 364 +++++++++++++++++++++--------------------- test/mppa/interop/stackhell.c | 6 +- 2 files changed, 185 insertions(+), 185 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/interop/common.c b/test/mppa/interop/common.c index 07111361..e939e0d1 100644 --- a/test/mppa/interop/common.c +++ b/test/mppa/interop/common.c @@ -8,9 +8,9 @@ #define MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,\ a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,\ a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)\ - (a0 - a1 - a2 - a3 - a4 - a5 - a6 - a7 - a8 - a9 -\ - a10 - a11 - a12 - a13 - a14 - a15 - a16 - a17 - a18 - a19 -\ - a20 - a21 - a22 - a23 - a24 - a25 - a26 - a27 - a28 - a29) + (a0 * a1 * a2 * a3 * a4 * a5 * a6 * a7 * a8 * a9 *\ + a10 * a11 * a12 * a13 * a14 * a15 * a16 * a17 * a18 * a19 *\ + a20 * a21 * a22 * a23 * a24 * a25 * a26 * a27 * a28 * a29) void void_void(){ STACK; @@ -66,188 +66,188 @@ double stackhell(char a0, int a1, float a2, long long a3, double a4, char a5, lo char a20, int a21, char a22, long long a23, float a24, char a25, long long a26, int a27, double a28, long long a29) { long long b0 = a0; - long long b1 = a1 - b0; - long long b2 = a2 - b1; - float b3 = a3 - b2; - int b4 = a4 - b3; - double b5 = a5 - b4; - int b6 = a6 - b5; - float b7 = a7 - b6; - char b8 = a8 - b7; - double b9 = a9 - b8; - char b10 = a10 - b9; - float b11 = a11 - b10; - char b12 = a12 - b11; - int b13 = a13 - b12; - long long b14 = a14 - b13; - long long b15 = a15 - b14; - long long b16 = a16 - b15; - long long b17 = a17 - b16; - long long b18 = a18 - b17; - long long b19 = a19 - b18; - long long b20 = a20 - b19; - long long b21 = a21 - b20; - long long b22 = a22 - b21; - long long b23 = a23 - b22; - long long b24 = a24 - b23; - long long b25 = a25 - b24; - long long b26 = a26 - b25; - long long b27 = a27 - b26; - int b28 = a28 - b27; - double b29 = a29 - b28; - float b30 = b0 - b29; - double b31 = b1 - b30; - int b32 = b2 - b31; - char b33 = b3 - b32; - float b34 = b4 - b33; - char b35 = b5 - b34; - double b36 = b6 - b35; - float b37 = b7 - b36; - int b38 = b8 - b37; - double b39 = b9 - b38; - float b40 = b0 - b39; - int b41 = b1 - b40; - double b42 = b2 - b41; - float b43 = b3 - b42; - int b44 = b4 - b43; - double b45 = b5 - b44; - int b46 = b6 - b45; - double b47 = b7 - b46; - int b48 = b8 - b47; - long long b49 = b9 - b48; - long long b50 = b0 - b49; - long long b51 = b1 - b50; - long long b52 = b2 - b51; - long long b53 = b3 - b52; - long long b54 = b4 - b53; - long long b55 = b5 - b54; - long long b56 = b6 - b55; - long long b57 = b7 - b56; - int b58 = b8 - b57; - float b59 = b9 - b58; - int b60 = b0 - b59; - float b61 = b1 - b60; - float b62 = b2 - b61; - int b63 = b3 - b62; - double b64 = b4 - b63; - int b65 = b5 - b64; - int b66 = b6 - b65; - double b67 = b7 - b66; - double b68 = b8 - b67; - int b69 = b9 - b68; - char b70 = b0 - b69; - char b71 = b1 - b70; - double b72 = b2 - b71; - double b73 = b3 - b72; - char b74 = b4 - b73; - float b75 = b5 - b74; - float b76 = b6 - b75; - double b77 = b7 - b76; - char b78 = b8 - b77; - float b79 = b9 - b78; - float b80 = b0 - b79; - char b81 = b1 - b80; - char b82 = b2 - b81; - float b83 = b3 - b82; - char b84 = b4 - b83; - int b85 = b5 - b84; - int b86 = b6 - b85; - double b87 = b7 - b86; - float b88 = b8 - b87; - double b89 = b9 - b88; - int b90 = b0 - b89; - float b91 = b1 - b90; - double b92 = b2 - b91; - int b93 = b3 - b92; - int b94 = b4 - b93; - long long b95 = b5 - b94; - long long b96 = b6 - b95; - long long b97 = b7 - b96; - long long b98 = b8 - b97; - long long b99 = b9 - b98; - long long b100 = b0 - b99; - long long b101 = b1 - b100; - long long b102 = b2 - b101; - long long b103 = b3 - b102; - long long b104 = b4 - b103; - long long b105 = b5 - b104; - long long b106 = b6 - b105; - long long b107 = b7 - b106; - long long b108 = b8 - b107; - long long b109 = b9 - b108; - long long b110 = b0 - b109; - long long b111 = b1 - b110; - long long b112 = b2 - b111; - long long b113 = b3 - b112; - long long b114 = b4 - b113; - int b115 = b5 - b114; - int b116 = b6 - b115; - int b117 = b7 - b116; - float b118 = b8 - b117; - float b119 = b9 - b118; - int b120 = b0 - b119; - double b121 = b1 - b120; - float b122 = b2 - b121; - int b123 = b3 - b122; - double b124 = b4 - b123; - int b125 = b5 - b124; - char b126 = b6 - b125; - double b127 = b7 - b126; - char b128 = b8 - b127; - float b129 = b9 - b128; - char b130 = b0 - b129; - double b131 = b1 - b130; - char b132 = b2 - b131; - float b133 = b3 - b132; - char b134 = b4 - b133; - double b135 = b5 - b134; - char b136 = b6 - b135; - float b137 = b7 - b136; - char b138 = b8 - b137; - double b139 = b9 - b138; - char b140 = b0 - b139; - float b141 = b1 - b140; - char b142 = b2 - b141; - double b143 = b3 - b142; - char b144 = b4 - b143; - float b145 = b5 - b144; - char b146 = b6 - b145; - double b147 = b7 - b146; - int b148 = b8 - b147; - float b149 = b9 - b148; - int b150 = b0 - b149; - double b151 = b1 - b150; - int b152 = b2 - b151; - float b153 = b3 - b152; - int b154 = b4 - b153; - double b155 = b5 - b154; - int b156 = b6 - b155; - float b157 = b7 - b156; - int b158 = b8 - b157; - double b159 = b9 - b158; - int b160 = b0 - b159; - float b161 = b1 - b160; - int b162 = b2 - b161; + long long b1 = a1 * b0; + long long b2 = a2 * b1; + float b3 = a3 * b2; + int b4 = a4 * b3; + double b5 = a5 * b4; + int b6 = a6 * b5; + float b7 = a7 * b6; + char b8 = a8 * b7; + double b9 = a9 * b8; + char b10 = a10 * b9; + float b11 = a11 * b10; + char b12 = a12 * b11; + int b13 = a13 * b12; + long long b14 = a14 * b13; + long long b15 = a15 * b14; + long long b16 = a16 * b15; + long long b17 = a17 * b16; + long long b18 = a18 * b17; + long long b19 = a19 * b18; + long long b20 = a20 * b19; + long long b21 = a21 * b20; + long long b22 = a22 * b21; + long long b23 = a23 * b22; + long long b24 = a24 * b23; + long long b25 = a25 * b24; + long long b26 = a26 * b25; + long long b27 = a27 * b26; + int b28 = a28 * b27; + double b29 = a29 * b28; + float b30 = b0 * b29; + double b31 = b1 * b30; + int b32 = b2 * b31; + char b33 = b3 * b32; + float b34 = b4 * b33; + char b35 = b5 * b34; + double b36 = b6 * b35; + float b37 = b7 * b36; + int b38 = b8 * b37; + double b39 = b9 * b38; + float b40 = b0 * b39; + int b41 = b1 * b40; + double b42 = b2 * b41; + float b43 = b3 * b42; + int b44 = b4 * b43; + double b45 = b5 * b44; + int b46 = b6 * b45; + double b47 = b7 * b46; + int b48 = b8 * b47; + long long b49 = b9 * b48; + long long b50 = b0 * b49; + long long b51 = b1 * b50; + long long b52 = b2 * b51; + long long b53 = b3 * b52; + long long b54 = b4 * b53; + long long b55 = b5 * b54; + long long b56 = b6 * b55; + long long b57 = b7 * b56; + int b58 = b8 * b57; + float b59 = b9 * b58; + int b60 = b0 * b59; + float b61 = b1 * b60; + float b62 = b2 * b61; + int b63 = b3 * b62; + double b64 = b4 * b63; + int b65 = b5 * b64; + int b66 = b6 * b65; + double b67 = b7 * b66; + double b68 = b8 * b67; + int b69 = b9 * b68; + char b70 = b0 * b69; + char b71 = b1 * b70; + double b72 = b2 * b71; + double b73 = b3 * b72; + char b74 = b4 * b73; + float b75 = b5 * b74; + float b76 = b6 * b75; + double b77 = b7 * b76; + char b78 = b8 * b77; + float b79 = b9 * b78; + float b80 = b0 * b79; + char b81 = b1 * b80; + char b82 = b2 * b81; + float b83 = b3 * b82; + char b84 = b4 * b83; + int b85 = b5 * b84; + int b86 = b6 * b85; + double b87 = b7 * b86; + float b88 = b8 * b87; + double b89 = b9 * b88; + int b90 = b0 * b89; + float b91 = b1 * b90; + double b92 = b2 * b91; + int b93 = b3 * b92; + int b94 = b4 * b93; + long long b95 = b5 * b94; + long long b96 = b6 * b95; + long long b97 = b7 * b96; + long long b98 = b8 * b97; + long long b99 = b9 * b98; + long long b100 = b0 * b99; + long long b101 = b1 * b100; + long long b102 = b2 * b101; + long long b103 = b3 * b102; + long long b104 = b4 * b103; + long long b105 = b5 * b104; + long long b106 = b6 * b105; + long long b107 = b7 * b106; + long long b108 = b8 * b107; + long long b109 = b9 * b108; + long long b110 = b0 * b109; + long long b111 = b1 * b110; + long long b112 = b2 * b111; + long long b113 = b3 * b112; + long long b114 = b4 * b113; + int b115 = b5 * b114; + int b116 = b6 * b115; + int b117 = b7 * b116; + float b118 = b8 * b117; + float b119 = b9 * b118; + int b120 = b0 * b119; + double b121 = b1 * b120; + float b122 = b2 * b121; + int b123 = b3 * b122; + double b124 = b4 * b123; + int b125 = b5 * b124; + char b126 = b6 * b125; + double b127 = b7 * b126; + char b128 = b8 * b127; + float b129 = b9 * b128; + char b130 = b0 * b129; + double b131 = b1 * b130; + char b132 = b2 * b131; + float b133 = b3 * b132; + char b134 = b4 * b133; + double b135 = b5 * b134; + char b136 = b6 * b135; + float b137 = b7 * b136; + char b138 = b8 * b137; + double b139 = b9 * b138; + char b140 = b0 * b139; + float b141 = b1 * b140; + char b142 = b2 * b141; + double b143 = b3 * b142; + char b144 = b4 * b143; + float b145 = b5 * b144; + char b146 = b6 * b145; + double b147 = b7 * b146; + int b148 = b8 * b147; + float b149 = b9 * b148; + int b150 = b0 * b149; + double b151 = b1 * b150; + int b152 = b2 * b151; + float b153 = b3 * b152; + int b154 = b4 * b153; + double b155 = b5 * b154; + int b156 = b6 * b155; + float b157 = b7 * b156; + int b158 = b8 * b157; + double b159 = b9 * b158; + int b160 = b0 * b159; + float b161 = b1 * b160; + int b162 = b2 * b161; return MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29) - - b0 - b1 - b2 - b3 - b4 - b5 - b6 - b7 - b8 - b9 - - b10 - b11 - b12 - b13 - b14 - b15 - b16 - b17 - b18 - b19 - - b20 - b21 - b22 - b23 - b24 - b25 - b26 - b27 - b28 - b29 - - b30 - b31 - b32 - b33 - b34 - b35 - b36 - b37 - b38 - b39 - - b40 - b41 - b42 - b43 - b44 - b45 - b46 - b47 - b48 - b49 - - b50 - b51 - b52 - b53 - b54 - b55 - b56 - b57 - b58 - b59 - - b60 - b61 - b62 - b63 - b64 - b65 - b66 - b67 - b68 - b69 - - b70 - b71 - b72 - b73 - b74 - b75 - b76 - b77 - b78 - b79 - - b80 - b81 - b82 - b83 - b84 - b85 - b86 - b87 - b88 - b89 - - b90 - b91 - b92 - b93 - b94 - b95 - b96 - b97 - b98 - b99 - - b100 - b101 - b102 - b103 - b104 - b105 - b106 - b107 - b108 - b109 - - b110 - b111 - b112 - b113 - b114 - b115 - b116 - b117 - b118 - b119 - - b120 - b121 - b122 - b123 - b124 - b125 - b126 - b127 - b128 - b129 - - b130 - b131 - b132 - b133 - b134 - b135 - b136 - b137 - b138 - b139 - - b140 - b141 - b142 - b143 - b144 - b145 - b146 - b147 - b148 - b149 - - b150 - b151 - b152 - b153 - b154 - b155 - b156 - b157 - b158 - b159 - - b160 - b161 - b162 + * b0 * b1 * b2 * b3 * b4 * b5 * b6 * b7 * b8 * b9 + * b10 * b11 * b12 * b13 * b14 * b15 * b16 * b17 * b18 * b19 + * b20 * b21 * b22 * b23 * b24 * b25 * b26 * b27 * b28 * b29 + * b30 * b31 * b32 * b33 * b34 * b35 * b36 * b37 * b38 * b39 + * b40 * b41 * b42 * b43 * b44 * b45 * b46 * b47 * b48 * b49 + * b50 * b51 * b52 * b53 * b54 * b55 * b56 * b57 * b58 * b59 + * b60 * b61 * b62 * b63 * b64 * b65 * b66 * b67 * b68 * b69 + * b70 * b71 * b72 * b73 * b74 * b75 * b76 * b77 * b78 * b79 + * b80 * b81 * b82 * b83 * b84 * b85 * b86 * b87 * b88 * b89 + * b90 * b91 * b92 * b93 * b94 * b95 * b96 * b97 * b98 * b99 + * b100 * b101 * b102 * b103 * b104 * b105 * b106 * b107 * b108 * b109 + * b110 * b111 * b112 * b113 * b114 * b115 * b116 * b117 * b118 * b119 + * b120 * b121 * b122 * b123 * b124 * b125 * b126 * b127 * b128 * b129 + * b130 * b131 * b132 * b133 * b134 * b135 * b136 * b137 * b138 * b139 + * b140 * b141 * b142 * b143 * b144 * b145 * b146 * b147 * b148 * b149 + * b150 * b151 * b152 * b153 * b154 * b155 * b156 * b157 * b158 * b159 + * b160 * b161 * b162 ; } diff --git a/test/mppa/interop/stackhell.c b/test/mppa/interop/stackhell.c index 7be2ed30..5abaa71d 100644 --- a/test/mppa/interop/stackhell.c +++ b/test/mppa/interop/stackhell.c @@ -2,8 +2,8 @@ #include "common.h" BEGIN_TEST(double) - c = stackhell(a, b, a-b, a-b, a*2, b*2, a*2-b, a-b*2, (a-b)*2, (a-b)*2, - -2*a, -2*b, a-b, a-b, a*3, b*3, a*3-b, a-b*3, (a-b)*3, (a-b)*3, - -3*a, -3*b, a-b, a-b, a*4, b*4, a*4-b, a-b*4, (a-b)*4, (a-b)*4); + c = stackhell(a, b, a*b, a*b, a*2, b*2, a*2*b, a*b*2, (a*b)*2, (a*b)*2, + 2*a, 2*b, a*b, a*b, a*3, b*3, a*3*b, a*b*3, (a*b)*3, (a*b)*3, + 3*a, 3*b, a*b, a*b, a*4, b*4, a*4*b, a*b*4, (a*b)*4, (a*b)*4); END_TESTF64() -- cgit From 4f45e2926fa9d0dba400ec6b6a1506c898cad13d Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 22 Mar 2019 11:10:11 +0100 Subject: Reorganized the test/mppa/ tests to have fewer of them --- 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/cast_S32_S64.c | 7 -- test/mppa/instr/cast_S64_U32.c | 7 -- test/mppa/instr/cast_U32_S64.c | 7 -- 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/doubleconv.c | 9 --- test/mppa/instr/f32.c | 8 ++ test/mppa/instr/f64.c | 8 ++ test/mppa/instr/faddd.c | 5 -- test/mppa/instr/faddw.c | 5 -- test/mppa/instr/floatconv.c | 9 --- test/mppa/instr/fmuld.c | 7 -- test/mppa/instr/fmulw.c | 7 -- test/mppa/instr/fnegd.c | 7 -- test/mppa/instr/fnegw.c | 7 -- test/mppa/instr/for.c | 9 --- test/mppa/instr/forvar.c | 9 --- test/mppa/instr/forvarl.c | 10 --- test/mppa/instr/fsbfd.c | 7 -- test/mppa/instr/fsbfw.c | 7 -- test/mppa/instr/i32.c | 87 ++++++++++++++++++++ test/mppa/instr/i64.c | 107 +++++++++++++++++++++++++ test/mppa/instr/indirect_call.c | 33 -------- test/mppa/instr/indirect_tailcall.c | 33 -------- test/mppa/instr/individual/andw.c | 5 ++ test/mppa/instr/individual/branch.c | 10 +++ test/mppa/instr/individual/branchz.c | 10 +++ test/mppa/instr/individual/branchzu.c | 11 +++ test/mppa/instr/individual/call.c | 16 ++++ test/mppa/instr/individual/cast_S32_S64.c | 7 ++ test/mppa/instr/individual/cast_S64_U32.c | 7 ++ test/mppa/instr/individual/cb.deqz.c | 10 +++ test/mppa/instr/individual/cb.dgez.c | 10 +++ test/mppa/instr/individual/cb.dgtz.c | 10 +++ test/mppa/instr/individual/cb.dlez.c | 10 +++ test/mppa/instr/individual/cb.dltz.c | 10 +++ test/mppa/instr/individual/cb.dnez.c | 10 +++ test/mppa/instr/individual/cb.wgez.c | 10 +++ test/mppa/instr/individual/cb.wgtz.c | 10 +++ test/mppa/instr/individual/cb.wlez.c | 10 +++ test/mppa/instr/individual/cb.wltz.c | 10 +++ test/mppa/instr/individual/compd.eq.c | 7 ++ test/mppa/instr/individual/compd.geu.c | 7 ++ test/mppa/instr/individual/compd.gt.c | 7 ++ test/mppa/instr/individual/compd.le.c | 7 ++ test/mppa/instr/individual/compd.leu.c | 7 ++ test/mppa/instr/individual/compd.lt.c | 7 ++ test/mppa/instr/individual/compd.ltu.c | 7 ++ test/mppa/instr/individual/compd.ne.c | 7 ++ test/mppa/instr/individual/compw.eq.c | 7 ++ test/mppa/instr/individual/compw.geu.c | 7 ++ test/mppa/instr/individual/compw.gt.c | 7 ++ test/mppa/instr/individual/compw.gtu.c | 7 ++ test/mppa/instr/individual/compw.le.c | 7 ++ test/mppa/instr/individual/compw.leu.c | 7 ++ test/mppa/instr/individual/compw.lt.c | 7 ++ test/mppa/instr/individual/compw.ltu.c | 7 ++ test/mppa/instr/individual/compw.ne.c | 7 ++ test/mppa/instr/individual/div2.c | 7 ++ test/mppa/instr/individual/doubleconv.c | 9 +++ test/mppa/instr/individual/floatconv.c | 9 +++ test/mppa/instr/individual/fmuld.c | 7 ++ test/mppa/instr/individual/fmulw.c | 7 ++ test/mppa/instr/individual/fnegd.c | 7 ++ test/mppa/instr/individual/fnegw.c | 7 ++ test/mppa/instr/individual/for.c | 9 +++ test/mppa/instr/individual/forvar.c | 9 +++ test/mppa/instr/individual/forvarl.c | 10 +++ test/mppa/instr/individual/fsbfd.c | 7 ++ test/mppa/instr/individual/fsbfw.c | 7 ++ test/mppa/instr/individual/indirect_call.c | 33 ++++++++ test/mppa/instr/individual/indirect_tailcall.c | 33 ++++++++ test/mppa/instr/individual/lbs.c | 9 +++ test/mppa/instr/individual/lbz.c | 9 +++ test/mppa/instr/individual/muld.c | 7 ++ test/mppa/instr/individual/mulw.c | 7 ++ test/mppa/instr/individual/negd.c | 7 ++ test/mppa/instr/individual/ord.c | 7 ++ test/mppa/instr/individual/sbfd.c | 7 ++ test/mppa/instr/individual/sbfw.c | 7 ++ test/mppa/instr/individual/simple.c | 7 ++ test/mppa/instr/individual/sllw.c | 7 ++ test/mppa/instr/individual/srad.c | 7 ++ test/mppa/instr/individual/srld.c | 7 ++ test/mppa/instr/individual/tailcall.c | 16 ++++ test/mppa/instr/individual/udivd.c | 7 ++ test/mppa/instr/individual/umodd.c | 7 ++ test/mppa/instr/individual/xord.c | 7 ++ 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/tailcall.c | 16 ---- test/mppa/instr/udivd.c | 7 -- test/mppa/instr/ui32.c | 12 +++ test/mppa/instr/ui64.c | 10 +++ test/mppa/instr/umodd.c | 7 -- test/mppa/instr/xord.c | 7 -- test/mppa/interop/i32.c | 13 +++ test/mppa/interop/i64.c | 14 ++++ test/mppa/interop/i_manyiargs.c | 9 --- test/mppa/interop/i_multiiargs.c | 6 -- test/mppa/interop/i_oneiarg.c | 6 -- test/mppa/interop/individual/i_multiiargs.c | 6 ++ test/mppa/interop/individual/i_oneiarg.c | 6 ++ test/mppa/interop/individual/ll_multillargs.c | 7 ++ test/mppa/interop/individual/ll_onellarg.c | 7 ++ test/mppa/interop/individual/ll_void.c | 7 ++ test/mppa/interop/individual/void_void.c | 7 ++ test/mppa/interop/ll_manyllargs.c | 8 -- test/mppa/interop/ll_multillargs.c | 7 -- test/mppa/interop/ll_onellarg.c | 7 -- test/mppa/interop/ll_void.c | 7 -- test/mppa/interop/void_void.c | 7 -- 156 files changed, 870 insertions(+), 662 deletions(-) delete mode 100644 test/mppa/instr/addw.c delete mode 100644 test/mppa/instr/andd.c delete mode 100644 test/mppa/instr/andw.c delete mode 100644 test/mppa/instr/branch.c delete mode 100644 test/mppa/instr/branchz.c delete mode 100644 test/mppa/instr/branchzu.c delete mode 100644 test/mppa/instr/call.c delete mode 100644 test/mppa/instr/cast_S32_S64.c delete mode 100644 test/mppa/instr/cast_S64_U32.c delete mode 100644 test/mppa/instr/cast_U32_S64.c delete mode 100644 test/mppa/instr/cb.deqz.c delete mode 100644 test/mppa/instr/cb.dgez.c delete mode 100644 test/mppa/instr/cb.dgtz.c delete mode 100644 test/mppa/instr/cb.dlez.c delete mode 100644 test/mppa/instr/cb.dltz.c delete mode 100644 test/mppa/instr/cb.dnez.c delete mode 100644 test/mppa/instr/cb.wgez.c delete mode 100644 test/mppa/instr/cb.wgtz.c delete mode 100644 test/mppa/instr/cb.wlez.c delete mode 100644 test/mppa/instr/cb.wltz.c delete mode 100644 test/mppa/instr/compd.eq.c delete mode 100644 test/mppa/instr/compd.geu.c delete mode 100644 test/mppa/instr/compd.gt.c delete mode 100644 test/mppa/instr/compd.gtu.c delete mode 100644 test/mppa/instr/compd.le.c delete mode 100644 test/mppa/instr/compd.leu.c delete mode 100644 test/mppa/instr/compd.lt.c delete mode 100644 test/mppa/instr/compd.ltu.c delete mode 100644 test/mppa/instr/compd.ne.c delete mode 100644 test/mppa/instr/compw.eq.c delete mode 100644 test/mppa/instr/compw.geu.c delete mode 100644 test/mppa/instr/compw.gt.c delete mode 100644 test/mppa/instr/compw.gtu.c delete mode 100644 test/mppa/instr/compw.le.c delete mode 100644 test/mppa/instr/compw.leu.c delete mode 100644 test/mppa/instr/compw.lt.c delete mode 100644 test/mppa/instr/compw.ltu.c delete mode 100644 test/mppa/instr/compw.ne.c delete mode 100644 test/mppa/instr/div2.c delete mode 100644 test/mppa/instr/doubleconv.c create mode 100644 test/mppa/instr/f32.c create mode 100644 test/mppa/instr/f64.c delete mode 100644 test/mppa/instr/faddd.c delete mode 100644 test/mppa/instr/faddw.c delete mode 100644 test/mppa/instr/floatconv.c delete mode 100644 test/mppa/instr/fmuld.c delete mode 100644 test/mppa/instr/fmulw.c delete mode 100644 test/mppa/instr/fnegd.c delete mode 100644 test/mppa/instr/fnegw.c delete mode 100644 test/mppa/instr/for.c delete mode 100644 test/mppa/instr/forvar.c delete mode 100644 test/mppa/instr/forvarl.c delete mode 100644 test/mppa/instr/fsbfd.c delete mode 100644 test/mppa/instr/fsbfw.c create mode 100644 test/mppa/instr/i32.c create mode 100644 test/mppa/instr/i64.c delete mode 100644 test/mppa/instr/indirect_call.c delete mode 100644 test/mppa/instr/indirect_tailcall.c create mode 100644 test/mppa/instr/individual/andw.c create mode 100644 test/mppa/instr/individual/branch.c create mode 100644 test/mppa/instr/individual/branchz.c create mode 100644 test/mppa/instr/individual/branchzu.c create mode 100644 test/mppa/instr/individual/call.c create mode 100644 test/mppa/instr/individual/cast_S32_S64.c create mode 100644 test/mppa/instr/individual/cast_S64_U32.c create mode 100644 test/mppa/instr/individual/cb.deqz.c create mode 100644 test/mppa/instr/individual/cb.dgez.c create mode 100644 test/mppa/instr/individual/cb.dgtz.c create mode 100644 test/mppa/instr/individual/cb.dlez.c create mode 100644 test/mppa/instr/individual/cb.dltz.c create mode 100644 test/mppa/instr/individual/cb.dnez.c create mode 100644 test/mppa/instr/individual/cb.wgez.c create mode 100644 test/mppa/instr/individual/cb.wgtz.c create mode 100644 test/mppa/instr/individual/cb.wlez.c create mode 100644 test/mppa/instr/individual/cb.wltz.c create mode 100644 test/mppa/instr/individual/compd.eq.c create mode 100644 test/mppa/instr/individual/compd.geu.c create mode 100644 test/mppa/instr/individual/compd.gt.c create mode 100644 test/mppa/instr/individual/compd.le.c create mode 100644 test/mppa/instr/individual/compd.leu.c create mode 100644 test/mppa/instr/individual/compd.lt.c create mode 100644 test/mppa/instr/individual/compd.ltu.c create mode 100644 test/mppa/instr/individual/compd.ne.c create mode 100644 test/mppa/instr/individual/compw.eq.c create mode 100644 test/mppa/instr/individual/compw.geu.c create mode 100644 test/mppa/instr/individual/compw.gt.c create mode 100644 test/mppa/instr/individual/compw.gtu.c create mode 100644 test/mppa/instr/individual/compw.le.c create mode 100644 test/mppa/instr/individual/compw.leu.c create mode 100644 test/mppa/instr/individual/compw.lt.c create mode 100644 test/mppa/instr/individual/compw.ltu.c create mode 100644 test/mppa/instr/individual/compw.ne.c create mode 100644 test/mppa/instr/individual/div2.c create mode 100644 test/mppa/instr/individual/doubleconv.c create mode 100644 test/mppa/instr/individual/floatconv.c create mode 100644 test/mppa/instr/individual/fmuld.c create mode 100644 test/mppa/instr/individual/fmulw.c create mode 100644 test/mppa/instr/individual/fnegd.c create mode 100644 test/mppa/instr/individual/fnegw.c create mode 100644 test/mppa/instr/individual/for.c create mode 100644 test/mppa/instr/individual/forvar.c create mode 100644 test/mppa/instr/individual/forvarl.c create mode 100644 test/mppa/instr/individual/fsbfd.c create mode 100644 test/mppa/instr/individual/fsbfw.c create mode 100644 test/mppa/instr/individual/indirect_call.c create mode 100644 test/mppa/instr/individual/indirect_tailcall.c create mode 100644 test/mppa/instr/individual/lbs.c create mode 100644 test/mppa/instr/individual/lbz.c create mode 100644 test/mppa/instr/individual/muld.c create mode 100644 test/mppa/instr/individual/mulw.c create mode 100644 test/mppa/instr/individual/negd.c create mode 100644 test/mppa/instr/individual/ord.c create mode 100644 test/mppa/instr/individual/sbfd.c create mode 100644 test/mppa/instr/individual/sbfw.c create mode 100644 test/mppa/instr/individual/simple.c create mode 100644 test/mppa/instr/individual/sllw.c create mode 100644 test/mppa/instr/individual/srad.c create mode 100644 test/mppa/instr/individual/srld.c create mode 100644 test/mppa/instr/individual/tailcall.c create mode 100644 test/mppa/instr/individual/udivd.c create mode 100644 test/mppa/instr/individual/umodd.c create mode 100644 test/mppa/instr/individual/xord.c delete mode 100644 test/mppa/instr/lbs.c delete mode 100644 test/mppa/instr/lbz.c delete mode 100644 test/mppa/instr/muld.c delete mode 100644 test/mppa/instr/mulw.c delete mode 100644 test/mppa/instr/negd.c delete mode 100644 test/mppa/instr/ord.c delete mode 100644 test/mppa/instr/sbfd.c delete mode 100644 test/mppa/instr/sbfw.c delete mode 100644 test/mppa/instr/simple.c delete mode 100644 test/mppa/instr/sllw.c delete mode 100644 test/mppa/instr/srad.c delete mode 100644 test/mppa/instr/srld.c delete mode 100644 test/mppa/instr/tailcall.c delete mode 100644 test/mppa/instr/udivd.c create mode 100644 test/mppa/instr/ui32.c create mode 100644 test/mppa/instr/ui64.c delete mode 100644 test/mppa/instr/umodd.c delete mode 100644 test/mppa/instr/xord.c create mode 100644 test/mppa/interop/i32.c create mode 100644 test/mppa/interop/i64.c delete mode 100644 test/mppa/interop/i_manyiargs.c delete mode 100644 test/mppa/interop/i_multiiargs.c delete mode 100644 test/mppa/interop/i_oneiarg.c create mode 100644 test/mppa/interop/individual/i_multiiargs.c create mode 100644 test/mppa/interop/individual/i_oneiarg.c create mode 100644 test/mppa/interop/individual/ll_multillargs.c create mode 100644 test/mppa/interop/individual/ll_onellarg.c create mode 100644 test/mppa/interop/individual/ll_void.c create mode 100644 test/mppa/interop/individual/void_void.c delete mode 100644 test/mppa/interop/ll_manyllargs.c delete mode 100644 test/mppa/interop/ll_multillargs.c delete mode 100644 test/mppa/interop/ll_onellarg.c delete mode 100644 test/mppa/interop/ll_void.c delete mode 100644 test/mppa/interop/void_void.c (limited to 'test/mppa') diff --git a/test/mppa/instr/addw.c b/test/mppa/instr/addw.c deleted file mode 100644 index e22024cf..00000000 --- a/test/mppa/instr/addw.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) - c = a+b; -END_TEST32() diff --git a/test/mppa/instr/andd.c b/test/mppa/instr/andd.c deleted file mode 100644 index e3221bd7..00000000 --- a/test/mppa/instr/andd.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) - c = a&b; -END_TEST64() diff --git a/test/mppa/instr/andw.c b/test/mppa/instr/andw.c deleted file mode 100644 index 799dc7fb..00000000 --- a/test/mppa/instr/andw.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) - c = a&b; -END_TEST32() diff --git a/test/mppa/instr/branch.c b/test/mppa/instr/branch.c deleted file mode 100644 index c9937e31..00000000 --- a/test/mppa/instr/branch.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - if ((a & 0x1) == 1) - c = 0; - else - c = 1; -} -END_TEST32() diff --git a/test/mppa/instr/branchz.c b/test/mppa/instr/branchz.c deleted file mode 100644 index d3e021b5..00000000 --- a/test/mppa/instr/branchz.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - if (a & 0x1 == 0) - c = 0; - else - c = 1; -} -END_TEST32() diff --git a/test/mppa/instr/branchzu.c b/test/mppa/instr/branchzu.c deleted file mode 100644 index d0169174..00000000 --- a/test/mppa/instr/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_TEST32() diff --git a/test/mppa/instr/call.c b/test/mppa/instr/call.c deleted file mode 100644 index ba2ec323..00000000 --- a/test/mppa/instr/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_TEST32() -/* RETURN VALUE: 60 */ diff --git a/test/mppa/instr/cast_S32_S64.c b/test/mppa/instr/cast_S32_S64.c deleted file mode 100644 index 09c97e00..00000000 --- a/test/mppa/instr/cast_S32_S64.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (long long) a; -} -END_TEST32() diff --git a/test/mppa/instr/cast_S64_U32.c b/test/mppa/instr/cast_S64_U32.c deleted file mode 100644 index 2d9dc723..00000000 --- a/test/mppa/instr/cast_S64_U32.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = (unsigned int) a; -} -END_TEST64() diff --git a/test/mppa/instr/cast_U32_S64.c b/test/mppa/instr/cast_U32_S64.c deleted file mode 100644 index 6f9cd059..00000000 --- a/test/mppa/instr/cast_U32_S64.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (long long) a; -} -END_TEST32() diff --git a/test/mppa/instr/cb.deqz.c b/test/mppa/instr/cb.deqz.c deleted file mode 100644 index 6da2ab07..00000000 --- a/test/mppa/instr/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_TEST64() diff --git a/test/mppa/instr/cb.dgez.c b/test/mppa/instr/cb.dgez.c deleted file mode 100644 index 7bef25ad..00000000 --- a/test/mppa/instr/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_TEST64() diff --git a/test/mppa/instr/cb.dgtz.c b/test/mppa/instr/cb.dgtz.c deleted file mode 100644 index 1a43fb1f..00000000 --- a/test/mppa/instr/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_TEST64() diff --git a/test/mppa/instr/cb.dlez.c b/test/mppa/instr/cb.dlez.c deleted file mode 100644 index 2fb97939..00000000 --- a/test/mppa/instr/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_TEST64() diff --git a/test/mppa/instr/cb.dltz.c b/test/mppa/instr/cb.dltz.c deleted file mode 100644 index a431d5d0..00000000 --- a/test/mppa/instr/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_TEST64() diff --git a/test/mppa/instr/cb.dnez.c b/test/mppa/instr/cb.dnez.c deleted file mode 100644 index 44516cbe..00000000 --- a/test/mppa/instr/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_TEST64() diff --git a/test/mppa/instr/cb.wgez.c b/test/mppa/instr/cb.wgez.c deleted file mode 100644 index 5779ad92..00000000 --- a/test/mppa/instr/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_TEST32() diff --git a/test/mppa/instr/cb.wgtz.c b/test/mppa/instr/cb.wgtz.c deleted file mode 100644 index abb695bd..00000000 --- a/test/mppa/instr/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_TEST32() diff --git a/test/mppa/instr/cb.wlez.c b/test/mppa/instr/cb.wlez.c deleted file mode 100644 index 3a2e08c1..00000000 --- a/test/mppa/instr/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_TEST32() diff --git a/test/mppa/instr/cb.wltz.c b/test/mppa/instr/cb.wltz.c deleted file mode 100644 index 5d52c72a..00000000 --- a/test/mppa/instr/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_TEST32() diff --git a/test/mppa/instr/compd.eq.c b/test/mppa/instr/compd.eq.c deleted file mode 100644 index 4fe8de2a..00000000 --- a/test/mppa/instr/compd.eq.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = ((a & 0x1LL) == (b & 0x1LL)); -} -END_TEST64() diff --git a/test/mppa/instr/compd.geu.c b/test/mppa/instr/compd.geu.c deleted file mode 100644 index fccf0804..00000000 --- a/test/mppa/instr/compd.geu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = (a >= b); -} -END_TEST64() diff --git a/test/mppa/instr/compd.gt.c b/test/mppa/instr/compd.gt.c deleted file mode 100644 index b9901436..00000000 --- a/test/mppa/instr/compd.gt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = (a > b); -} -END_TEST64() diff --git a/test/mppa/instr/compd.gtu.c b/test/mppa/instr/compd.gtu.c deleted file mode 100644 index 7b2b96a6..00000000 --- a/test/mppa/instr/compd.gtu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = (a > b); -} -END_TEST64() diff --git a/test/mppa/instr/compd.le.c b/test/mppa/instr/compd.le.c deleted file mode 100644 index 6fa0f103..00000000 --- a/test/mppa/instr/compd.le.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = (a <= b); -} -END_TEST64() diff --git a/test/mppa/instr/compd.leu.c b/test/mppa/instr/compd.leu.c deleted file mode 100644 index 1ad18281..00000000 --- a/test/mppa/instr/compd.leu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = (a <= b); -} -END_TEST64() diff --git a/test/mppa/instr/compd.lt.c b/test/mppa/instr/compd.lt.c deleted file mode 100644 index c42cda56..00000000 --- a/test/mppa/instr/compd.lt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = (a < b); -} -END_TEST64() diff --git a/test/mppa/instr/compd.ltu.c b/test/mppa/instr/compd.ltu.c deleted file mode 100644 index b03d4d53..00000000 --- a/test/mppa/instr/compd.ltu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = (a < b); -} -END_TEST64() diff --git a/test/mppa/instr/compd.ne.c b/test/mppa/instr/compd.ne.c deleted file mode 100644 index fd9d0b28..00000000 --- a/test/mppa/instr/compd.ne.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = ((a & 0x1ULL) != (b & 0x1ULL)); -} -END_TEST64() diff --git a/test/mppa/instr/compw.eq.c b/test/mppa/instr/compw.eq.c deleted file mode 100644 index cd93f365..00000000 --- a/test/mppa/instr/compw.eq.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = ((a & 0x1) == (b & 0x1)); -} -END_TEST32() diff --git a/test/mppa/instr/compw.geu.c b/test/mppa/instr/compw.geu.c deleted file mode 100644 index b8fb1adf..00000000 --- a/test/mppa/instr/compw.geu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (a >= b); -} -END_TEST32() diff --git a/test/mppa/instr/compw.gt.c b/test/mppa/instr/compw.gt.c deleted file mode 100644 index 5f6bc907..00000000 --- a/test/mppa/instr/compw.gt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (a > b); -} -END_TEST32() diff --git a/test/mppa/instr/compw.gtu.c b/test/mppa/instr/compw.gtu.c deleted file mode 100644 index 947f6a14..00000000 --- a/test/mppa/instr/compw.gtu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (a > b); -} -END_TEST32() diff --git a/test/mppa/instr/compw.le.c b/test/mppa/instr/compw.le.c deleted file mode 100644 index 35ec6b7d..00000000 --- a/test/mppa/instr/compw.le.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (a <= b); -} -END_TEST32() diff --git a/test/mppa/instr/compw.leu.c b/test/mppa/instr/compw.leu.c deleted file mode 100644 index 74ebfb42..00000000 --- a/test/mppa/instr/compw.leu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (a <= b); -} -END_TEST32() diff --git a/test/mppa/instr/compw.lt.c b/test/mppa/instr/compw.lt.c deleted file mode 100644 index cb1f30bd..00000000 --- a/test/mppa/instr/compw.lt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (a < b); -} -END_TEST32() diff --git a/test/mppa/instr/compw.ltu.c b/test/mppa/instr/compw.ltu.c deleted file mode 100644 index 6a0c5af1..00000000 --- a/test/mppa/instr/compw.ltu.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = (a < b); -} -END_TEST32() diff --git a/test/mppa/instr/compw.ne.c b/test/mppa/instr/compw.ne.c deleted file mode 100644 index 7035e2c7..00000000 --- a/test/mppa/instr/compw.ne.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned int) -{ - c = ((a & 0x1U) != (b & 0x1U)); -} -END_TEST32() diff --git a/test/mppa/instr/div2.c b/test/mppa/instr/div2.c deleted file mode 100644 index b5dfe63a..00000000 --- a/test/mppa/instr/div2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = (a + b) / 2; -} -END_TEST32() diff --git a/test/mppa/instr/doubleconv.c b/test/mppa/instr/doubleconv.c deleted file mode 100644 index 55b1ddab..00000000 --- a/test/mppa/instr/doubleconv.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "framework.h" - -double long2double(long v){ - return v; -} - -BEGIN_TEST(long) - c = (long) long2double(a) + (long) long2double(b) + (long) long2double(42.3); -END_TEST64() diff --git a/test/mppa/instr/f32.c b/test/mppa/instr/f32.c new file mode 100644 index 00000000..7e304aeb --- /dev/null +++ b/test/mppa/instr/f32.c @@ -0,0 +1,8 @@ +#include "framework.h" + +BEGIN_TEST(float) + c = ((float)a + (float)b); + c += ((float)a * (float)b); + c += (-(float)a); + c += ((float)a - (float)b); +END_TESTF32() diff --git a/test/mppa/instr/f64.c b/test/mppa/instr/f64.c new file mode 100644 index 00000000..be8094c9 --- /dev/null +++ b/test/mppa/instr/f64.c @@ -0,0 +1,8 @@ +#include "framework.h" + +BEGIN_TEST(double) + c = ((double)a + (double)b); + c += ((double)a * (double)b); + c += (-(double)a); + c += ((double)a - (double)b); +END_TESTF64() diff --git a/test/mppa/instr/faddd.c b/test/mppa/instr/faddd.c deleted file mode 100644 index 35b7fc92..00000000 --- a/test/mppa/instr/faddd.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(double) - c = ((double)a + (double)b); -END_TESTF64() diff --git a/test/mppa/instr/faddw.c b/test/mppa/instr/faddw.c deleted file mode 100644 index e0e635ae..00000000 --- a/test/mppa/instr/faddw.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(float) - c = ((float)a + (float)b); -END_TESTF32() diff --git a/test/mppa/instr/floatconv.c b/test/mppa/instr/floatconv.c deleted file mode 100644 index 32b798e1..00000000 --- a/test/mppa/instr/floatconv.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "framework.h" - -float int2float(int v){ - return v; -} - -BEGIN_TEST(int) - c = (int) int2float(a) + (int) int2float(b) + (int) int2float(42.3); -END_TEST32() diff --git a/test/mppa/instr/fmuld.c b/test/mppa/instr/fmuld.c deleted file mode 100644 index 03c990fa..00000000 --- a/test/mppa/instr/fmuld.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(double) -{ - c = ((double)a * (double)b); -} -END_TESTF64() diff --git a/test/mppa/instr/fmulw.c b/test/mppa/instr/fmulw.c deleted file mode 100644 index f85eba64..00000000 --- a/test/mppa/instr/fmulw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(float) -{ - c = ((float)a * (float)b); -} -END_TESTF32() diff --git a/test/mppa/instr/fnegd.c b/test/mppa/instr/fnegd.c deleted file mode 100644 index 974eb7e8..00000000 --- a/test/mppa/instr/fnegd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(double) -{ - c = (-(double)a); -} -END_TESTF64() diff --git a/test/mppa/instr/fnegw.c b/test/mppa/instr/fnegw.c deleted file mode 100644 index fbeaab8e..00000000 --- a/test/mppa/instr/fnegw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(float) -{ - c = (-(float)a); -} -END_TESTF64() diff --git a/test/mppa/instr/for.c b/test/mppa/instr/for.c deleted file mode 100644 index 373ab6bd..00000000 --- a/test/mppa/instr/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_TEST32() diff --git a/test/mppa/instr/forvar.c b/test/mppa/instr/forvar.c deleted file mode 100644 index 9e43c198..00000000 --- a/test/mppa/instr/forvar.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - int k; - for (k = 0 ; k < (b & 0x8) ; k++) - c += a; -} -END_TEST32() diff --git a/test/mppa/instr/forvarl.c b/test/mppa/instr/forvarl.c deleted file mode 100644 index c1fe90fd..00000000 --- a/test/mppa/instr/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_TEST64() diff --git a/test/mppa/instr/fsbfd.c b/test/mppa/instr/fsbfd.c deleted file mode 100644 index f80c1efe..00000000 --- a/test/mppa/instr/fsbfd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(double) -{ - c = ((double)a - (double)b); -} -END_TESTF64() diff --git a/test/mppa/instr/fsbfw.c b/test/mppa/instr/fsbfw.c deleted file mode 100644 index 067c40b5..00000000 --- a/test/mppa/instr/fsbfw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(float) -{ - c = ((float)a - (float)b); -} -END_TESTF64() diff --git a/test/mppa/instr/i32.c b/test/mppa/instr/i32.c new file mode 100644 index 00000000..c48531b1 --- /dev/null +++ b/test/mppa/instr/i32.c @@ -0,0 +1,87 @@ +#include "framework.h" + +int sum(int a, int b){ + return a+b; +} + +int make(int a){ + return a; +} + +int tailsum(int a, int b){ + return make(a+b); +} + +float int2float(int v){ + return v; +} + +BEGIN_TEST(int) + c = a+b; + c += a&b; + + if ((a & 0x1) == 1) + c += 1; + else + c += 2; + + if (a & 0x1 == 0) + c += 4; + else + c += 8; + + b = !(a & 0x01); + if (!b) + c += 16; + else + c += 32; + + c += sum(make(a), make(b)); + c += (long long) a; + + if (0 > (a & 0x1) - 1) + c += 64; + else + c += 128; + + if (0 >= (a & 0x1)) + c += 256; + else + c += 512; + + if ((a & 0x1) > 0) + c += 1024; + else + c += 2048; + + if ((a & 0x1) - 1 >= 0) + c += 4096; + else + c += 8192; + + c += ((a & 0x1) == (b & 0x1)); + c += (a > b); + c += (a <= b); + c += (a < b); + c += (a + b) / 2; + c += (int) int2float(a) + (int) int2float(b) + (int) int2float(42.3); + + int j; + for (j = 0 ; j < 10 ; j++) + c += a; + int k; + for (k = 0 ; k < (b & 0x8) ; k++) + c += a; + + char s[] = "Tome and Cherry at the playa\n"; + c += s[(a & (sizeof(s)-1))]; + + unsigned char s2[] = "Tim is sorry at the playa\n"; + c += s2[a & (sizeof(s) - 1)]; + + c += a*b; + c += a-b; + c += a << (b & 0x8); + + c += sum(a, b); +END_TEST32() diff --git a/test/mppa/instr/i64.c b/test/mppa/instr/i64.c new file mode 100644 index 00000000..00eb159d --- /dev/null +++ b/test/mppa/instr/i64.c @@ -0,0 +1,107 @@ +#include "framework.h" + +long long sum(long long a, long long b){ + return a+b; +} + +long long diff(long long a, long long b){ + return a-b; +} + +long long mul(long long a, long long b){ + return a*b; +} + +long long make(long long a){ + return a; +} + +long long random_op(long long a, long long b){ + long long d = 3; + long long (*op)(long long, long long); + + if (a % d == 0) + op = sum; + else if (a % d == 1) + op = diff; + else + op = mul; + + return op(a, b); +} + +double long2double(long v){ + return v; +} + +BEGIN_TEST(long long) + c = a&b; + c += a*b; + c += -a; + c += a | b; + c += a-b; + c += a >> (b & 0x8LL); + c += a >> (b & 0x8ULL); + c += a % b; + + long long d = 3; + long long (*op)(long long, long long); + + if (a % d == 0) + op = sum; + else if (a % d == 1) + op = diff; + else + op = mul; + + c += op(make(a), make(b)); + c += random_op(a, b); + c += a/b; + c += a^b; + c += (unsigned int) a; + + if (0 != (a & 0x1LL)) + c += 1; + else + c += 2; + + if (0 > (a & 0x1LL)) + c += 4; + else + c += 8; + + if (0 >= (a & 0x1LL) - 1) + c += 16; + else + c += 32; + + if (a & 0x1LL > 0) + c += 64; + else + c += 128; + + if ((a & 0x1LL) - 1 >= 0) + c += 256; + else + c += 512; + + if (0 == (a & 0x1LL)) + c += 1024; + else + c += 2048; + + c += ((a & 0x1LL) == (b & 0x1LL)); + c += (a >= b); + c += (a > b); + c += (a <= b); + c += (a < b); + c += (long) long2double(a) + (long) long2double(b) + (long) long2double(42.3); + + int j; + + for (j = 0 ; j < (b & 0x8LL) ; j++) + c += a; + + c += ((a & 0x1LL) == (b & 0x1LL)); + +END_TEST64() diff --git a/test/mppa/instr/indirect_call.c b/test/mppa/instr/indirect_call.c deleted file mode 100644 index f376c00a..00000000 --- a/test/mppa/instr/indirect_call.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "framework.h" - -long long sum(long long a, long long b){ - return a+b; -} - -long long diff(long long a, long long b){ - return a-b; -} - -long long mul(long long a, long long b){ - return a*b; -} - -long long make(long long a){ - return a; -} - -BEGIN_TEST(long long) -{ - long long d = 3; - long long (*op)(long long, long long); - - if (a % d == 0) - op = sum; - else if (a % d == 1) - op = diff; - else - op = mul; - - c += op(make(a), make(b)); -} -END_TEST64() diff --git a/test/mppa/instr/indirect_tailcall.c b/test/mppa/instr/indirect_tailcall.c deleted file mode 100644 index e6c16ea1..00000000 --- a/test/mppa/instr/indirect_tailcall.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "framework.h" - -long long sum(long long a, long long b){ - return a+b; -} - -long long diff(long long a, long long b){ - return a-b; -} - -long long mul(long long a, long long b){ - return a*b; -} - -long long random_op(long long a, long long b){ - long long d = 3; - long long (*op)(long long, long long); - - if (a % d == 0) - op = sum; - else if (a % d == 1) - op = diff; - else - op = mul; - - return op(a, b); -} - -BEGIN_TEST(long long) -{ - c += random_op(a, b); -} -END_TEST64() diff --git a/test/mppa/instr/individual/andw.c b/test/mppa/instr/individual/andw.c new file mode 100644 index 00000000..799dc7fb --- /dev/null +++ b/test/mppa/instr/individual/andw.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(int) + c = a&b; +END_TEST32() diff --git a/test/mppa/instr/individual/branch.c b/test/mppa/instr/individual/branch.c new file mode 100644 index 00000000..c9937e31 --- /dev/null +++ b/test/mppa/instr/individual/branch.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if ((a & 0x1) == 1) + c = 0; + else + c = 1; +} +END_TEST32() diff --git a/test/mppa/instr/individual/branchz.c b/test/mppa/instr/individual/branchz.c new file mode 100644 index 00000000..d3e021b5 --- /dev/null +++ b/test/mppa/instr/individual/branchz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if (a & 0x1 == 0) + c = 0; + else + c = 1; +} +END_TEST32() diff --git a/test/mppa/instr/individual/branchzu.c b/test/mppa/instr/individual/branchzu.c new file mode 100644 index 00000000..d0169174 --- /dev/null +++ b/test/mppa/instr/individual/branchzu.c @@ -0,0 +1,11 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + b = !(a & 0x01); + if (!b) + c = 0; + else + c = 1; +} +END_TEST32() diff --git a/test/mppa/instr/individual/call.c b/test/mppa/instr/individual/call.c new file mode 100644 index 00000000..ba2ec323 --- /dev/null +++ b/test/mppa/instr/individual/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_TEST32() +/* RETURN VALUE: 60 */ diff --git a/test/mppa/instr/individual/cast_S32_S64.c b/test/mppa/instr/individual/cast_S32_S64.c new file mode 100644 index 00000000..09c97e00 --- /dev/null +++ b/test/mppa/instr/individual/cast_S32_S64.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (long long) a; +} +END_TEST32() diff --git a/test/mppa/instr/individual/cast_S64_U32.c b/test/mppa/instr/individual/cast_S64_U32.c new file mode 100644 index 00000000..2d9dc723 --- /dev/null +++ b/test/mppa/instr/individual/cast_S64_U32.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = (unsigned int) a; +} +END_TEST64() diff --git a/test/mppa/instr/individual/cb.deqz.c b/test/mppa/instr/individual/cb.deqz.c new file mode 100644 index 00000000..6da2ab07 --- /dev/null +++ b/test/mppa/instr/individual/cb.deqz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (0 != (a & 0x1LL)) + c = 1; + else + c = 0; +} +END_TEST64() diff --git a/test/mppa/instr/individual/cb.dgez.c b/test/mppa/instr/individual/cb.dgez.c new file mode 100644 index 00000000..7bef25ad --- /dev/null +++ b/test/mppa/instr/individual/cb.dgez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (0 > (a & 0x1LL)) + c = 1; + else + c = 0; +} +END_TEST64() diff --git a/test/mppa/instr/individual/cb.dgtz.c b/test/mppa/instr/individual/cb.dgtz.c new file mode 100644 index 00000000..1a43fb1f --- /dev/null +++ b/test/mppa/instr/individual/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_TEST64() diff --git a/test/mppa/instr/individual/cb.dlez.c b/test/mppa/instr/individual/cb.dlez.c new file mode 100644 index 00000000..2fb97939 --- /dev/null +++ b/test/mppa/instr/individual/cb.dlez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (a & 0x1LL > 0) + c = 1; + else + c = 0; +} +END_TEST64() diff --git a/test/mppa/instr/individual/cb.dltz.c b/test/mppa/instr/individual/cb.dltz.c new file mode 100644 index 00000000..a431d5d0 --- /dev/null +++ b/test/mppa/instr/individual/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_TEST64() diff --git a/test/mppa/instr/individual/cb.dnez.c b/test/mppa/instr/individual/cb.dnez.c new file mode 100644 index 00000000..44516cbe --- /dev/null +++ b/test/mppa/instr/individual/cb.dnez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + if (0 == (a & 0x1LL)) + c = 1; + else + c = 0; +} +END_TEST64() diff --git a/test/mppa/instr/individual/cb.wgez.c b/test/mppa/instr/individual/cb.wgez.c new file mode 100644 index 00000000..5779ad92 --- /dev/null +++ b/test/mppa/instr/individual/cb.wgez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if (0 > (a & 0x1) - 1) + c = 1; + else + c = 0; +} +END_TEST32() diff --git a/test/mppa/instr/individual/cb.wgtz.c b/test/mppa/instr/individual/cb.wgtz.c new file mode 100644 index 00000000..abb695bd --- /dev/null +++ b/test/mppa/instr/individual/cb.wgtz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if (0 >= (a & 0x1)) + c = 1; + else + c = 0; +} +END_TEST32() diff --git a/test/mppa/instr/individual/cb.wlez.c b/test/mppa/instr/individual/cb.wlez.c new file mode 100644 index 00000000..3a2e08c1 --- /dev/null +++ b/test/mppa/instr/individual/cb.wlez.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if ((a & 0x1) > 0) + c = 1; + else + c = 0; +} +END_TEST32() diff --git a/test/mppa/instr/individual/cb.wltz.c b/test/mppa/instr/individual/cb.wltz.c new file mode 100644 index 00000000..5d52c72a --- /dev/null +++ b/test/mppa/instr/individual/cb.wltz.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + if ((a & 0x1) - 1 >= 0) + c = 1; + else + c = 0; +} +END_TEST32() diff --git a/test/mppa/instr/individual/compd.eq.c b/test/mppa/instr/individual/compd.eq.c new file mode 100644 index 00000000..4fe8de2a --- /dev/null +++ b/test/mppa/instr/individual/compd.eq.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = ((a & 0x1LL) == (b & 0x1LL)); +} +END_TEST64() diff --git a/test/mppa/instr/individual/compd.geu.c b/test/mppa/instr/individual/compd.geu.c new file mode 100644 index 00000000..fccf0804 --- /dev/null +++ b/test/mppa/instr/individual/compd.geu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = (a >= b); +} +END_TEST64() diff --git a/test/mppa/instr/individual/compd.gt.c b/test/mppa/instr/individual/compd.gt.c new file mode 100644 index 00000000..b9901436 --- /dev/null +++ b/test/mppa/instr/individual/compd.gt.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = (a > b); +} +END_TEST64() diff --git a/test/mppa/instr/individual/compd.le.c b/test/mppa/instr/individual/compd.le.c new file mode 100644 index 00000000..6fa0f103 --- /dev/null +++ b/test/mppa/instr/individual/compd.le.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = (a <= b); +} +END_TEST64() diff --git a/test/mppa/instr/individual/compd.leu.c b/test/mppa/instr/individual/compd.leu.c new file mode 100644 index 00000000..1ad18281 --- /dev/null +++ b/test/mppa/instr/individual/compd.leu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = (a <= b); +} +END_TEST64() diff --git a/test/mppa/instr/individual/compd.lt.c b/test/mppa/instr/individual/compd.lt.c new file mode 100644 index 00000000..c42cda56 --- /dev/null +++ b/test/mppa/instr/individual/compd.lt.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = (a < b); +} +END_TEST64() diff --git a/test/mppa/instr/individual/compd.ltu.c b/test/mppa/instr/individual/compd.ltu.c new file mode 100644 index 00000000..b03d4d53 --- /dev/null +++ b/test/mppa/instr/individual/compd.ltu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = (a < b); +} +END_TEST64() diff --git a/test/mppa/instr/individual/compd.ne.c b/test/mppa/instr/individual/compd.ne.c new file mode 100644 index 00000000..fd9d0b28 --- /dev/null +++ b/test/mppa/instr/individual/compd.ne.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = ((a & 0x1ULL) != (b & 0x1ULL)); +} +END_TEST64() diff --git a/test/mppa/instr/individual/compw.eq.c b/test/mppa/instr/individual/compw.eq.c new file mode 100644 index 00000000..cd93f365 --- /dev/null +++ b/test/mppa/instr/individual/compw.eq.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = ((a & 0x1) == (b & 0x1)); +} +END_TEST32() diff --git a/test/mppa/instr/individual/compw.geu.c b/test/mppa/instr/individual/compw.geu.c new file mode 100644 index 00000000..b8fb1adf --- /dev/null +++ b/test/mppa/instr/individual/compw.geu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (a >= b); +} +END_TEST32() diff --git a/test/mppa/instr/individual/compw.gt.c b/test/mppa/instr/individual/compw.gt.c new file mode 100644 index 00000000..5f6bc907 --- /dev/null +++ b/test/mppa/instr/individual/compw.gt.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (a > b); +} +END_TEST32() diff --git a/test/mppa/instr/individual/compw.gtu.c b/test/mppa/instr/individual/compw.gtu.c new file mode 100644 index 00000000..947f6a14 --- /dev/null +++ b/test/mppa/instr/individual/compw.gtu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (a > b); +} +END_TEST32() diff --git a/test/mppa/instr/individual/compw.le.c b/test/mppa/instr/individual/compw.le.c new file mode 100644 index 00000000..35ec6b7d --- /dev/null +++ b/test/mppa/instr/individual/compw.le.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (a <= b); +} +END_TEST32() diff --git a/test/mppa/instr/individual/compw.leu.c b/test/mppa/instr/individual/compw.leu.c new file mode 100644 index 00000000..74ebfb42 --- /dev/null +++ b/test/mppa/instr/individual/compw.leu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (a <= b); +} +END_TEST32() diff --git a/test/mppa/instr/individual/compw.lt.c b/test/mppa/instr/individual/compw.lt.c new file mode 100644 index 00000000..cb1f30bd --- /dev/null +++ b/test/mppa/instr/individual/compw.lt.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (a < b); +} +END_TEST32() diff --git a/test/mppa/instr/individual/compw.ltu.c b/test/mppa/instr/individual/compw.ltu.c new file mode 100644 index 00000000..6a0c5af1 --- /dev/null +++ b/test/mppa/instr/individual/compw.ltu.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (a < b); +} +END_TEST32() diff --git a/test/mppa/instr/individual/compw.ne.c b/test/mppa/instr/individual/compw.ne.c new file mode 100644 index 00000000..7035e2c7 --- /dev/null +++ b/test/mppa/instr/individual/compw.ne.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = ((a & 0x1U) != (b & 0x1U)); +} +END_TEST32() diff --git a/test/mppa/instr/individual/div2.c b/test/mppa/instr/individual/div2.c new file mode 100644 index 00000000..b5dfe63a --- /dev/null +++ b/test/mppa/instr/individual/div2.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = (a + b) / 2; +} +END_TEST32() diff --git a/test/mppa/instr/individual/doubleconv.c b/test/mppa/instr/individual/doubleconv.c new file mode 100644 index 00000000..55b1ddab --- /dev/null +++ b/test/mppa/instr/individual/doubleconv.c @@ -0,0 +1,9 @@ +#include "framework.h" + +double long2double(long v){ + return v; +} + +BEGIN_TEST(long) + c = (long) long2double(a) + (long) long2double(b) + (long) long2double(42.3); +END_TEST64() diff --git a/test/mppa/instr/individual/floatconv.c b/test/mppa/instr/individual/floatconv.c new file mode 100644 index 00000000..32b798e1 --- /dev/null +++ b/test/mppa/instr/individual/floatconv.c @@ -0,0 +1,9 @@ +#include "framework.h" + +float int2float(int v){ + return v; +} + +BEGIN_TEST(int) + c = (int) int2float(a) + (int) int2float(b) + (int) int2float(42.3); +END_TEST32() diff --git a/test/mppa/instr/individual/fmuld.c b/test/mppa/instr/individual/fmuld.c new file mode 100644 index 00000000..03c990fa --- /dev/null +++ b/test/mppa/instr/individual/fmuld.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = ((double)a * (double)b); +} +END_TESTF64() diff --git a/test/mppa/instr/individual/fmulw.c b/test/mppa/instr/individual/fmulw.c new file mode 100644 index 00000000..f85eba64 --- /dev/null +++ b/test/mppa/instr/individual/fmulw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(float) +{ + c = ((float)a * (float)b); +} +END_TESTF32() diff --git a/test/mppa/instr/individual/fnegd.c b/test/mppa/instr/individual/fnegd.c new file mode 100644 index 00000000..974eb7e8 --- /dev/null +++ b/test/mppa/instr/individual/fnegd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = (-(double)a); +} +END_TESTF64() diff --git a/test/mppa/instr/individual/fnegw.c b/test/mppa/instr/individual/fnegw.c new file mode 100644 index 00000000..fbeaab8e --- /dev/null +++ b/test/mppa/instr/individual/fnegw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(float) +{ + c = (-(float)a); +} +END_TESTF64() diff --git a/test/mppa/instr/individual/for.c b/test/mppa/instr/individual/for.c new file mode 100644 index 00000000..373ab6bd --- /dev/null +++ b/test/mppa/instr/individual/for.c @@ -0,0 +1,9 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + int j; + for (j = 0 ; j < 10 ; j++) + c += a; +} +END_TEST32() diff --git a/test/mppa/instr/individual/forvar.c b/test/mppa/instr/individual/forvar.c new file mode 100644 index 00000000..9e43c198 --- /dev/null +++ b/test/mppa/instr/individual/forvar.c @@ -0,0 +1,9 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + int k; + for (k = 0 ; k < (b & 0x8) ; k++) + c += a; +} +END_TEST32() diff --git a/test/mppa/instr/individual/forvarl.c b/test/mppa/instr/individual/forvarl.c new file mode 100644 index 00000000..c1fe90fd --- /dev/null +++ b/test/mppa/instr/individual/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_TEST64() diff --git a/test/mppa/instr/individual/fsbfd.c b/test/mppa/instr/individual/fsbfd.c new file mode 100644 index 00000000..f80c1efe --- /dev/null +++ b/test/mppa/instr/individual/fsbfd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(double) +{ + c = ((double)a - (double)b); +} +END_TESTF64() diff --git a/test/mppa/instr/individual/fsbfw.c b/test/mppa/instr/individual/fsbfw.c new file mode 100644 index 00000000..067c40b5 --- /dev/null +++ b/test/mppa/instr/individual/fsbfw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(float) +{ + c = ((float)a - (float)b); +} +END_TESTF64() diff --git a/test/mppa/instr/individual/indirect_call.c b/test/mppa/instr/individual/indirect_call.c new file mode 100644 index 00000000..f376c00a --- /dev/null +++ b/test/mppa/instr/individual/indirect_call.c @@ -0,0 +1,33 @@ +#include "framework.h" + +long long sum(long long a, long long b){ + return a+b; +} + +long long diff(long long a, long long b){ + return a-b; +} + +long long mul(long long a, long long b){ + return a*b; +} + +long long make(long long a){ + return a; +} + +BEGIN_TEST(long long) +{ + long long d = 3; + long long (*op)(long long, long long); + + if (a % d == 0) + op = sum; + else if (a % d == 1) + op = diff; + else + op = mul; + + c += op(make(a), make(b)); +} +END_TEST64() diff --git a/test/mppa/instr/individual/indirect_tailcall.c b/test/mppa/instr/individual/indirect_tailcall.c new file mode 100644 index 00000000..e6c16ea1 --- /dev/null +++ b/test/mppa/instr/individual/indirect_tailcall.c @@ -0,0 +1,33 @@ +#include "framework.h" + +long long sum(long long a, long long b){ + return a+b; +} + +long long diff(long long a, long long b){ + return a-b; +} + +long long mul(long long a, long long b){ + return a*b; +} + +long long random_op(long long a, long long b){ + long long d = 3; + long long (*op)(long long, long long); + + if (a % d == 0) + op = sum; + else if (a % d == 1) + op = diff; + else + op = mul; + + return op(a, b); +} + +BEGIN_TEST(long long) +{ + c += random_op(a, b); +} +END_TEST64() diff --git a/test/mppa/instr/individual/lbs.c b/test/mppa/instr/individual/lbs.c new file mode 100644 index 00000000..22a50632 --- /dev/null +++ b/test/mppa/instr/individual/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_TEST32() diff --git a/test/mppa/instr/individual/lbz.c b/test/mppa/instr/individual/lbz.c new file mode 100644 index 00000000..04ba098d --- /dev/null +++ b/test/mppa/instr/individual/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_TEST32() diff --git a/test/mppa/instr/individual/muld.c b/test/mppa/instr/individual/muld.c new file mode 100644 index 00000000..f7e23850 --- /dev/null +++ b/test/mppa/instr/individual/muld.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a*b; +} +END_TEST64() diff --git a/test/mppa/instr/individual/mulw.c b/test/mppa/instr/individual/mulw.c new file mode 100644 index 00000000..a91d966e --- /dev/null +++ b/test/mppa/instr/individual/mulw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = a * b; +} +END_TEST32() diff --git a/test/mppa/instr/individual/negd.c b/test/mppa/instr/individual/negd.c new file mode 100644 index 00000000..837b9828 --- /dev/null +++ b/test/mppa/instr/individual/negd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = -a; +} +END_TEST64() diff --git a/test/mppa/instr/individual/ord.c b/test/mppa/instr/individual/ord.c new file mode 100644 index 00000000..cae1ae8b --- /dev/null +++ b/test/mppa/instr/individual/ord.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a | b; +} +END_TEST64() diff --git a/test/mppa/instr/individual/sbfd.c b/test/mppa/instr/individual/sbfd.c new file mode 100644 index 00000000..77c28c77 --- /dev/null +++ b/test/mppa/instr/individual/sbfd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a-b; +} +END_TEST64() diff --git a/test/mppa/instr/individual/sbfw.c b/test/mppa/instr/individual/sbfw.c new file mode 100644 index 00000000..e38a1fff --- /dev/null +++ b/test/mppa/instr/individual/sbfw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = a-b; +} +END_TEST32() diff --git a/test/mppa/instr/individual/simple.c b/test/mppa/instr/individual/simple.c new file mode 100644 index 00000000..944f09c9 --- /dev/null +++ b/test/mppa/instr/individual/simple.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = a+b; +} +END_TEST32() diff --git a/test/mppa/instr/individual/sllw.c b/test/mppa/instr/individual/sllw.c new file mode 100644 index 00000000..6dd41a6c --- /dev/null +++ b/test/mppa/instr/individual/sllw.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(int) +{ + c = a << (b & 0x8); +} +END_TEST32() diff --git a/test/mppa/instr/individual/srad.c b/test/mppa/instr/individual/srad.c new file mode 100644 index 00000000..00be9d0c --- /dev/null +++ b/test/mppa/instr/individual/srad.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a >> (b & 0x8LL); +} +END_TEST64() diff --git a/test/mppa/instr/individual/srld.c b/test/mppa/instr/individual/srld.c new file mode 100644 index 00000000..14970efd --- /dev/null +++ b/test/mppa/instr/individual/srld.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = a >> (b & 0x8ULL); +} +END_TEST64() diff --git a/test/mppa/instr/individual/tailcall.c b/test/mppa/instr/individual/tailcall.c new file mode 100644 index 00000000..6c659a01 --- /dev/null +++ b/test/mppa/instr/individual/tailcall.c @@ -0,0 +1,16 @@ +#include "framework.h" + +int make(int a){ + return a; +} + +int sum(int a, int b){ + return make(a+b); +} + +BEGIN_TEST(int) +{ + c = sum(a, b); +} +END_TEST32() +/* RETURN VALUE: 60 */ diff --git a/test/mppa/instr/individual/udivd.c b/test/mppa/instr/individual/udivd.c new file mode 100644 index 00000000..cfb31881 --- /dev/null +++ b/test/mppa/instr/individual/udivd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = a/b; +} +END_TEST64() diff --git a/test/mppa/instr/individual/umodd.c b/test/mppa/instr/individual/umodd.c new file mode 100644 index 00000000..a7f25f1c --- /dev/null +++ b/test/mppa/instr/individual/umodd.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = a%b; +} +END_TEST64() diff --git a/test/mppa/instr/individual/xord.c b/test/mppa/instr/individual/xord.c new file mode 100644 index 00000000..b6a90cb0 --- /dev/null +++ b/test/mppa/instr/individual/xord.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(long long) +{ + c = a^b; +} +END_TEST64() diff --git a/test/mppa/instr/lbs.c b/test/mppa/instr/lbs.c deleted file mode 100644 index 22a50632..00000000 --- a/test/mppa/instr/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_TEST32() diff --git a/test/mppa/instr/lbz.c b/test/mppa/instr/lbz.c deleted file mode 100644 index 04ba098d..00000000 --- a/test/mppa/instr/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_TEST32() diff --git a/test/mppa/instr/muld.c b/test/mppa/instr/muld.c deleted file mode 100644 index f7e23850..00000000 --- a/test/mppa/instr/muld.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a*b; -} -END_TEST64() diff --git a/test/mppa/instr/mulw.c b/test/mppa/instr/mulw.c deleted file mode 100644 index a91d966e..00000000 --- a/test/mppa/instr/mulw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = a * b; -} -END_TEST32() diff --git a/test/mppa/instr/negd.c b/test/mppa/instr/negd.c deleted file mode 100644 index 837b9828..00000000 --- a/test/mppa/instr/negd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = -a; -} -END_TEST64() diff --git a/test/mppa/instr/ord.c b/test/mppa/instr/ord.c deleted file mode 100644 index cae1ae8b..00000000 --- a/test/mppa/instr/ord.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a | b; -} -END_TEST64() diff --git a/test/mppa/instr/sbfd.c b/test/mppa/instr/sbfd.c deleted file mode 100644 index 77c28c77..00000000 --- a/test/mppa/instr/sbfd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a-b; -} -END_TEST64() diff --git a/test/mppa/instr/sbfw.c b/test/mppa/instr/sbfw.c deleted file mode 100644 index e38a1fff..00000000 --- a/test/mppa/instr/sbfw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = a-b; -} -END_TEST32() diff --git a/test/mppa/instr/simple.c b/test/mppa/instr/simple.c deleted file mode 100644 index 944f09c9..00000000 --- a/test/mppa/instr/simple.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = a+b; -} -END_TEST32() diff --git a/test/mppa/instr/sllw.c b/test/mppa/instr/sllw.c deleted file mode 100644 index 6dd41a6c..00000000 --- a/test/mppa/instr/sllw.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(int) -{ - c = a << (b & 0x8); -} -END_TEST32() diff --git a/test/mppa/instr/srad.c b/test/mppa/instr/srad.c deleted file mode 100644 index 00be9d0c..00000000 --- a/test/mppa/instr/srad.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a >> (b & 0x8LL); -} -END_TEST64() diff --git a/test/mppa/instr/srld.c b/test/mppa/instr/srld.c deleted file mode 100644 index 14970efd..00000000 --- a/test/mppa/instr/srld.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = a >> (b & 0x8ULL); -} -END_TEST64() diff --git a/test/mppa/instr/tailcall.c b/test/mppa/instr/tailcall.c deleted file mode 100644 index 6c659a01..00000000 --- a/test/mppa/instr/tailcall.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "framework.h" - -int make(int a){ - return a; -} - -int sum(int a, int b){ - return make(a+b); -} - -BEGIN_TEST(int) -{ - c = sum(a, b); -} -END_TEST32() -/* RETURN VALUE: 60 */ diff --git a/test/mppa/instr/udivd.c b/test/mppa/instr/udivd.c deleted file mode 100644 index cfb31881..00000000 --- a/test/mppa/instr/udivd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = a/b; -} -END_TEST64() diff --git a/test/mppa/instr/ui32.c b/test/mppa/instr/ui32.c new file mode 100644 index 00000000..f56a9b95 --- /dev/null +++ b/test/mppa/instr/ui32.c @@ -0,0 +1,12 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = (long long) a; + c += (a >= b); + c += (a > b); + c += (a <= b); + c += (a < b); + c += ((a & 0x1U) != (b & 0x1U)); +} +END_TEST32() diff --git a/test/mppa/instr/ui64.c b/test/mppa/instr/ui64.c new file mode 100644 index 00000000..908dec3c --- /dev/null +++ b/test/mppa/instr/ui64.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(unsigned long long) +{ + c = (a > b); + c += (a <= b); + c += (a < b); + c += ((a & 0x1ULL) != (b & 0x1ULL)); +} +END_TEST64() diff --git a/test/mppa/instr/umodd.c b/test/mppa/instr/umodd.c deleted file mode 100644 index a7f25f1c..00000000 --- a/test/mppa/instr/umodd.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(unsigned long long) -{ - c = a%b; -} -END_TEST64() diff --git a/test/mppa/instr/xord.c b/test/mppa/instr/xord.c deleted file mode 100644 index b6a90cb0..00000000 --- a/test/mppa/instr/xord.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" - -BEGIN_TEST(long long) -{ - c = a^b; -} -END_TEST64() diff --git a/test/mppa/interop/i32.c b/test/mppa/interop/i32.c new file mode 100644 index 00000000..6bc2705c --- /dev/null +++ b/test/mppa/interop/i32.c @@ -0,0 +1,13 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(int) + c = i_manyiargs(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, + -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, + -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); + c += i_multiiargs(a, b, a-b, a+b); + c += i_oneiarg(a); + void_void(); + c += a; +END_TEST32() + diff --git a/test/mppa/interop/i64.c b/test/mppa/interop/i64.c new file mode 100644 index 00000000..3e7240f7 --- /dev/null +++ b/test/mppa/interop/i64.c @@ -0,0 +1,14 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = ll_manyllargs(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, + -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, + -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); + c += ll_multillargs(a, b, a-b, a+b); + c += ll_onellarg(a); + c = ll_void(); + c += a; + void_void(); + c += a; +END_TEST64() diff --git a/test/mppa/interop/i_manyiargs.c b/test/mppa/interop/i_manyiargs.c deleted file mode 100644 index d674c26f..00000000 --- a/test/mppa/interop/i_manyiargs.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "framework.h" -#include "common.h" - -BEGIN_TEST(int) - c = i_manyiargs(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, - -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, - -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); -END_TEST() - diff --git a/test/mppa/interop/i_multiiargs.c b/test/mppa/interop/i_multiiargs.c deleted file mode 100644 index 0e8c8936..00000000 --- a/test/mppa/interop/i_multiiargs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "framework.h" -#include "common.h" - -BEGIN_TEST(int) - c = i_multiiargs(a, b, a-b, a+b); -END_TEST() diff --git a/test/mppa/interop/i_oneiarg.c b/test/mppa/interop/i_oneiarg.c deleted file mode 100644 index 42cd1540..00000000 --- a/test/mppa/interop/i_oneiarg.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "framework.h" -#include "common.h" - -BEGIN_TEST(int) - c = i_oneiarg(a); -END_TEST() diff --git a/test/mppa/interop/individual/i_multiiargs.c b/test/mppa/interop/individual/i_multiiargs.c new file mode 100644 index 00000000..888742b5 --- /dev/null +++ b/test/mppa/interop/individual/i_multiiargs.c @@ -0,0 +1,6 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(int) + c = i_multiiargs(a, b, a-b, a+b); +END_TEST32() diff --git a/test/mppa/interop/individual/i_oneiarg.c b/test/mppa/interop/individual/i_oneiarg.c new file mode 100644 index 00000000..9c969fb8 --- /dev/null +++ b/test/mppa/interop/individual/i_oneiarg.c @@ -0,0 +1,6 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(int) + c = i_oneiarg(a); +END_TEST32() diff --git a/test/mppa/interop/individual/ll_multillargs.c b/test/mppa/interop/individual/ll_multillargs.c new file mode 100644 index 00000000..34b422eb --- /dev/null +++ b/test/mppa/interop/individual/ll_multillargs.c @@ -0,0 +1,7 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = ll_multillargs(a, b, a-b, a+b); +END_TEST64() + diff --git a/test/mppa/interop/individual/ll_onellarg.c b/test/mppa/interop/individual/ll_onellarg.c new file mode 100644 index 00000000..a2fbbbe9 --- /dev/null +++ b/test/mppa/interop/individual/ll_onellarg.c @@ -0,0 +1,7 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = ll_onellarg(a); +END_TEST64() + diff --git a/test/mppa/interop/individual/ll_void.c b/test/mppa/interop/individual/ll_void.c new file mode 100644 index 00000000..da128fdd --- /dev/null +++ b/test/mppa/interop/individual/ll_void.c @@ -0,0 +1,7 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + c = ll_void(); + c += a; +END_TEST64() diff --git a/test/mppa/interop/individual/void_void.c b/test/mppa/interop/individual/void_void.c new file mode 100644 index 00000000..976a721b --- /dev/null +++ b/test/mppa/interop/individual/void_void.c @@ -0,0 +1,7 @@ +#include "framework.h" +#include "common.h" + +BEGIN_TEST(long long) + void_void(); + c = a; +END_TEST64() diff --git a/test/mppa/interop/ll_manyllargs.c b/test/mppa/interop/ll_manyllargs.c deleted file mode 100644 index 6e0b3b36..00000000 --- a/test/mppa/interop/ll_manyllargs.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "framework.h" -#include "common.h" - -BEGIN_TEST(long long) - c = ll_manyllargs(a, b, a-b, a+b, a*2, b*2, a*2-b, a+b*2, (a-b)*2, (a+b)*2, - -2*a, -2*b, a-b, a+b, a*3, b*3, a*3-b, a+b*3, (a-b)*3, (a+b)*3, - -3*a, -3*b, a-b, a+b, a*4, b*4, a*4-b, a+b*4, (a-b)*4, (a+b)*4); -END_TEST() diff --git a/test/mppa/interop/ll_multillargs.c b/test/mppa/interop/ll_multillargs.c deleted file mode 100644 index edb03b12..00000000 --- a/test/mppa/interop/ll_multillargs.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" -#include "common.h" - -BEGIN_TEST(long long) - c = ll_multillargs(a, b, a-b, a+b); -END_TEST() - diff --git a/test/mppa/interop/ll_onellarg.c b/test/mppa/interop/ll_onellarg.c deleted file mode 100644 index 0d182166..00000000 --- a/test/mppa/interop/ll_onellarg.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" -#include "common.h" - -BEGIN_TEST(long long) - c = ll_onellarg(a); -END_TEST() - diff --git a/test/mppa/interop/ll_void.c b/test/mppa/interop/ll_void.c deleted file mode 100644 index fa350c9b..00000000 --- a/test/mppa/interop/ll_void.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" -#include "common.h" - -BEGIN_TEST(long long) - c = ll_void(); - c += a; -END_TEST() diff --git a/test/mppa/interop/void_void.c b/test/mppa/interop/void_void.c deleted file mode 100644 index e729edb2..00000000 --- a/test/mppa/interop/void_void.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "framework.h" -#include "common.h" - -BEGIN_TEST(long long) - void_void(); - c = a; -END_TEST() -- cgit From 0edb9804b295e2cb332f86c252de70fa8e760710 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 22 Mar 2019 11:32:19 +0100 Subject: Rajout de tests test/mppa pour division/modulo --- test/mppa/instr/div32.c | 5 +++++ test/mppa/instr/divf32.c | 5 +++++ test/mppa/instr/divf64.c | 5 +++++ test/mppa/instr/divu32.c | 7 +++++++ test/mppa/instr/modi32.c | 5 +++++ test/mppa/instr/modui32.c | 7 +++++++ 6 files changed, 34 insertions(+) create mode 100644 test/mppa/instr/div32.c create mode 100644 test/mppa/instr/divf32.c create mode 100644 test/mppa/instr/divf64.c create mode 100644 test/mppa/instr/divu32.c create mode 100644 test/mppa/instr/modi32.c create mode 100644 test/mppa/instr/modui32.c (limited to 'test/mppa') diff --git a/test/mppa/instr/div32.c b/test/mppa/instr/div32.c new file mode 100644 index 00000000..83c3a0e3 --- /dev/null +++ b/test/mppa/instr/div32.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(int) + c = a/b; +END_TEST32() diff --git a/test/mppa/instr/divf32.c b/test/mppa/instr/divf32.c new file mode 100644 index 00000000..513a3293 --- /dev/null +++ b/test/mppa/instr/divf32.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(float) + c = a / b; +END_TESTF32() diff --git a/test/mppa/instr/divf64.c b/test/mppa/instr/divf64.c new file mode 100644 index 00000000..0dd23826 --- /dev/null +++ b/test/mppa/instr/divf64.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(double) + c = a / b; +END_TESTF64() diff --git a/test/mppa/instr/divu32.c b/test/mppa/instr/divu32.c new file mode 100644 index 00000000..1fe196c4 --- /dev/null +++ b/test/mppa/instr/divu32.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = a/b; +} +END_TEST32() diff --git a/test/mppa/instr/modi32.c b/test/mppa/instr/modi32.c new file mode 100644 index 00000000..958ae920 --- /dev/null +++ b/test/mppa/instr/modi32.c @@ -0,0 +1,5 @@ +#include "framework.h" + +BEGIN_TEST(int) + c = a%b; +END_TEST32() diff --git a/test/mppa/instr/modui32.c b/test/mppa/instr/modui32.c new file mode 100644 index 00000000..a39034a8 --- /dev/null +++ b/test/mppa/instr/modui32.c @@ -0,0 +1,7 @@ +#include "framework.h" + +BEGIN_TEST(unsigned int) +{ + c = a%b; +} +END_TEST32() -- cgit From 02083d1e3d82898197966ae1117d89eed9e4e22b Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Mon, 17 Jun 2019 16:31:40 +0200 Subject: Dans test/mppa : changer k1-mbr-gcc en k1-cos-gcc --- test/mppa/instr/Makefile | 6 ++++-- test/mppa/interop/Makefile | 4 +++- test/mppa/lib/Makefile | 4 ++-- test/mppa/mmult/Makefile | 2 +- test/mppa/prng/Makefile | 2 +- test/mppa/sort/Makefile | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index ea86114c..4129b628 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -1,4 +1,6 @@ -K1CC ?= k1-mbr-gcc +SHELL := /bin/bash + +K1CC ?= k1-cos-gcc CC ?= gcc CCOMP ?= ccomp OPTIM ?= -O2 @@ -48,7 +50,7 @@ NC=\033[0m .PHONY: test: $(X86_GCC_OUT) $(GCC_OUT) @echo "Comparing x86 gcc output to k1 gcc.." - @for test in $(TESTNAMES); do\ + for test in $(TESTNAMES); do\ x86out=$(OUTDIR)/$$test.x86-gcc.out;\ gccout=$(OUTDIR)/$$test.gcc.out;\ if $(DIFF) $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile index a405ebd6..e615e89a 100644 --- a/test/mppa/interop/Makefile +++ b/test/mppa/interop/Makefile @@ -1,4 +1,6 @@ -K1CC ?= k1-mbr-gcc +SHELL := /bin/bash + +K1CC ?= k1-cos-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -Wno-varargs diff --git a/test/mppa/lib/Makefile b/test/mppa/lib/Makefile index affc1afd..08901db6 100644 --- a/test/mppa/lib/Makefile +++ b/test/mppa/lib/Makefile @@ -1,5 +1,5 @@ -K1CC ?= k1-mbr-gcc -K1AR ?= k1-mbr-ar +K1CC ?= k1-cos-gcc +K1AR ?= k1-cos-ar CC ?= gcc AR ?= gcc-ar CCOMP ?= ccomp diff --git a/test/mppa/mmult/Makefile b/test/mppa/mmult/Makefile index 5895ce3d..667faef8 100644 --- a/test/mppa/mmult/Makefile +++ b/test/mppa/mmult/Makefile @@ -1,4 +1,4 @@ -K1CC ?= k1-mbr-gcc +K1CC ?= k1-cos-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 diff --git a/test/mppa/prng/Makefile b/test/mppa/prng/Makefile index 4770c901..9cbb3872 100644 --- a/test/mppa/prng/Makefile +++ b/test/mppa/prng/Makefile @@ -1,4 +1,4 @@ -K1CC ?= k1-mbr-gcc +K1CC ?= k1-cos-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 diff --git a/test/mppa/sort/Makefile b/test/mppa/sort/Makefile index 5173528c..0ae9d1f6 100644 --- a/test/mppa/sort/Makefile +++ b/test/mppa/sort/Makefile @@ -1,4 +1,4 @@ -K1CC ?= k1-mbr-gcc +K1CC ?= k1-cos-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 -- cgit From d9f2d0e8a6420f4f1da8c693960a55c38747d6eb Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 28 Aug 2019 10:45:49 +0200 Subject: Removing submodule test/mppa/asm_coverage from the repository --- test/mppa/asm_coverage | 1 - 1 file changed, 1 deletion(-) delete mode 160000 test/mppa/asm_coverage (limited to 'test/mppa') diff --git a/test/mppa/asm_coverage b/test/mppa/asm_coverage deleted file mode 160000 index a9c62b61..00000000 --- a/test/mppa/asm_coverage +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a9c62b61552a9e9fd0ebf43df5ee0d5b88bb0944 -- cgit From fcc8418db10cc0f6abe63e78e1fdca948d872c2d Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 29 Aug 2019 17:22:11 +0200 Subject: Updated test/mppa/coverage.sh to check which instruction isn't tested yet --- test/mppa/coverage.sh | 22 +++++++++----- test/mppa/coverage_helper.py | 70 +++++++++++++++++++++++++------------------- 2 files changed, 55 insertions(+), 37 deletions(-) mode change 100644 => 100755 test/mppa/coverage.sh (limited to 'test/mppa') diff --git a/test/mppa/coverage.sh b/test/mppa/coverage.sh old mode 100644 new mode 100755 index 0a057ff9..2b3dafc0 --- a/test/mppa/coverage.sh +++ b/test/mppa/coverage.sh @@ -1,17 +1,25 @@ -asmdir=$1 +#!/bin/bash + +asmdir=instr/asm/ to_cover_raw=/tmp/to_cover_raw to_cover=/tmp/to_cover covered_raw=/tmp/covered_raw covered=/tmp/covered -sed -n "s/^.*fprintf oc \" \(.*\) .*/\1/p" ../../mppa_k1c/TargetPrinter.ml > $to_cover_raw -sed -n "s/^.*fprintf oc \" \(.*\)\\n.*/\1/p" ../../mppa_k1c/TargetPrinter.ml >> $to_cover_raw -python2.7 coverage_helper.py $to_cover_raw > $to_cover +# Stop at any error +set -e +# Pipes do not mask errors +set -o pipefail + +sed -n "s/^.*fprintf oc \" \([^.].*\) .*/\1/p" ../../mppa_k1c/TargetPrinter.ml | sort -u > $to_cover_raw +sed -n "s/^.*fprintf oc \" \([^.].*\)\\n.*/\1/p" ../../mppa_k1c/TargetPrinter.ml | sort -u >> $to_cover_raw +python2.7 coverage_helper.py $to_cover_raw | sort -u > $to_cover rm -f $covered_raw -for asm in $(ls $asmdir/*.s); do - bash asm_coverage/asm-coverage.sh $asm >> $covered_raw +for asm in $(ls $asmdir/*.ccomp.s); do + grep -v ":" $asm | sed -n "s/^\s*\([a-z][a-z0-9.]*\).*/\1/p" | sort -u >> $covered_raw done -python2.7 coverage_helper.py $covered_raw > $covered +python2.7 coverage_helper.py $covered_raw | sort -u > $covered vimdiff $to_cover $covered + diff --git a/test/mppa/coverage_helper.py b/test/mppa/coverage_helper.py index b086aca9..42e0c887 100644 --- a/test/mppa/coverage_helper.py +++ b/test/mppa/coverage_helper.py @@ -1,35 +1,45 @@ import fileinput +import sys -occurs = {} +all_loads_stores = "lbs lbz lhz lo lq ld lhs lws sb sd sh so sq sw".split(" ") + +all_bconds = "wnez weqz wltz wgez wlez wgtz dnez deqz dltz dgez dlez dgtz".split(" ") + +all_iconds = "ne eq lt ge le gt ltu geu leu gtu all nall any none".split(" ") + +all_fconds = "one ueq oeq une olt uge oge ult".split(" ") + +replaces_a = [(["cb."], all_bconds), + (["compd.", "compw."], all_iconds), + (["fcompd.", "fcompw."], all_fconds), + (all_loads_stores, [".xs"])] +replaces_dd = [(["addx", "sbfx"], ["2d", "4d", "8d", "16d"])] +replaces_dw = [(["addx", "sbfx"], ["2w", "4w", "8w", "16w"])] + +macros_binds = {"%a": replaces_a, "%dd": replaces_dd, "%dw": replaces_dw} + +def expand_macro(fullinst, macro, replaceTable): + inst = fullinst.replace(macro, "") + for (searchlist, mods) in replaceTable: + if inst in searchlist: + return [fullinst.replace(macro, mod) for mod in mods] + raise NameError + +insts = [] for line in fileinput.input(): - line_noc = line.replace('\n', '') - if line_noc not in occurs: - occurs[line_noc] = 0 - occurs[line_noc] += 1 - -# HACK: Removing all the instructions with "%a", replacing them with all their variations -# Also removing all instructions starting with '.' -pruned_occurs = dict(occurs) -for inst in occurs: - if inst[0] == '.': - del pruned_occurs[inst] - if "%a" not in inst: - continue - inst_no_a = inst.replace(".%a", "") - if inst_no_a in ("compw", "compd"): - del pruned_occurs[inst] - for mod in ("ne", "eq", "lt", "gt", "le", "ge", "ltu", "leu", "geu", - "gtu", "all", "any", "nall", "none"): - pruned_occurs[inst_no_a + "." + mod] = 1 - elif inst_no_a in ("cb"): - del pruned_occurs[inst] - for mod in ("wnez", "weqz", "wltz", "wgez", "wlez", "wgtz", "deqz", "dnez", - "dltz", "dgez", "dlez", "dgtz"): - pruned_occurs[inst_no_a + "." + mod] = 1 - else: - assert False, "Found instruction with %a: " + inst -occurs = pruned_occurs - -for inst in sorted(occurs): + fullinst = line[:-1] + try: + for macro in macros_binds: + if macro in fullinst: + insts.extend(expand_macro(fullinst, macro, macros_binds[macro])) + break + else: + insts.append(fullinst) + except NameError: + print >> sys.stderr, fullinst + " could not be found any match for macro " + macro + sys.exit(1) + +for inst in insts: print inst +occurs = {} -- cgit From a160967d4ce131c6cad7c1c44b654e3aa5855023 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 30 Aug 2019 10:44:43 +0200 Subject: Fixed the extraction of instructions from TargetPrinter.ml --- test/mppa/coverage.sh | 5 ++--- test/mppa/coverage_helper.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/coverage.sh b/test/mppa/coverage.sh index 2b3dafc0..ec66c94e 100755 --- a/test/mppa/coverage.sh +++ b/test/mppa/coverage.sh @@ -1,5 +1,6 @@ #!/bin/bash +printer=../../mppa_k1c/TargetPrinter.ml asmdir=instr/asm/ to_cover_raw=/tmp/to_cover_raw to_cover=/tmp/to_cover @@ -11,8 +12,7 @@ set -e # Pipes do not mask errors set -o pipefail -sed -n "s/^.*fprintf oc \" \([^.].*\) .*/\1/p" ../../mppa_k1c/TargetPrinter.ml | sort -u > $to_cover_raw -sed -n "s/^.*fprintf oc \" \([^.].*\)\\n.*/\1/p" ../../mppa_k1c/TargetPrinter.ml | sort -u >> $to_cover_raw +sed -n "s/^.*fprintf\s*oc\s*\"\s*\([a-z][^[:space:]]*\)\s.*/\1/p" $printer > $to_cover_raw python2.7 coverage_helper.py $to_cover_raw | sort -u > $to_cover rm -f $covered_raw @@ -22,4 +22,3 @@ done python2.7 coverage_helper.py $covered_raw | sort -u > $covered vimdiff $to_cover $covered - diff --git a/test/mppa/coverage_helper.py b/test/mppa/coverage_helper.py index 42e0c887..cf7a84c9 100644 --- a/test/mppa/coverage_helper.py +++ b/test/mppa/coverage_helper.py @@ -9,10 +9,10 @@ all_iconds = "ne eq lt ge le gt ltu geu leu gtu all nall any none".split(" ") all_fconds = "one ueq oeq une olt uge oge ult".split(" ") -replaces_a = [(["cb."], all_bconds), +replaces_a = [(["cb.", "cmoved."], all_bconds), (["compd.", "compw."], all_iconds), (["fcompd.", "fcompw."], all_fconds), - (all_loads_stores, [".xs"])] + (all_loads_stores, [".xs", ""])] replaces_dd = [(["addx", "sbfx"], ["2d", "4d", "8d", "16d"])] replaces_dw = [(["addx", "sbfx"], ["2w", "4w", "8w", "16w"])] -- cgit From 96d03d469015db45828c89a68247f2c70c2bb102 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 30 Aug 2019 12:09:23 +0200 Subject: Adding tests for addx8d addx8w etc.. --- test/mppa/instr/Makefile | 5 +++-- test/mppa/instr/i32.c | 4 ++++ test/mppa/instr/i64.c | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 4129b628..33a265e3 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -5,6 +5,7 @@ CC ?= gcc CCOMP ?= ccomp OPTIM ?= -O2 CFLAGS ?= $(OPTIM) +CCOMPFLAGS ?= $(CFLAGS) -faddx SIMU ?= k1-mppa TIMEOUT ?= --signal=SIGTERM 120s DIFF ?= python2.7 floatcmp.py -reltol .00001 @@ -111,7 +112,7 @@ $(BINDIR)/%.gcc.bin: $(ASMDIR)/%.gcc.s $(K1LIB) $(K1CCPATH) $(BINDIR)/%.ccomp.bin: $(ASMDIR)/%.ccomp.s $(K1LIB) $(CCOMPPATH) @mkdir -p $(@D) - $(CCOMP) $(CFLAGS) $(filter-out $(CCOMPPATH),$^) -o $@ + $(CCOMP) $(CCOMPFLAGS) $(filter-out $(CCOMPPATH),$^) -o $@ # Source to assembly @@ -125,4 +126,4 @@ $(ASMDIR)/%.gcc.s: $(SRCDIR)/%.c $(K1CCPATH) $(ASMDIR)/%.ccomp.s: $(SRCDIR)/%.c $(CCOMPPATH) @mkdir -p $(@D) - $(CCOMP) $(CFLAGS) -S $< -o $@ + $(CCOMP) $(CCOMPFLAGS) -S $< -o $@ diff --git a/test/mppa/instr/i32.c b/test/mppa/instr/i32.c index c48531b1..c0985031 100644 --- a/test/mppa/instr/i32.c +++ b/test/mppa/instr/i32.c @@ -65,6 +65,10 @@ BEGIN_TEST(int) c += (a < b); c += (a + b) / 2; c += (int) int2float(a) + (int) int2float(b) + (int) int2float(42.3); + c += (a << 4); // addx16w + c += (a << 3); // addx8w + c += (a << 2); // addx4w + c += (a << 1); // addx2w int j; for (j = 0 ; j < 10 ; j++) diff --git a/test/mppa/instr/i64.c b/test/mppa/instr/i64.c index 00eb159d..84828bfb 100644 --- a/test/mppa/instr/i64.c +++ b/test/mppa/instr/i64.c @@ -43,6 +43,10 @@ BEGIN_TEST(long long) c += a >> (b & 0x8LL); c += a >> (b & 0x8ULL); c += a % b; + c += (a << 4); // addx16d + c += (a << 3); // addx8d + c += (a << 2); // addx4d + c += (a << 1); // addx2d long long d = 3; long long (*op)(long long, long long); -- cgit From 436bf1192e129427f6fcc99d2e6b75db08e80cf8 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 30 Aug 2019 15:08:07 +0200 Subject: (#157) Removed AFADDD and AFADDW from the builtins --- test/mppa/instr/Makefile | 5 ++++- test/mppa/instr/builtin64.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/mppa/instr/builtin64.c (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 33a265e3..69446796 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -46,6 +46,7 @@ all: $(BIN) GREEN=\033[0;32m RED=\033[0;31m +YELLOW=\033[0;33m NC=\033[0m .PHONY: @@ -54,7 +55,9 @@ test: $(X86_GCC_OUT) $(GCC_OUT) for test in $(TESTNAMES); do\ x86out=$(OUTDIR)/$$test.x86-gcc.out;\ gccout=$(OUTDIR)/$$test.gcc.out;\ - if $(DIFF) $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ + if grep "__K1C__" -q $$test.c; then\ + printf "$(YELLOW)UNTESTED: $$test.c contains an \`#ifdef __K1C__\`\n";\ + elif $(DIFF) $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ >&2 printf "$(RED)ERROR: $$x86out and $$gccout differ$(NC)\n";\ else\ printf "$(GREEN)GOOD: $$x86out and $$gccout concur$(NC)\n";\ diff --git a/test/mppa/instr/builtin64.c b/test/mppa/instr/builtin64.c new file mode 100644 index 00000000..40d53dc7 --- /dev/null +++ b/test/mppa/instr/builtin64.c @@ -0,0 +1,10 @@ +#include "framework.h" + +BEGIN_TEST(long long) + long long *ptr = &c; +#ifdef __K1C__ + /* Removed the AFADDD builtin who was incorrect in CompCert, see #157 */ + // a = __builtin_k1_afaddd(ptr, a); + // a = __builtin_k1_afaddd(ptr, a); +#endif +END_TEST64() -- cgit From 21622a06394e68170a9901f316addcd3fd1841de Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 30 Aug 2019 15:38:14 +0200 Subject: Added more tests --- test/mppa/coverage.sh | 2 +- test/mppa/instr/builtin64.c | 4 ++++ test/mppa/instr/i32.c | 38 ++++++++++++++++++++++++-------------- test/mppa/instr/i64.c | 39 +++++++++++++++++++++++++++------------ 4 files changed, 56 insertions(+), 27 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/coverage.sh b/test/mppa/coverage.sh index ec66c94e..42ed4182 100755 --- a/test/mppa/coverage.sh +++ b/test/mppa/coverage.sh @@ -12,7 +12,7 @@ set -e # Pipes do not mask errors set -o pipefail -sed -n "s/^.*fprintf\s*oc\s*\"\s*\([a-z][^[:space:]]*\)\s.*/\1/p" $printer > $to_cover_raw +sed -n "s/^.*fprintf\s\+oc\s*\"\s*\([a-z][^[:space:]]*\)\s.*/\1/p" $printer > $to_cover_raw python2.7 coverage_helper.py $to_cover_raw | sort -u > $to_cover rm -f $covered_raw diff --git a/test/mppa/instr/builtin64.c b/test/mppa/instr/builtin64.c index 40d53dc7..d568b7be 100644 --- a/test/mppa/instr/builtin64.c +++ b/test/mppa/instr/builtin64.c @@ -3,6 +3,10 @@ BEGIN_TEST(long long) long long *ptr = &c; #ifdef __K1C__ + long long d = c; + a = __builtin_k1_alclrd(ptr); + c = d; + /* Removed the AFADDD builtin who was incorrect in CompCert, see #157 */ // a = __builtin_k1_afaddd(ptr, a); // a = __builtin_k1_afaddd(ptr, a); diff --git a/test/mppa/instr/i32.c b/test/mppa/instr/i32.c index c0985031..4e389620 100644 --- a/test/mppa/instr/i32.c +++ b/test/mppa/instr/i32.c @@ -12,6 +12,14 @@ int tailsum(int a, int b){ return make(a+b); } +int fact(int a){ + int r = 1; + int i; + for (i = 1; i < a; i++) + r *= i; + return r; +} + float int2float(int v){ return v; } @@ -21,43 +29,43 @@ BEGIN_TEST(int) c += a&b; if ((a & 0x1) == 1) - c += 1; + c += fact(1); else - c += 2; + c += fact(2); if (a & 0x1 == 0) - c += 4; + c += fact(4); else - c += 8; + c += fact(8); b = !(a & 0x01); if (!b) - c += 16; + c += fact(16); else - c += 32; + c += fact(32); c += sum(make(a), make(b)); c += (long long) a; if (0 > (a & 0x1) - 1) - c += 64; + c += fact(64); else - c += 128; + c += fact(128); if (0 >= (a & 0x1)) - c += 256; + c += fact(256); else - c += 512; + c += fact(512); if ((a & 0x1) > 0) - c += 1024; + c += fact(1024); else - c += 2048; + c += fact(2048); if ((a & 0x1) - 1 >= 0) - c += 4096; + c += fact(4096); else - c += 8192; + c += fact(8192); c += ((a & 0x1) == (b & 0x1)); c += (a > b); @@ -70,6 +78,8 @@ BEGIN_TEST(int) c += (a << 2); // addx4w c += (a << 1); // addx2w + c += ~a & b; // andnw + int j; for (j = 0 ; j < 10 ; j++) c += a; diff --git a/test/mppa/instr/i64.c b/test/mppa/instr/i64.c index 84828bfb..dc5fa6ee 100644 --- a/test/mppa/instr/i64.c +++ b/test/mppa/instr/i64.c @@ -30,6 +30,14 @@ long long random_op(long long a, long long b){ return op(a, b); } +long fact(long a){ + long r = 1; + long i; + for (i = 1; i < a; i++) + r *= i; + return r; +} + double long2double(long v){ return v; } @@ -48,6 +56,8 @@ BEGIN_TEST(long long) c += (a << 2); // addx4d c += (a << 1); // addx2d + c += ~a & b; // andnd + long long d = 3; long long (*op)(long long, long long); @@ -65,34 +75,39 @@ BEGIN_TEST(long long) c += (unsigned int) a; if (0 != (a & 0x1LL)) - c += 1; + c += fact(1); else - c += 2; + c += fact(2); if (0 > (a & 0x1LL)) - c += 4; + c += fact(4); else - c += 8; + c += fact(8); if (0 >= (a & 0x1LL) - 1) - c += 16; + c += fact(16); + else + c += fact(32); + + if (a-41414141 > 0) + c += fact(13); else - c += 32; + c += fact(31); if (a & 0x1LL > 0) - c += 64; + c += fact(64); else - c += 128; + c += fact(128); if ((a & 0x1LL) - 1 >= 0) - c += 256; + c += fact(256); else - c += 512; + c += fact(512); if (0 == (a & 0x1LL)) - c += 1024; + c += fact(1024); else - c += 2048; + c += fact(2048); c += ((a & 0x1LL) == (b & 0x1LL)); c += (a >= b); -- cgit From ccd2fa5638e50b5fd8308b4b0c26531f911ff087 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 30 Aug 2019 17:08:07 +0200 Subject: Rajout de clzd dans les tests --- test/mppa/instr/builtin64.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/mppa') diff --git a/test/mppa/instr/builtin64.c b/test/mppa/instr/builtin64.c index d568b7be..dbbb1886 100644 --- a/test/mppa/instr/builtin64.c +++ b/test/mppa/instr/builtin64.c @@ -6,6 +6,9 @@ BEGIN_TEST(long long) long long d = c; a = __builtin_k1_alclrd(ptr); c = d; + c += a; + + c += __builtin_clzll(a); /* Removed the AFADDD builtin who was incorrect in CompCert, see #157 */ // a = __builtin_k1_afaddd(ptr, a); -- cgit From e61ab603fbb538f8bd2dac543f622cafdb7cd39c Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Tue, 3 Sep 2019 11:26:25 +0200 Subject: aclrw test --- test/mppa/instr/builtin32.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/mppa/instr/builtin32.c (limited to 'test/mppa') diff --git a/test/mppa/instr/builtin32.c b/test/mppa/instr/builtin32.c new file mode 100644 index 00000000..c7689dc8 --- /dev/null +++ b/test/mppa/instr/builtin32.c @@ -0,0 +1,12 @@ +#include "framework.h" + +BEGIN_TEST(int) + int *ptr = &c; +#ifdef __K1C__ + int d = c; + a = __builtin_k1_alclrw(ptr); + c = d; + +#endif +END_TEST32() + -- cgit From 2e1ecb87d05d7a6b5921be04ba10f6b9eae1be9c Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 5 Sep 2019 14:10:45 +0200 Subject: Adding tests for cmoved --- test/mppa/instr/i32.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ test/mppa/instr/i64.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) (limited to 'test/mppa') diff --git a/test/mppa/instr/i32.c b/test/mppa/instr/i32.c index 4e389620..e350931c 100644 --- a/test/mppa/instr/i32.c +++ b/test/mppa/instr/i32.c @@ -28,6 +28,7 @@ BEGIN_TEST(int) c = a+b; c += a&b; + /* testing if, cb version */ if ((a & 0x1) == 1) c += fact(1); else @@ -38,6 +39,11 @@ BEGIN_TEST(int) else c += fact(8); + if (a & 0x1 == 0) + c += fact(4); + else + c += fact(8); + b = !(a & 0x01); if (!b) c += fact(16); @@ -67,6 +73,48 @@ BEGIN_TEST(int) else c += fact(8192); + /* cmoved version */ + if ((a & 0x1) == 1) + c += 1; + else + c += 2; + + if (a & 0x1 == 0) + c += 4; + else + c += 8; + + if (a & 0x1 == 0) + c += 4; + else + c += 8; + + b = !(a & 0x01); + if (!b) + c += 16; + else + c += 32; + + if (0 > (a & 0x1) - 1) + c += 64; + else + c += 128; + + if (0 >= (a & 0x1)) + c += 256; + else + c += 512; + + if ((a & 0x1) > 0) + c += 1024; + else + c += 2048; + + if ((a & 0x1) - 1 >= 0) + c += 4096; + else + c += 8192; + c += ((a & 0x1) == (b & 0x1)); c += (a > b); c += (a <= b); diff --git a/test/mppa/instr/i64.c b/test/mppa/instr/i64.c index dc5fa6ee..b1fce564 100644 --- a/test/mppa/instr/i64.c +++ b/test/mppa/instr/i64.c @@ -74,6 +74,7 @@ BEGIN_TEST(long long) c += a^b; c += (unsigned int) a; + /* Testing if, cb */ if (0 != (a & 0x1LL)) c += fact(1); else @@ -109,6 +110,42 @@ BEGIN_TEST(long long) else c += fact(2048); + /* Testing if, cmoved */ + if (0 != (a & 0x1LL)) + c += 1; + else + c += 2; + + if (0 > (a & 0x1LL)) + c += 4; + else + c += 8; + + if (0 >= (a & 0x1LL) - 1) + c += 16; + else + c += 32; + + if (a-41414141 > 0) + c += 13; + else + c += 31; + + if (a & 0x1LL > 0) + c += 64; + else + c += 128; + + if ((a & 0x1LL) - 1 >= 0) + c += 256; + else + c += 512; + + if (0 == (a & 0x1LL)) + c += 1024; + else + c += 2048; + c += ((a & 0x1LL) == (b & 0x1LL)); c += (a >= b); c += (a > b); -- cgit From 5a095e968ca040757db22a4bd7cde34b91bf44e1 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 5 Sep 2019 14:25:21 +0200 Subject: Removing unused .all, .any, .nall and .none conditions --- test/mppa/coverage_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/mppa') diff --git a/test/mppa/coverage_helper.py b/test/mppa/coverage_helper.py index cf7a84c9..e5b1907c 100644 --- a/test/mppa/coverage_helper.py +++ b/test/mppa/coverage_helper.py @@ -5,7 +5,7 @@ all_loads_stores = "lbs lbz lhz lo lq ld lhs lws sb sd sh so sq sw".split(" ") all_bconds = "wnez weqz wltz wgez wlez wgtz dnez deqz dltz dgez dlez dgtz".split(" ") -all_iconds = "ne eq lt ge le gt ltu geu leu gtu all nall any none".split(" ") +all_iconds = "ne eq lt ge le gt ltu geu leu gtu".split(" ") all_fconds = "one ueq oeq une olt uge oge ult".split(" ") -- cgit From 8caa5a2e1f825b6e3d6b87e294c1a53c65d62612 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 5 Sep 2019 14:29:19 +0200 Subject: Test for compd.geu --- test/mppa/instr/i64.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/mppa') diff --git a/test/mppa/instr/i64.c b/test/mppa/instr/i64.c index b1fce564..e869d93c 100644 --- a/test/mppa/instr/i64.c +++ b/test/mppa/instr/i64.c @@ -90,6 +90,12 @@ BEGIN_TEST(long long) else c += fact(32); + if ((unsigned long long)(a & 0x1LL) >= 1) + c += fact(18); + else + c += fact(31); + + if (a-41414141 > 0) c += fact(13); else -- cgit From 371fc75ba09f7c1e7ea11ec4fe4e04aca05b5bef Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 19 Sep 2019 17:59:08 +0200 Subject: Adding some function calls in interop tests --- test/mppa/interop/common.c | 10 +++++++--- test/mppa/interop/vaarg_common.c | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/interop/common.c b/test/mppa/interop/common.c index e939e0d1..05b49187 100644 --- a/test/mppa/interop/common.c +++ b/test/mppa/interop/common.c @@ -1,17 +1,21 @@ #define STACK int a[100];\ a[42] = 42; -#define ONEARG_OP(arg) (3*arg+2) +#define ONEARG_OP(arg) (3*magic(arg)+2) -#define MULTIARG_OP(arg1, arg2, arg3, arg4) (arg1 ^ arg2 << arg3 - arg4) +#define MULTIARG_OP(arg1, arg2, arg3, arg4) (arg1 ^ magic(arg2) << arg3 - arg4) #define MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,\ a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,\ a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)\ - (a0 * a1 * a2 * a3 * a4 * a5 * a6 * a7 * a8 * a9 *\ + (a0 * a1 * a2 * magic(a3) * a4 * a5 * a6 * a7 * a8 * a9 *\ a10 * a11 * a12 * a13 * a14 * a15 * a16 * a17 * a18 * a19 *\ a20 * a21 * a22 * a23 * a24 * a25 * a26 * a27 * a28 * a29) +int magic(long a){ + return a*42 + 26; +} + void void_void(){ STACK; } diff --git a/test/mppa/interop/vaarg_common.c b/test/mppa/interop/vaarg_common.c index 9033893b..3314959f 100644 --- a/test/mppa/interop/vaarg_common.c +++ b/test/mppa/interop/vaarg_common.c @@ -3,20 +3,24 @@ #define STACK int a[100];\ a[42] = 42; -#define ONEARG_OP(arg) (3*arg+2) +#define ONEARG_OP(arg) (3*magic(arg)+2) -#define MULTIARG_OP(arg1, arg2, arg3, arg4) (arg1 ^ arg2 << arg3 - arg4) +#define MULTIARG_OP(arg1, arg2, arg3, arg4) (arg1 ^ magic(arg2) << arg3 - arg4) #define MANYARG_OP(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,\ a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,\ a20, a21, a22, a23, a24, a25, a26, a27, a28, a29)\ - (a0 + a1 * a2 + a3 * a4 + a5 + a6 + a7 - a8 + a9 +\ - a10 + a11 - a12 ^ a13 + a14 - a15 + a16 ^ a17 + a18 + a19 +\ + (a0 + a1 * a2 + magic(a3) * a4 + a5 + a6 + a7 - a8 + a9 +\ + a10 + a11 - a12 ^ a13 + a14 - magic(a15) + a16 ^ a17 + a18 + a19 +\ a20 + a21 + a22 * a23 + a24 + a25 << a26 & a27 + a28 + a29) #define VA_START(vl, arg) va_list vl; va_start(vl, arg) #define VA_END(vl) va_end(vl) +int magic(long a){ + return a*2 + 42; +} + void void_void(void){ STACK; } -- cgit From 305b3a354a4ba61ebb80677ee73379fed4200dad Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Mon, 27 Jan 2020 16:23:13 +0100 Subject: New directive hardtest and hardcheck to run on hardware test/mppa/instr --- test/mppa/instr/Makefile | 66 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 11 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile index 69446796..37f7d0ab 100644 --- a/test/mppa/instr/Makefile +++ b/test/mppa/instr/Makefile @@ -5,10 +5,11 @@ CC ?= gcc CCOMP ?= ccomp OPTIM ?= -O2 CFLAGS ?= $(OPTIM) -CCOMPFLAGS ?= $(CFLAGS) -faddx +CCOMPFLAGS ?= $(CFLAGS) SIMU ?= k1-mppa TIMEOUT ?= --signal=SIGTERM 120s DIFF ?= python2.7 floatcmp.py -reltol .00001 +HARDRUN ?= k1-jtag-runner DIR=./ SRCDIR=$(DIR) @@ -30,10 +31,11 @@ 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))) +GCC_SIMUOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.simu.out,$(TESTNAMES))) +CCOMP_SIMUOUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.simu.out,$(TESTNAMES))) +GCC_HARDOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.hard.out,$(TESTNAMES))) +CCOMP_HARDOUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.hard.out,$(TESTNAMES))) -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))) @@ -49,12 +51,18 @@ RED=\033[0;31m YELLOW=\033[0;33m NC=\033[0m +.PHONY: +test: simutest + +.PHONY: +check: simucheck + .PHONY: -test: $(X86_GCC_OUT) $(GCC_OUT) +simutest: $(X86_GCC_OUT) $(GCC_SIMUOUT) @echo "Comparing x86 gcc output to k1 gcc.." for test in $(TESTNAMES); do\ x86out=$(OUTDIR)/$$test.x86-gcc.out;\ - gccout=$(OUTDIR)/$$test.gcc.out;\ + gccout=$(OUTDIR)/$$test.gcc.simu.out;\ if grep "__K1C__" -q $$test.c; then\ printf "$(YELLOW)UNTESTED: $$test.c contains an \`#ifdef __K1C__\`\n";\ elif $(DIFF) $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ @@ -65,11 +73,39 @@ test: $(X86_GCC_OUT) $(GCC_OUT) done .PHONY: -check: $(GCC_OUT) $(CCOMP_OUT) +simucheck: $(GCC_SIMUOUT) $(CCOMP_SIMUOUT) @echo "Comparing k1 gcc output to ccomp.." @for test in $(TESTNAMES); do\ - gccout=$(OUTDIR)/$$test.gcc.out;\ - ccompout=$(OUTDIR)/$$test.ccomp.out;\ + gccout=$(OUTDIR)/$$test.gcc.simu.out;\ + ccompout=$(OUTDIR)/$$test.ccomp.simu.out;\ + if $(DIFF) $$ccompout $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ + >&2 printf "$(RED)ERROR: $$ccompout and $$gccout differ$(NC)\n";\ + else\ + printf "$(GREEN)GOOD: $$ccompout and $$gccout concur$(NC)\n";\ + fi;\ + done + +.PHONY: +hardtest: $(X86_GCC_OUT) $(GCC_HARDOUT) + @echo "Comparing x86 gcc output to k1 gcc.." + for test in $(TESTNAMES); do\ + x86out=$(OUTDIR)/$$test.x86-gcc.out;\ + gccout=$(OUTDIR)/$$test.gcc.hard.out;\ + if grep "__K1C__" -q $$test.c; then\ + printf "$(YELLOW)UNTESTED: $$test.c contains an \`#ifdef __K1C__\`\n";\ + elif $(DIFF) $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ + >&2 printf "$(RED)ERROR: $$x86out and $$gccout differ$(NC)\n";\ + else\ + printf "$(GREEN)GOOD: $$x86out and $$gccout concur$(NC)\n";\ + fi;\ + done + +.PHONY: +hardcheck: $(GCC_HARDOUT) $(CCOMP_HARDOUT) + @echo "Comparing k1 gcc output to ccomp.." + @for test in $(TESTNAMES); do\ + gccout=$(OUTDIR)/$$test.gcc.hard.out;\ + ccompout=$(OUTDIR)/$$test.ccomp.hard.out;\ if $(DIFF) $$ccompout $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\ >&2 printf "$(RED)ERROR: $$ccompout and $$gccout differ$(NC)\n";\ else\ @@ -95,14 +131,22 @@ $(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ -$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) +$(OUTDIR)/%.gcc.simu.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ -$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) +$(OUTDIR)/%.ccomp.simu.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ +$(OUTDIR)/%.gcc.hard.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(HARDRUN) --exec-file=Cluster0:$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.ccomp.hard.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(HARDRUN) --exec-file=Cluster0:$< > $@ || { ret=$$?; }; echo $$ret >> $@ + # Assembly to binary $(BINDIR)/%.x86-gcc.bin: $(ASMDIR)/%.x86-gcc.s $(LIB) $(CCPATH) -- cgit From 576cf0553e7a54eb384e9d0b3ec7d08ff264cb1c Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Mon, 27 Jan 2020 16:37:34 +0100 Subject: Hardware runs for test/mppa/interop --- test/mppa/interop/Makefile | 137 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 113 insertions(+), 24 deletions(-) (limited to 'test/mppa') diff --git a/test/mppa/interop/Makefile b/test/mppa/interop/Makefile index e615e89a..3a83d51c 100644 --- a/test/mppa/interop/Makefile +++ b/test/mppa/interop/Makefile @@ -6,6 +6,7 @@ CCOMP ?= ccomp CFLAGS ?= -O2 -Wno-varargs SIMU ?= k1-mppa TIMEOUT ?= --signal=SIGTERM 120s +HARDRUN ?= k1-jtag-runner DIR=./ SRCDIR=$(DIR) @@ -33,17 +34,23 @@ SIMUPATH=$(shell which $(SIMU)) TESTNAMES ?= $(filter-out $(VAARG_COMMON),$(filter-out $(COMMON),$(notdir $(subst .c,,$(wildcard $(DIR)/*.c))))) X86_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .x86-gcc.out,$(TESTNAMES))) -GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.out,$(TESTNAMES))) -GCC_REV_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.out,$(TESTNAMES))) -CCOMP_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.out,$(TESTNAMES))) +GCC_SIMUOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.simu.out,$(TESTNAMES))) +GCC_REV_SIMUOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.simu.out,$(TESTNAMES))) +CCOMP_SIMUOUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.simu.out,$(TESTNAMES))) + +GCC_HARDOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.hard.out,$(TESTNAMES))) +GCC_REV_HARDOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.hard.out,$(TESTNAMES))) +CCOMP_HARDOUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.hard.out,$(TESTNAMES))) VAARG_X86_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .x86-gcc.vaarg.out,$(TESTNAMES))) -VAARG_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.vaarg.out,$(TESTNAMES))) -VAARG_GCC_REV_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.vaarg.out,$(TESTNAMES))) -VAARG_CCOMP_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.vaarg.out,$(TESTNAMES))) +VAARG_GCC_SIMUOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.vaarg.simu.out,$(TESTNAMES))) +VAARG_GCC_REV_SIMUOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.vaarg.simu.out,$(TESTNAMES))) +VAARG_CCOMP_SIMUOUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.vaarg.simu.out,$(TESTNAMES))) + +VAARG_GCC_HARDOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.vaarg.hard.out,$(TESTNAMES))) +VAARG_GCC_REV_HARDOUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.rev.vaarg.hard.out,$(TESTNAMES))) +VAARG_CCOMP_HARDOUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.vaarg.hard.out,$(TESTNAMES))) -OUT=$(X86_GCC_OUT) $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT)\ - $(VAARG_GCC_OUT) $(VAARG_GCC_OUT) $(VAARG_CCOMP_OUT) $(VAARG_GCC_REV_OUT) BIN=$(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.bin,$(TESTNAMES)))\ $(addprefix $(BINDIR)/,$(addsuffix .gcc.bin,$(TESTNAMES)))\ $(addprefix $(BINDIR)/,$(addsuffix .ccomp.bin,$(TESTNAMES)))\ @@ -63,14 +70,72 @@ GREEN=\033[0;32m RED=\033[0;31m NC=\033[0m +.PHONY: +test: simutest + +.PHONY: +simutest: $(X86_GCC_OUT) $(GCC_SIMUOUT) $(VAARG_X86_GCC_OUT) $(VAARG_GCC_SIMUOUT) + @echo "Comparing x86 gcc output to k1 gcc.." + @for test in $(TESTNAMES); do\ + x86out=$(OUTDIR)/$$test.x86-gcc.out;\ + gccout=$(OUTDIR)/$$test.gcc.simu.out;\ + vaarg_x86out=$(OUTDIR)/$$test.x86-gcc.vaarg.out;\ + vaarg_gccout=$(OUTDIR)/$$test.gcc.vaarg.simu.out;\ + if ! diff $$x86out $$gccout > /dev/null; then\ + >&2 printf "$(RED)ERROR: $$x86out and $$gccout differ$(NC)\n";\ + else\ + printf "$(GREEN)GOOD: $$x86out and $$gccout concur$(NC)\n";\ + fi;\ + if ! diff $$vaarg_x86out $$vaarg_gccout > /dev/null; then\ + >&2 printf "$(RED)ERROR: $$vaarg_x86out and $$vaarg_gccout differ$(NC)\n";\ + else\ + printf "$(GREEN)GOOD: $$vaarg_x86out and $$vaarg_gccout concur$(NC)\n";\ + fi;\ + done + +.PHONY: +check: simucheck + +.PHONY: +simucheck: $(GCC_SIMUOUT) $(CCOMP_SIMUOUT) $(GCC_REV_SIMUOUT) $(VAARG_GCC_SIMUOUT) $(VAARG_CCOMP_SIMUOUT) $(VAARG_GCC_REV_SIMUOUT) + @echo "Comparing k1 gcc output to ccomp.." + @for test in $(TESTNAMES); do\ + gccout=$(OUTDIR)/$$test.gcc.simu.out;\ + ccompout=$(OUTDIR)/$$test.ccomp.simu.out;\ + gccrevout=$(OUTDIR)/$$test.gcc.rev.simu.out;\ + vaarg_gccout=$(OUTDIR)/$$test.gcc.vaarg.simu.out;\ + vaarg_ccompout=$(OUTDIR)/$$test.ccomp.vaarg.simu.out;\ + vaarg_gccrevout=$(OUTDIR)/$$test.gcc.rev.vaarg.simu.out;\ + if ! diff $$ccompout $$gccout > /dev/null; then\ + >&2 printf "$(RED)ERROR: $$ccompout and $$gccout differ$(NC)\n";\ + else\ + printf "$(GREEN)GOOD: $$ccompout and $$gccout concur$(NC)\n";\ + fi;\ + if ! diff $$gccrevout $$gccout > /dev/null; then\ + >&2 printf "$(RED)ERROR: $$gccrevout and $$gccout differ$(NC)\n";\ + else\ + printf "$(GREEN)GOOD: $$gccrevout and $$gccout concur$(NC)\n";\ + fi;\ + if ! diff $$vaarg_ccompout $$vaarg_gccout > /dev/null; then\ + >&2 printf "$(RED)ERROR: $$vaarg_ccompout and $$vaarg_gccout differ$(NC)\n";\ + else\ + printf "$(GREEN)GOOD: $$vaarg_ccompout and $$vaarg_gccout concur$(NC)\n";\ + fi;\ + if ! diff $$vaarg_gccrevout $$vaarg_gccout > /dev/null; then\ + >&2 printf "$(RED)ERROR: $$vaarg_gccrevout and $$vaarg_gccout differ$(NC)\n";\ + else\ + printf "$(GREEN)GOOD: $$vaarg_gccrevout and $$vaarg_gccout concur$(NC)\n";\ + fi;\ + done + .PHONY: -test: $(X86_GCC_OUT) $(GCC_OUT) $(VAARG_X86_GCC_OUT) $(VAARG_GCC_OUT) +hardtest: $(X86_GCC_OUT) $(GCC_HARDOUT) $(VAARG_X86_GCC_OUT) $(VAARG_GCC_HARDOUT) @echo "Comparing x86 gcc output to k1 gcc.." @for test in $(TESTNAMES); do\ x86out=$(OUTDIR)/$$test.x86-gcc.out;\ - gccout=$(OUTDIR)/$$test.gcc.out;\ + gccout=$(OUTDIR)/$$test.gcc.hard.out;\ vaarg_x86out=$(OUTDIR)/$$test.x86-gcc.vaarg.out;\ - vaarg_gccout=$(OUTDIR)/$$test.gcc.vaarg.out;\ + vaarg_gccout=$(OUTDIR)/$$test.gcc.vaarg.hard.out;\ if ! diff $$x86out $$gccout > /dev/null; then\ >&2 printf "$(RED)ERROR: $$x86out and $$gccout differ$(NC)\n";\ else\ @@ -84,15 +149,15 @@ test: $(X86_GCC_OUT) $(GCC_OUT) $(VAARG_X86_GCC_OUT) $(VAARG_GCC_OUT) done .PHONY: -check: $(GCC_OUT) $(CCOMP_OUT) $(GCC_REV_OUT) $(VAARG_GCC_OUT) $(VAARG_CCOMP_OUT) $(VAARG_GCC_REV_OUT) +hardcheck: $(GCC_HARDOUT) $(CCOMP_HARDOUT) $(GCC_REV_HARDOUT) $(VAARG_GCC_HARDOUT) $(VAARG_CCOMP_HARDOUT) $(VAARG_GCC_REV_HARDOUT) @echo "Comparing k1 gcc output to ccomp.." @for test in $(TESTNAMES); do\ - gccout=$(OUTDIR)/$$test.gcc.out;\ - ccompout=$(OUTDIR)/$$test.ccomp.out;\ - gccrevout=$(OUTDIR)/$$test.gcc.rev.out;\ - vaarg_gccout=$(OUTDIR)/$$test.gcc.vaarg.out;\ - vaarg_ccompout=$(OUTDIR)/$$test.ccomp.vaarg.out;\ - vaarg_gccrevout=$(OUTDIR)/$$test.gcc.rev.vaarg.out;\ + gccout=$(OUTDIR)/$$test.gcc.hard.out;\ + ccompout=$(OUTDIR)/$$test.ccomp.hard.out;\ + gccrevout=$(OUTDIR)/$$test.gcc.rev.hard.out;\ + vaarg_gccout=$(OUTDIR)/$$test.gcc.vaarg.hard.out;\ + vaarg_ccompout=$(OUTDIR)/$$test.ccomp.vaarg.hard.out;\ + vaarg_gccrevout=$(OUTDIR)/$$test.gcc.rev.vaarg.hard.out;\ if ! diff $$ccompout $$gccout > /dev/null; then\ >&2 printf "$(RED)ERROR: $$ccompout and $$gccout differ$(NC)\n";\ else\ @@ -144,36 +209,60 @@ $(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ -$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) +$(OUTDIR)/%.gcc.simu.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ -$(OUTDIR)/%.gcc.rev.out: $(BINDIR)/%.gcc.rev.bin $(SIMUPATH) +$(OUTDIR)/%.gcc.rev.simu.out: $(BINDIR)/%.gcc.rev.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ -$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) +$(OUTDIR)/%.ccomp.simu.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ +$(OUTDIR)/%.gcc.hard.out: $(BINDIR)/%.gcc.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(HARDRUN) --exec-file=Cluster0:$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.gcc.rev.hard.out: $(BINDIR)/%.gcc.rev.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(HARDRUN) --exec-file=Cluster0:$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.ccomp.hard.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(HARDRUN) --exec-file=Cluster0:$< > $@ || { ret=$$?; }; echo $$ret >> $@ + ## With vaarg $(OUTDIR)/%.x86-gcc.vaarg.out: $(BINDIR)/%.x86-gcc.vaarg.bin @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ -$(OUTDIR)/%.gcc.vaarg.out: $(BINDIR)/%.gcc.vaarg.bin $(SIMUPATH) +$(OUTDIR)/%.gcc.vaarg.simu.out: $(BINDIR)/%.gcc.vaarg.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ -$(OUTDIR)/%.gcc.rev.vaarg.out: $(BINDIR)/%.gcc.rev.vaarg.bin $(SIMUPATH) +$(OUTDIR)/%.gcc.rev.vaarg.simu.out: $(BINDIR)/%.gcc.rev.vaarg.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ -$(OUTDIR)/%.ccomp.vaarg.out: $(BINDIR)/%.ccomp.vaarg.bin $(SIMUPATH) +$(OUTDIR)/%.ccomp.vaarg.simu.out: $(BINDIR)/%.ccomp.vaarg.bin $(SIMUPATH) @mkdir -p $(@D) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ +$(OUTDIR)/%.gcc.vaarg.hard.out: $(BINDIR)/%.gcc.vaarg.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(HARDRUN) --exec-file=Cluster0:$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.gcc.rev.vaarg.hard.out: $(BINDIR)/%.gcc.rev.vaarg.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(HARDRUN) --exec-file=Cluster0:$< > $@ || { ret=$$?; }; echo $$ret >> $@ + +$(OUTDIR)/%.ccomp.vaarg.hard.out: $(BINDIR)/%.ccomp.vaarg.bin $(SIMUPATH) + @mkdir -p $(@D) + ret=0; timeout $(TIMEOUT) $(HARDRUN) --exec-file=Cluster0:$< > $@ || { ret=$$?; }; echo $$ret >> $@ + ## # Object to binary ## -- cgit From 338bcf7825a889de6af322f82d4c8ae1c475dd9c Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Mon, 27 Jan 2020 16:42:19 +0100 Subject: Updated scripts to run the tests on test/mppa --- test/mppa/check.sh | 6 ------ test/mppa/hardcheck.sh | 6 ++++++ test/mppa/hardtest.sh | 6 ++++++ test/mppa/simucheck.sh | 6 ++++++ test/mppa/simutest.sh | 6 ++++++ test/mppa/test.sh | 6 ------ 6 files changed, 24 insertions(+), 12 deletions(-) delete mode 100755 test/mppa/check.sh create mode 100755 test/mppa/hardcheck.sh create mode 100755 test/mppa/hardtest.sh create mode 100755 test/mppa/simucheck.sh create mode 100755 test/mppa/simutest.sh delete mode 100755 test/mppa/test.sh (limited to 'test/mppa') diff --git a/test/mppa/check.sh b/test/mppa/check.sh deleted file mode 100755 index f25c3e31..00000000 --- a/test/mppa/check.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Tests the execution of the binaries produced by CompCert - -source do_test.sh - -do_test check $1 diff --git a/test/mppa/hardcheck.sh b/test/mppa/hardcheck.sh new file mode 100755 index 00000000..82b63182 --- /dev/null +++ b/test/mppa/hardcheck.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Tests the execution of the binaries produced by CompCert, in hardware + +source do_test.sh + +do_test hardcheck diff --git a/test/mppa/hardtest.sh b/test/mppa/hardtest.sh new file mode 100755 index 00000000..09511da6 --- /dev/null +++ b/test/mppa/hardtest.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Tests the validity of the tests, in hardware + +source do_test.sh + +do_test hardtest diff --git a/test/mppa/simucheck.sh b/test/mppa/simucheck.sh new file mode 100755 index 00000000..25fb9947 --- /dev/null +++ b/test/mppa/simucheck.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Tests the execution of the binaries produced by CompCert, by simulation + +source do_test.sh + +do_test check $1 diff --git a/test/mppa/simutest.sh b/test/mppa/simutest.sh new file mode 100755 index 00000000..3b1021e6 --- /dev/null +++ b/test/mppa/simutest.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Tests the validity of the tests, in simulator + +source do_test.sh + +do_test test $1 diff --git a/test/mppa/test.sh b/test/mppa/test.sh deleted file mode 100755 index 30806a6b..00000000 --- a/test/mppa/test.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Tests the validity of the tests - -source do_test.sh - -do_test test $1 -- cgit