From 0a693ac9dd3b181ba42566996531438ef205815c Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 25 Jan 2019 17:53:48 +0100 Subject: Adding indirect calls (icall instruction) --- test/mppa/instr/indirect_call.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/mppa/instr/indirect_call.c (limited to 'test/mppa') 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() -- cgit