aboutsummaryrefslogtreecommitdiffstats
path: root/test/mppa
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-08-30 15:38:14 +0200
committerCyril SIX <cyril.six@kalray.eu>2019-08-30 15:38:14 +0200
commit21622a06394e68170a9901f316addcd3fd1841de (patch)
tree7511e687f412943c509e2a2dbf72f1d74d27793a /test/mppa
parent436bf1192e129427f6fcc99d2e6b75db08e80cf8 (diff)
downloadcompcert-kvx-21622a06394e68170a9901f316addcd3fd1841de.tar.gz
compcert-kvx-21622a06394e68170a9901f316addcd3fd1841de.zip
Added more tests
Diffstat (limited to 'test/mppa')
-rwxr-xr-xtest/mppa/coverage.sh2
-rw-r--r--test/mppa/instr/builtin64.c4
-rw-r--r--test/mppa/instr/i32.c38
-rw-r--r--test/mppa/instr/i64.c39
4 files changed, 56 insertions, 27 deletions
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);