aboutsummaryrefslogtreecommitdiffstats
path: root/test/mppa
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2018-06-05 17:48:22 +0200
committerCyril SIX <cyril.six@kalray.eu>2018-06-05 17:48:22 +0200
commit7b5eb7e675ee0978e1b17b75f827dcd45df8c250 (patch)
tree579a452155dea5211f3a8484badfa995004dc718 /test/mppa
parentbcbe036e9b43adcaf2faf10cf32456608b0602c5 (diff)
downloadcompcert-kvx-7b5eb7e675ee0978e1b17b75f827dcd45df8c250.tar.gz
compcert-kvx-7b5eb7e675ee0978e1b17b75f827dcd45df8c250.zip
WIP - Changed all the general tests to include PRNG (instead of small constants)
Diffstat (limited to 'test/mppa')
-rw-r--r--test/mppa/Makefile6
-rw-r--r--test/mppa/general/addw.c10
-rw-r--r--test/mppa/general/andd.c8
-rw-r--r--test/mppa/general/andw.c10
-rw-r--r--test/mppa/general/branch.c19
-rw-r--r--test/mppa/general/branchz.c19
-rw-r--r--test/mppa/general/branchzu.c20
-rw-r--r--test/mppa/general/call.c20
-rw-r--r--test/mppa/general/cb.deqz.c15
-rw-r--r--test/mppa/general/cb.dgez.c15
-rw-r--r--test/mppa/general/cb.dgtz.c15
-rw-r--r--test/mppa/general/cb.dlez.c15
-rw-r--r--test/mppa/general/cb.dltz.c15
-rw-r--r--test/mppa/general/cb.dnez.c15
-rw-r--r--test/mppa/general/cb.wgez.c15
-rw-r--r--test/mppa/general/cb.wgtz.c15
-rw-r--r--test/mppa/general/cb.wlez.c15
-rw-r--r--test/mppa/general/cb.wltz.c15
-rw-r--r--test/mppa/general/clzll.c9
-rw-r--r--test/mppa/general/compd.eq.c9
-rw-r--r--test/mppa/general/compd.geu.c9
-rw-r--r--test/mppa/general/compd.gt.c9
-rw-r--r--test/mppa/general/compd.gtu.c9
-rw-r--r--test/mppa/general/compd.le.c9
-rw-r--r--test/mppa/general/compd.leu.c9
-rw-r--r--test/mppa/general/compd.lt.c9
-rw-r--r--test/mppa/general/compd.ltu.c9
-rw-r--r--test/mppa/general/compd.ne.c9
-rw-r--r--test/mppa/general/compw.eq.c9
-rw-r--r--test/mppa/general/compw.geu.c9
-rw-r--r--test/mppa/general/compw.gt.c9
-rw-r--r--test/mppa/general/compw.gtu.c9
-rw-r--r--test/mppa/general/compw.le.c9
-rw-r--r--test/mppa/general/compw.leu.c9
-rw-r--r--test/mppa/general/compw.lt.c9
-rw-r--r--test/mppa/general/compw.ltu.c9
-rw-r--r--test/mppa/general/compw.ne.c9
-rw-r--r--test/mppa/general/div2.c25
-rw-r--r--test/mppa/general/for.c16
-rw-r--r--test/mppa/general/forvar.c17
-rw-r--r--test/mppa/general/forvarl.c17
-rw-r--r--test/mppa/general/framework.h24
-rw-r--r--test/mppa/general/lbs.c12
-rw-r--r--test/mppa/general/lbz.c12
-rw-r--r--test/mppa/general/muld.c10
-rw-r--r--test/mppa/general/mulw.c10
-rw-r--r--test/mppa/general/negd.c11
-rw-r--r--test/mppa/general/ord.c10
-rw-r--r--test/mppa/general/sbfd.c10
-rw-r--r--test/mppa/general/sbfw.c10
-rw-r--r--test/mppa/general/simple.c11
-rw-r--r--test/mppa/general/sllw.c10
-rw-r--r--test/mppa/general/srad.c10
-rw-r--r--test/mppa/general/srld.c10
-rw-r--r--test/mppa/general/stsud.c10
-rw-r--r--test/mppa/general/udivd.c11
-rw-r--r--test/mppa/general/umodd.c11
-rw-r--r--test/mppa/general/xord.c10
-rw-r--r--test/mppa/lib/prng.c2
59 files changed, 394 insertions, 308 deletions
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){