From 36e0e45e7c8f93bf6f733197bf19f277a5e11248 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 9 Nov 2021 09:27:57 +0000 Subject: Add new files --- examples/cond_return.c | 7 ++++++ examples/cond_return.gsa | 14 ++++++++++++ examples/double_for_loop.c | 13 +++++++++++ examples/double_for_loop.gsa | 52 ++++++++++++++++++++++++++++++++++++++++++++ examples/simple_return.c | 4 ++++ examples/simple_return.gsa | 8 +++++++ examples/tiny.gsa | 4 ++++ 7 files changed, 102 insertions(+) create mode 100644 examples/cond_return.c create mode 100644 examples/cond_return.gsa create mode 100644 examples/double_for_loop.c create mode 100644 examples/double_for_loop.gsa create mode 100644 examples/simple_return.c create mode 100644 examples/simple_return.gsa create mode 100644 examples/tiny.gsa diff --git a/examples/cond_return.c b/examples/cond_return.c new file mode 100644 index 0000000..74bd493 --- /dev/null +++ b/examples/cond_return.c @@ -0,0 +1,7 @@ +int f(int y) { + int x = 5; + if (y == 21) { + x = 20; + } + return x; +} diff --git a/examples/cond_return.gsa b/examples/cond_return.gsa new file mode 100644 index 0000000..4b789b8 --- /dev/null +++ b/examples/cond_return.gsa @@ -0,0 +1,14 @@ +f(x8) { + 10: nop + 9: nop + 8: x20 = 5 + 7: if (x8 ==s 21) goto 5 else goto 6 + 6: goto 3 + 5: x22 = 20 + 4: nop + 3: x18 = γ((¬(x8 ==s 21),x20),((x8 ==s 21),x22)) + nop + 2: x28 = x18 + 1: return x28 +} + diff --git a/examples/double_for_loop.c b/examples/double_for_loop.c new file mode 100644 index 0000000..c58301d --- /dev/null +++ b/examples/double_for_loop.c @@ -0,0 +1,13 @@ +int f (int A[1000], int B[1000]) { + for (int i = 0; i < 1000; i++) { + if (i % 2) { + A[i] = B[i]; + } + } + for (int i = 0; i < 1000; i++) { + if (! (i % 2)) { + A[i] = B[i]; + } + } + return A[100]; +} diff --git a/examples/double_for_loop.gsa b/examples/double_for_loop.gsa new file mode 100644 index 0000000..f035e8a --- /dev/null +++ b/examples/double_for_loop.gsa @@ -0,0 +1,52 @@ +f(x16, x8) { + 46: nop + 45: nop + 44: x36 = 0 + 43: nop + 42: nop + 41: x34 = μ(x38, x36) + nop + 40: x140 = x34 + 39: x156 = x140 >>x 1 + 38: x148 = x156 * 2 + 0 (int) + 37: x132 = x140 - x148 + 36: if (x132 !=u 0) goto 34 else goto 35 + 35: goto 29 + 34: x108 = long32signed(x34) + 33: x124 = x108 + 32: x116 = int32[x8 + x124 * 4 + 0] + 31: int32[x16 + x108 * 4 + 0] = x116 + 30: nop + 29: nop + 28: x38 = x34 + 1 (int) + 27: if (x38 >x 1 + 19: x92 = x100 * 2 + 0 (int) + 18: x76 = x84 - x92 + 17: if (x76 ==u 0) goto 15 else goto 16 + 16: goto 10 + 15: x52 = long32signed(x26) + 14: x68 = x52 + 13: x60 = int32[x8 + x68 * 4 + 0] + 12: int32[x16 + x52 * 4 + 0] = x60 + 11: nop + 10: nop + 9: x30 = x26 + 1 (int) + 8: if (x30