aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/nvptx/abi-vect-ret.c
blob: 78adf5097eb8b137e5ffed3e2b75411cd5e08dc1 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/* { dg-do compile } */
/* { dg-additional-options "-Wno-pedantic -Wno-long-long -m64" } */

/* Vector return.  Return via pointer.  */

typedef char __attribute__ ((vector_size (1))) vc1;
typedef char __attribute__ ((vector_size (2))) vc2;
typedef char __attribute__ ((vector_size (4))) vc4;
typedef char __attribute__ ((vector_size (8))) vc8;

typedef short __attribute__ ((vector_size (2))) vs1;
typedef short __attribute__ ((vector_size (4))) vs2;
typedef short __attribute__ ((vector_size (8))) vs4;
typedef short __attribute__ ((vector_size (16))) vs8;

typedef int __attribute__ ((vector_size (4))) vi1;
typedef int __attribute__ ((vector_size (8))) vi2;
typedef int __attribute__ ((vector_size (16))) vi4;
typedef int __attribute__ ((vector_size (32))) vi8;

typedef long long __attribute__ ((vector_size (8))) vll1;
typedef long long __attribute__ ((vector_size (16))) vll2;
typedef long long __attribute__ ((vector_size (32))) vll4;
typedef long long __attribute__ ((vector_size (64))) vll8;

typedef float __attribute__ ((vector_size (4))) vf1;
typedef float __attribute__ ((vector_size (8))) vf2;
typedef float __attribute__ ((vector_size (16))) vf4;
typedef float __attribute__ ((vector_size (32))) vf8;

typedef double __attribute__ ((vector_size (8))) vd1;
typedef double __attribute__ ((vector_size (16))) vd2;
typedef double __attribute__ ((vector_size (32))) vd4;
typedef double __attribute__ ((vector_size (64))) vd8;

/* { dg-final { scan-assembler-times ".extern .func dcl_rvc1 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vc1 dcl_rvc1 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvc2 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vc2 dcl_rvc2 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvc4 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vc4 dcl_rvc4 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvc8 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vc8 dcl_rvc8 (void);

/* { dg-final { scan-assembler-times ".extern .func dcl_rvs1 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vs1 dcl_rvs1 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvs2 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vs2 dcl_rvs2 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvs4 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vs4 dcl_rvs4 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvs8 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vs8 dcl_rvs8 (void);

/* { dg-final { scan-assembler-times ".extern .func dcl_rvi1 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vi1 dcl_rvi1 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvi2 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vi2 dcl_rvi2 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvi4 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vi4 dcl_rvi4 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvi8 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vi8 dcl_rvi8 (void);

/* { dg-final { scan-assembler-times ".extern .func dcl_rvll1 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vll1 dcl_rvll1 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvll2 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vll2 dcl_rvll2 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvll4 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vll4 dcl_rvll4 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvll8 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vll8 dcl_rvll8 (void);

/* { dg-final { scan-assembler-times ".extern .func dcl_rvf1 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vf1 dcl_rvf1 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvf2 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vf2 dcl_rvf2 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvf4 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vf4 dcl_rvf4 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvf8 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vf8 dcl_rvf8 (void);

/* { dg-final { scan-assembler-times ".extern .func dcl_rvd1 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vd1 dcl_rvd1 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvd2 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vd2 dcl_rvd2 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvd4 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vd4 dcl_rvd4 (void);
/* { dg-final { scan-assembler-times ".extern .func dcl_rvd8 \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
vd8 dcl_rvd8 (void);

void  test_1 (void)
{
  dcl_rvc1 ();
  dcl_rvc2 ();
  dcl_rvc4 ();
  dcl_rvc8 ();
  
  dcl_rvs1 ();
  dcl_rvs2 ();
  dcl_rvs4 ();
  dcl_rvs8 ();
  
  dcl_rvi1 ();
  dcl_rvi2 ();
  dcl_rvi4 ();
  dcl_rvi8 ();

  dcl_rvll1 ();
  dcl_rvll2 ();
  dcl_rvll4 ();
  dcl_rvll8 ();
  
  dcl_rvf1 ();
  dcl_rvf2 ();
  dcl_rvf4 ();
  dcl_rvf8 ();

  dcl_rvd1 ();
  dcl_rvd2 ();
  dcl_rvd4 ();
  dcl_rvd8 ();
}

#define M(T, V) ({T t;t[0]= V;t;})

/* { dg-final { scan-assembler-times ".visible .func dfn_rvc1 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vc1 dfn_rvc1 (void)
{
  return M (vc1, 1);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvc2 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vc2 dfn_rvc2 (void)
{
  return M (vc2, 2);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvc4 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vc4 dfn_rvc4 (void)
{
  return M (vc4, 3);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvc8 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vc8 dfn_rvc8 (void)
{
  return M (vc8, 4);
}

/* { dg-final { scan-assembler-times ".visible .func dfn_rvs1 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vs1 dfn_rvs1 (void)
{
  return M (vs1, 5);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvs2 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vs2 dfn_rvs2 (void)
{
  return M (vs2, 6);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvs4 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vs4 dfn_rvs4 (void)
{
  return M (vs4, 7);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvs8 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vs8 dfn_rvs8 (void)
{
  return M (vs8, 8);
}

/* { dg-final { scan-assembler-times ".visible .func dfn_rvi1 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vi1 dfn_rvi1 (void)
{
  return M (vi1, 9);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvi2 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vi2 dfn_rvi2 (void)
{
  return M (vi2, 10);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvi4 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vi4 dfn_rvi4 (void)
{
  return M (vi4, 11);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvi8 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vi8 dfn_rvi8 (void)
{
  return M (vi8, 12);
}

/* { dg-final { scan-assembler-times ".visible .func dfn_rvll1 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vll1 dfn_rvll1 (void)
{
  return M (vll1, 13);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvll2 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vll2 dfn_rvll2 (void)
{
  return M (vll2, 14);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvll4 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vll4 dfn_rvll4 (void)
{
  return M (vll4, 16);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvll8 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vll8 dfn_rvll8 (void)
{
  return M (vll8, 6);
}

/* { dg-final { scan-assembler-times ".visible .func dfn_rvf1 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vf1 dfn_rvf1 (void)
{
  return M (vf1, 17);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvf2 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vf2 dfn_rvf2 (void)
{
  return M (vf2, 18);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvf4 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vf4 dfn_rvf4 (void)
{
  return M (vf4, 19);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvf8 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vf8 dfn_rvf8 (void)
{
  return M (vf8, 20);
}

/* { dg-final { scan-assembler-times ".visible .func dfn_rvd1 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vd1 dfn_rvd1 (void)
{
  return M (vd1, 21);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvd2 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vd2 dfn_rvd2 (void)
{
  return M (vd2, 22);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvd4 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vd4 dfn_rvd4 (void)
{
  return M (vd4, 23);
}
/* { dg-final { scan-assembler-times ".visible .func dfn_rvd8 \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
vd8 dfn_rvd8 (void)
{
  return M (vd8, 24);
}