aboutsummaryrefslogtreecommitdiffstats
path: root/test/mppa
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-02-08 15:39:48 +0100
committerCyril SIX <cyril.six@kalray.eu>2019-02-08 15:39:48 +0100
commit66f236124907af065fc8396f8cefd5726a46b06a (patch)
tree02c79ca01be3b8dbc9698ed9a829255a252b685b /test/mppa
parent0cb0e0c239f086b766a2b4eb65f79a426db49813 (diff)
downloadcompcert-kvx-66f236124907af065fc8396f8cefd5726a46b06a.tar.gz
compcert-kvx-66f236124907af065fc8396f8cefd5726a46b06a.zip
Added indirect tailcalls
Diffstat (limited to 'test/mppa')
-rw-r--r--test/mppa/instr/indirect_tailcall.c33
-rw-r--r--test/mppa/instr/tailcall.c16
2 files changed, 49 insertions, 0 deletions
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 */