diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/struct-return-1.c | 3 | ||||
-rw-r--r-- | tests/struct-return-1.qbe | 10 | ||||
-rw-r--r-- | tests/struct-return-2.c | 4 | ||||
-rw-r--r-- | tests/struct-return-2.qbe | 8 |
4 files changed, 25 insertions, 0 deletions
diff --git a/tests/struct-return-1.c b/tests/struct-return-1.c new file mode 100644 index 0000000..e1631a8 --- /dev/null +++ b/tests/struct-return-1.c @@ -0,0 +1,3 @@ +struct s {int x;} f(void) { + return (struct s){2}; +} diff --git a/tests/struct-return-1.qbe b/tests/struct-return-1.qbe new file mode 100644 index 0000000..fcdf699 --- /dev/null +++ b/tests/struct-return-1.qbe @@ -0,0 +1,10 @@ +type :s.1 = { w, } +export +function :s.1 $f() { +@start.1 + %.1 =l alloc4 4 +@body.2 + %.2 =l add %.1, 0 + storew 2, %.2 + ret %.1 +} diff --git a/tests/struct-return-2.c b/tests/struct-return-2.c new file mode 100644 index 0000000..9fa50f5 --- /dev/null +++ b/tests/struct-return-2.c @@ -0,0 +1,4 @@ +struct s {int x;} g(void); +void f(void) { + g(); +} diff --git a/tests/struct-return-2.qbe b/tests/struct-return-2.qbe new file mode 100644 index 0000000..2f1d3da --- /dev/null +++ b/tests/struct-return-2.qbe @@ -0,0 +1,8 @@ +type :s.1 = { w, } +export +function $f() { +@start.1 +@body.2 + %.1 =:s.1 call $g() + ret +} |