Debian Codegraph @

gcc/testsuite/gcc.target/nvptx/abi-struct-ret.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-Wno-pedantic -Wno-long-long -m64" } */
3
4 /* Struct return. Returned via pointer. */
5
6 typedef struct {} empty; /* See 'gcc/doc/extend.texi', "Empty Structures". */
7 typedef struct {char a;} one;
8 typedef struct {short a;} two;
9 typedef struct {int a;} four;
10 typedef struct {long long a;} eight;
11 typedef struct {int a, b[12];} big;
12
13 /* { dg-final { scan-assembler-times ".extern .func dcl_rempty \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
14 empty dcl_rempty (void);
15
16 /* { dg-final { scan-assembler-times ".extern .func dcl_rone \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
17 one dcl_rone (void);
18
19 /* { dg-final { scan-assembler-times ".extern .func dcl_rtwo \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
20 two dcl_rtwo (void);
21
22 /* { dg-final { scan-assembler-times ".extern .func dcl_rfour \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
23 four dcl_rfour (void);
24
25 /* { dg-final { scan-assembler-times ".extern .func dcl_reight \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
26 eight dcl_reight (void);
27
28 /* { dg-final { scan-assembler-times ".extern .func dcl_rbig \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
29 big dcl_rbig (void);
30
31 void test_1 (void)
32 {
33 dcl_rempty ();
34 dcl_rone ();
35 dcl_rtwo ();
36 dcl_rfour ();
37 dcl_reight ();
38 dcl_rbig ();
39 }
40
41 #define M(T, v) ({T t; t.a = v; t;})
42
43 /* { dg-final { scan-assembler-times ".visible .func dfn_rempty \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
44 empty dfn_rempty (void)
45 {
46 return ({empty t; t;});
47 }
48
49 /* { dg-final { scan-assembler-times ".visible .func dfn_rone \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
50 one dfn_rone (void)
51 {
52 return M (one, 1);
53 }
54
55 /* { dg-final { scan-assembler-times ".visible .func dfn_rtwo \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
56 two dfn_rtwo (void)
57 {
58 return M (two, 2);
59 }
60
61 /* { dg-final { scan-assembler-times ".visible .func dfn_rfour \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
62 four dfn_rfour (void)
63 {
64 return M (four, 3);
65 }
66
67 /* { dg-final { scan-assembler-times ".visible .func dfn_reight \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
68 eight dfn_reight (void)
69 {
70 return M (eight, 4);
71 }
72
73 /* { dg-final { scan-assembler-times ".visible .func dfn_rbig \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
74 big dfn_rbig (void)
75 {
76 return M (big, 5);
77 }