1 |
298 |
jeremybenn |
/* { dg-do run } */
|
2 |
|
|
/* { dg-options "-std=gnu99" } */
|
3 |
|
|
|
4 |
|
|
/* C99 6.5.2.2 Function calls.
|
5 |
|
|
Test scalar passing and return values involving fixed-point types.
|
6 |
|
|
Based on the test from ../dfp/. */
|
7 |
|
|
|
8 |
|
|
extern void abort (void);
|
9 |
|
|
|
10 |
|
|
/* A handful of functions that return the Nth argument of
|
11 |
|
|
an incoming array. */
|
12 |
|
|
|
13 |
|
|
#define FUNC(TYPE,NAME) \
|
14 |
|
|
TYPE NAME ## 0 (TYPE arg0, int arg1, unsigned arg2, float arg3, double arg4) \
|
15 |
|
|
{ return arg0; } \
|
16 |
|
|
TYPE NAME ## 1 (int arg0, TYPE arg1, unsigned arg2, float arg3, double arg4) \
|
17 |
|
|
{ return arg1; } \
|
18 |
|
|
TYPE NAME ## 2 (int arg0, unsigned arg1, TYPE arg2, float arg3, double arg4) \
|
19 |
|
|
{ return arg2; } \
|
20 |
|
|
TYPE NAME ## 3 (int arg0, unsigned arg1, float arg2, TYPE arg3, double arg4) \
|
21 |
|
|
{ return arg3; } \
|
22 |
|
|
TYPE NAME ## 4 (int arg0, unsigned arg1, float arg2, double arg3, TYPE arg4) \
|
23 |
|
|
{ return arg4; }
|
24 |
|
|
|
25 |
|
|
FUNC (short _Fract, sf)
|
26 |
|
|
FUNC (_Fract, f)
|
27 |
|
|
FUNC (long _Fract, lf)
|
28 |
|
|
FUNC (long long _Fract, llf)
|
29 |
|
|
FUNC (unsigned short _Fract, usf)
|
30 |
|
|
FUNC (unsigned _Fract, uf)
|
31 |
|
|
FUNC (unsigned long _Fract, ulf)
|
32 |
|
|
FUNC (unsigned long long _Fract, ullf)
|
33 |
|
|
FUNC (_Sat short _Fract, Ssf)
|
34 |
|
|
FUNC (_Sat _Fract, Sf)
|
35 |
|
|
FUNC (_Sat long _Fract, Slf)
|
36 |
|
|
FUNC (_Sat long long _Fract, Sllf)
|
37 |
|
|
FUNC (_Sat unsigned short _Fract, Susf)
|
38 |
|
|
FUNC (_Sat unsigned _Fract, Suf)
|
39 |
|
|
FUNC (_Sat unsigned long _Fract, Sulf)
|
40 |
|
|
FUNC (_Sat unsigned long long _Fract, Sullf)
|
41 |
|
|
FUNC (short _Accum, sa)
|
42 |
|
|
FUNC (_Accum, a)
|
43 |
|
|
FUNC (long _Accum, la)
|
44 |
|
|
FUNC (long long _Accum, lla)
|
45 |
|
|
FUNC (unsigned short _Accum, usa)
|
46 |
|
|
FUNC (unsigned _Accum, ua)
|
47 |
|
|
FUNC (unsigned long _Accum, ula)
|
48 |
|
|
FUNC (unsigned long long _Accum, ulla)
|
49 |
|
|
FUNC (_Sat short _Accum, Ssa)
|
50 |
|
|
FUNC (_Sat _Accum, Sa)
|
51 |
|
|
FUNC (_Sat long _Accum, Sla)
|
52 |
|
|
FUNC (_Sat long long _Accum, Slla)
|
53 |
|
|
FUNC (_Sat unsigned short _Accum, Susa)
|
54 |
|
|
FUNC (_Sat unsigned _Accum, Sua)
|
55 |
|
|
FUNC (_Sat unsigned long _Accum, Sula)
|
56 |
|
|
FUNC (_Sat unsigned long long _Accum, Sulla)
|
57 |
|
|
|
58 |
|
|
int main()
|
59 |
|
|
{
|
60 |
|
|
#define TEST(TYPE,NAME,PF) \
|
61 |
|
|
{ \
|
62 |
|
|
if (NAME ## 0 (0.1 ## PF, -1, 1, 0.3f, 0.5) != 0.1 ## PF) abort (); \
|
63 |
|
|
if (NAME ## 1 (-1, 0.1 ## PF, 1, 0.3f, 0.5) != 0.1 ## PF) abort (); \
|
64 |
|
|
if (NAME ## 2 (-1, 1, 0.1 ## PF, 0.3f, 0.5) != 0.1 ## PF) abort (); \
|
65 |
|
|
if (NAME ## 3 (-1, 1, 0.3f, 0.1 ## PF, 0.5) != 0.1 ## PF) abort (); \
|
66 |
|
|
if (NAME ## 4 (-1, 1, 0.3f, 0.5, 0.1 ## PF) != 0.1 ## PF) abort (); \
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
TEST (short _Fract, sf, hr)
|
70 |
|
|
TEST (_Fract, f, r)
|
71 |
|
|
TEST (long _Fract, lf, lr)
|
72 |
|
|
TEST (long long _Fract, llf, llr)
|
73 |
|
|
TEST (unsigned short _Fract, usf, uhr)
|
74 |
|
|
TEST (unsigned _Fract, uf, ur)
|
75 |
|
|
TEST (unsigned long _Fract, ulf, ulr)
|
76 |
|
|
TEST (unsigned long long _Fract, ullf, ullr)
|
77 |
|
|
TEST (_Sat short _Fract, Ssf, hr)
|
78 |
|
|
TEST (_Sat _Fract, Sf, r)
|
79 |
|
|
TEST (_Sat long _Fract, Slf, lr)
|
80 |
|
|
TEST (_Sat long long _Fract, Sllf, llr)
|
81 |
|
|
TEST (_Sat unsigned short _Fract, Susf, uhr)
|
82 |
|
|
TEST (_Sat unsigned _Fract, Suf, ur)
|
83 |
|
|
TEST (_Sat unsigned long _Fract, Sulf, ulr)
|
84 |
|
|
TEST (_Sat unsigned long long _Fract, Sullf, ullr)
|
85 |
|
|
TEST (short _Accum, sa, hk)
|
86 |
|
|
TEST (_Accum, a, k)
|
87 |
|
|
TEST (long _Accum, la, lk)
|
88 |
|
|
TEST (long long _Accum, lla, llk)
|
89 |
|
|
TEST (unsigned short _Accum, usa, uhk)
|
90 |
|
|
TEST (unsigned _Accum, ua, uk)
|
91 |
|
|
TEST (unsigned long _Accum, ula, ulk)
|
92 |
|
|
TEST (unsigned long long _Accum, ulla, ullk)
|
93 |
|
|
TEST (_Sat short _Accum, Ssa, hk)
|
94 |
|
|
TEST (_Sat _Accum, Sa, k)
|
95 |
|
|
TEST (_Sat long _Accum, Sla, lk)
|
96 |
|
|
TEST (_Sat long long _Accum, Slla, llk)
|
97 |
|
|
TEST (_Sat unsigned short _Accum, Susa, uhk)
|
98 |
|
|
TEST (_Sat unsigned _Accum, Sua, uk)
|
99 |
|
|
TEST (_Sat unsigned long _Accum, Sula, ulk)
|
100 |
|
|
TEST (_Sat unsigned long long _Accum, Sulla, ullk)
|
101 |
|
|
|
102 |
|
|
return 0;
|
103 |
|
|
}
|