Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-2.c

raw
1 /* Test AAPCS64 function result return.
2
3 This test covers most composite types as described in AAPCS64 \S 4.3.
4 Homogeneous floating-point aggregate types are covered in func-ret-3.c. */
5
6 /* { dg-do run { target aarch64*-*-* } } */
7 /* { dg-additional-options "-mbranch-protection=none" } */
8 /* { dg-additional-sources "abitest.S" } */
9
10 #ifndef IN_FRAMEWORK
11 #define TESTFILE "func-ret-2.c"
12
13 struct x0
14 {
15 char ch;
16 int i;
17 } ys0 = { 'a', 12345 };
18
19 struct x1
20 {
21 int a;
22 unsigned int b;
23 unsigned int c;
24 unsigned int d;
25 } ys1 = { 0xdeadbeef, 0xcafebabe, 0x87654321, 0xbcedf975 };
26
27 struct x2
28 {
29 long long a;
30 long long b;
31 char ch;
32 } y2 = { 0x12, 0x34, 0x56 };
33
34 union x3
35 {
36 char ch;
37 int i;
38 long long ll;
39 } y3;
40
41 union x4
42 {
43 int i;
44 struct x2 y2;
45 } y4;
46
47 #define HAS_DATA_INIT_FUNC
48 void init_data ()
49 {
50 /* Init small union. */
51 y3.ll = 0xfedcba98LL;
52
53 /* Init big union. */
54 y4.y2.a = 0x78;
55 y4.y2.b = 0x89;
56 y4.y2.ch= 0x9a;
57 }
58
59
60 #include "abitest-2.h"
61 #else
62 /* Composite smaller than or equal to 16 bytes returned in X0 and X1. */
63 FUNC_VAL_CHECK ( 0, struct x0, ys0, X0, flat)
64 FUNC_VAL_CHECK ( 1, struct x1, ys1, X0, flat)
65 FUNC_VAL_CHECK ( 2, union x3, y3, X0, flat)
66
67 /* Composite larger than 16 bytes returned in the caller-reserved memory
68 block of which the address is passed as an additional argument to the
69 function in X8. */
70 FUNC_VAL_CHECK (10, struct x2, y2, X8, flat)
71 FUNC_VAL_CHECK (11, union x4, y4, X8, flat)
72 #endif