1 /* { dg-do compile } */
2 /* { dg-additional-options "-Wno-pedantic -Wno-long-long -m64" } */
3 
4 /* Complex return.  Returned via pointer.  */
5 
6 /* { dg-final { scan-assembler-times ".extern .func dcl_rcc \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
7 _Complex char dcl_rcc (void);
8 
9 /* { dg-final { scan-assembler-times ".extern .func dcl_rcs \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
10 _Complex short dcl_rcs (void);
11 
12 /* { dg-final { scan-assembler-times ".extern .func dcl_rci \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
13 _Complex int dcl_rci (void);
14 
15 /* { dg-final { scan-assembler-times ".extern .func dcl_rcll \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
16 _Complex long long dcl_rcll (void);
17 
18 /* { dg-final { scan-assembler-times ".extern .func dcl_rcf \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
19 _Complex float dcl_rcf (void);
20 
21 /* { dg-final { scan-assembler-times ".extern .func dcl_rcd \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
22 _Complex double dcl_rcd (void);
23 
test_1(void)24 void test_1 (void)
25 {
26   dcl_rcc ();
27   dcl_rcs ();
28   dcl_rci ();
29   dcl_rcll ();
30   dcl_rcf ();
31   dcl_rcd ();
32 }
33 
34 #define M(T,r,i) ({_Complex T x; __real__ (x) = (r), __imag__(x) == (i); x; })
35 
36 /* { dg-final { scan-assembler-times ".visible .func dfn_rcc \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
dfn_rcc(void)37 _Complex char dfn_rcc (void)
38 {
39   return M (char,1,2);
40 }
41 
42 /* { dg-final { scan-assembler-times ".visible .func dfn_rcs \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
dfn_rcs(void)43 _Complex short dfn_rcs (void)
44 {
45   return M (short,3,4);
46 }
47 
48 /* { dg-final { scan-assembler-times ".visible .func dfn_rci \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
dfn_rci(void)49 _Complex int dfn_rci (void)
50 {
51   return M (int,5,6);
52 }
53 
54 /* { dg-final { scan-assembler-times ".visible .func dfn_rcll \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
dfn_rcll(void)55 _Complex long long dfn_rcll (void)
56 {
57   return M (long long,7,8);
58 }
59 
60 /* { dg-final { scan-assembler-times ".visible .func dfn_rcf \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
dfn_rcf(void)61 _Complex float dfn_rcf (void)
62 {
63   return M (float,9,10);
64 }
65 
66 /* { dg-final { scan-assembler-times ".visible .func dfn_rcd \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
dfn_rcd(void)67 _Complex double dfn_rcd (void)
68 {
69   return M (double,11,12);
70 }
71