diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-08-16 13:26:16 -0700 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-08-16 13:28:55 -0700 |
commit | cad13d0dce46dbbb42140a40f32245f73672dc39 (patch) | |
tree | 6fe5be74e6e00951eb6ff1cd4c6dcc5762dc099c /test | |
parent | fbbb8e4d78e8b2e9410699fd27af282cc6ddfc4b (diff) | |
download | roux-cad13d0dce46dbbb42140a40f32245f73672dc39.tar.gz |
add support for unions in sysv abi
Diffstat (limited to 'test')
-rw-r--r-- | test/abi5.ssa | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/abi5.ssa b/test/abi5.ssa index 7899035..c3d9046 100644 --- a/test/abi5.ssa +++ b/test/abi5.ssa @@ -8,6 +8,8 @@ type :st5 = { s, l } type :st6 = { b 16 } type :st7 = { s, d } type :st8 = { w 4 } +type :un9 = { { b } { s } } +type :st9 = { w, :un9 } data $fmt1 = { b "t1: %s\n", b 0 } data $fmt2 = { b "t2: %d\n", b 0 } @@ -17,6 +19,7 @@ data $fmt5 = { b "t5: %f %lld\n", b 0 } data $fmt6 = { b "t6: %s\n", b 0 } data $fmt7 = { b "t7: %f %f\n", b 0 } data $fmt8 = { b "t8: %d %d %d %d\n", b 0 } +data $fmt9 = { b "t9: %d %f\n", b 0 } export function $test() { @@ -68,6 +71,13 @@ function $test() { %w84 =w loadw %r812 %i8 =w call $printf(l $fmt8, w %w81, w %w82, w %w83, w %w84) + %r9 =:st9 call $t9() + %r94 =l add 4, %r9 + %w9 =w loadw %r9 + %s9 =s loads %r94 + %d9 =d exts %s9 + %i9 =w call $printf(l $fmt9, w %w9, d %d9) + ret } @@ -82,6 +92,7 @@ function $test() { # typedef struct { char t[16]; } st6; # typedef struct { float f; double d; } st7; # typedef struct { int i[4]; } st8; +# typedef struct { int i; union { char c; float f; } u; } st9; # extern void test(void); # st1 t1() { return (st1){"abcdefghijklmnop"}; } # st2 t2() { return (st2){2}; } @@ -91,6 +102,7 @@ function $test() { # st6 t6() { return (st6){"abcdefghijklmno"}; } # st7 t7() { return (st7){7.77,77.7}; } # st8 t8() { return (st8){-8,88,-888,8888}; } +# st9 t9() { return (st9){9,{.f=9.9}}; } # int main() { test(); return 0; } # <<< @@ -103,4 +115,5 @@ function $test() { # t6: abcdefghijklmno # t7: 7.770000 77.700000 # t8: -8 88 -888 8888 +# t9: 9 9.900000 # <<< |