aboutsummaryrefslogtreecommitdiffstats
path: root/test/mppa
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-09-05 14:10:45 +0200
committerCyril SIX <cyril.six@kalray.eu>2019-09-05 14:10:45 +0200
commit2e1ecb87d05d7a6b5921be04ba10f6b9eae1be9c (patch)
tree723dffc1c37512f7787b70f6d7f906c5244481bb /test/mppa
parent7cfc487a56aca2c1444e98a0b845ec25c9069476 (diff)
downloadcompcert-kvx-2e1ecb87d05d7a6b5921be04ba10f6b9eae1be9c.tar.gz
compcert-kvx-2e1ecb87d05d7a6b5921be04ba10f6b9eae1be9c.zip
Adding tests for cmoved
Diffstat (limited to 'test/mppa')
-rw-r--r--test/mppa/instr/i32.c48
-rw-r--r--test/mppa/instr/i64.c37
2 files changed, 85 insertions, 0 deletions
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);