aboutsummaryrefslogtreecommitdiffstats
path: root/test/mppa
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-01-25 17:53:48 +0100
committerCyril SIX <cyril.six@kalray.eu>2019-01-29 18:21:20 +0100
commit0a693ac9dd3b181ba42566996531438ef205815c (patch)
tree16d1424b4549f53ab856bf026c7a8ef39d3dcd8c /test/mppa
parent61bd09baee35a8acc68cd4047eb811839b59e945 (diff)
downloadcompcert-kvx-0a693ac9dd3b181ba42566996531438ef205815c.tar.gz
compcert-kvx-0a693ac9dd3b181ba42566996531438ef205815c.zip
Adding indirect calls (icall instruction)
Diffstat (limited to 'test/mppa')
-rw-r--r--test/mppa/instr/indirect_call.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/mppa/instr/indirect_call.c b/test/mppa/instr/indirect_call.c
new file mode 100644
index 00000000..3a45ce52
--- /dev/null
+++ b/test/mppa/instr/indirect_call.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 make(long long a){
+ return a;
+}
+
+BEGIN_TEST(long long)
+{
+ 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;
+
+ c += op(make(a), make(b));
+}
+END_TEST()