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/i32.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/mppa/instr/i32.c') 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++) -- 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/instr/i32.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'test/mppa/instr/i32.c') 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; -- 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 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test/mppa/instr/i32.c') 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); -- cgit