aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-2.c
blob: 6b171c46fbb534244b49c216a52ff850a53b1e5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* Test AAPCS64 function result return.

   This test covers most composite types as described in AAPCS64 \S 4.3.
   Homogeneous floating-point aggregate types are covered in func-ret-3.c.  */

/* { dg-do run { target aarch64*-*-* } } */
/* { dg-additional-sources "abitest.S" } */

#ifndef IN_FRAMEWORK
#define TESTFILE "func-ret-2.c"

struct x0
{
  char ch;
  int i;
} ys0 = { 'a', 12345 };

struct x1
{
  int a;
  unsigned int b;
  unsigned int c;
  unsigned int d;
} ys1 = { 0xdeadbeef, 0xcafebabe, 0x87654321, 0xbcedf975 };

struct x2
{
  long long a;
  long long b;
  char ch;
} y2 = { 0x12, 0x34, 0x56 };

union x3
{
  char ch;
  int i;
  long long ll;
} y3;

union x4
{
  int i;
  struct x2 y2;
} y4;

#define HAS_DATA_INIT_FUNC
void init_data ()
{
  /* Init small union.  */
  y3.ll = 0xfedcba98LL;

  /* Init big union.  */
  y4.y2.a = 0x78;
  y4.y2.b = 0x89;
  y4.y2.ch= 0x9a;
}


#include "abitest-2.h"
#else
  /* Composite smaller than or equal to 16 bytes returned in X0 and X1.  */
FUNC_VAL_CHECK ( 0, struct x0, ys0, X0, flat)
FUNC_VAL_CHECK ( 1, struct x1, ys1, X0, flat)
FUNC_VAL_CHECK ( 2, union  x3, y3, X0, flat)

  /* Composite larger than 16 bytes returned in the caller-reserved memory
     block of which the address is passed as an additional argument to the
     function in X8.  */
FUNC_VAL_CHECK (10, struct x2, y2, X8, flat)
FUNC_VAL_CHECK (11, union  x4, y4, X8, flat)
#endif