diff options
Diffstat (limited to 'test/mppa/instr')
-rw-r--r-- | test/mppa/instr/indirect_tailcall.c | 33 | ||||
-rw-r--r-- | test/mppa/instr/tailcall.c | 16 |
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 */ |