6d158f35523c6ea74af82e6a50399864ada7967c
[gcc.git] / gcc / testsuite / gcc.dg / dfp / func-array.c
1 /* C99 6.5.2.2 Function calls.
2 Test passing array elements involving decimal floating point types. */
3
4 #include "dfp-dbg.h"
5
6 /* A handful of functions that return the Nth _Decimal32 argument of
7 an incoming array. */
8
9 _Decimal32
10 arg0_32 (_Decimal32 args[])
11 {
12 return args[0];
13 }
14
15 _Decimal32
16 arg1_32 (_Decimal32 args[])
17 {
18 return args[1];
19 }
20
21 _Decimal32
22 arg2_32 (_Decimal32 args[])
23 {
24 return args[2];
25 }
26
27 _Decimal32
28 arg3_32 (_Decimal32 args[])
29 {
30 return args[3];
31 }
32
33 _Decimal32
34 arg4_32 (_Decimal32 args[])
35 {
36 return args[4];
37 }
38
39 _Decimal32
40 arg5_32 (_Decimal32 args[])
41 {
42 return args[5];
43 }
44
45 \f
46 /* A handful of functions that return the Nth _Decimal64 argument of
47 an incoming array. */
48
49 _Decimal64
50 arg0_64 (_Decimal64 args[])
51 {
52 return args[0];
53 }
54
55 _Decimal64
56 arg1_64 (_Decimal64 args[])
57 {
58 return args[1];
59 }
60
61 _Decimal64
62 arg2_64 (_Decimal64 args[])
63 {
64 return args[2];
65 }
66
67 _Decimal64
68 arg3_64 (_Decimal64 args[])
69 {
70 return args[3];
71 }
72
73 _Decimal64
74 arg4_64 (_Decimal64 args[])
75 {
76 return args[4];
77 }
78
79 _Decimal64
80 arg5_64 (_Decimal64 args[])
81 {
82 return args[5];
83 }
84
85 \f
86 /* A handful of functions that return the Nth _Decimal128 argument of
87 an incoming array. */
88
89 _Decimal128
90 arg0_128 (_Decimal128 args[])
91 {
92 return args[0];
93 }
94
95 _Decimal128
96 arg1_128 (_Decimal128 args[])
97 {
98 return args[1];
99 }
100
101 _Decimal128
102 arg2_128 (_Decimal128 args[])
103 {
104 return args[2];
105 }
106
107 _Decimal128
108 arg3_128 (_Decimal128 args[])
109 {
110 return args[3];
111 }
112
113 _Decimal128
114 arg4_128 (_Decimal128 args[])
115 {
116 return args[4];
117 }
118
119 _Decimal128
120 arg5_128 (_Decimal128 args[])
121 {
122 return args[5];
123 }
124
125 \f
126 int main()
127 {
128 _Decimal32 d32[] = { 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df };
129 _Decimal64 d64[] = { 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd };
130 _Decimal128 d128[] = { 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl };
131
132 /* _Decimal32 variants. */
133 if (arg0_32 (d32) != 0.0df) FAILURE
134 if (arg1_32 (d32) != 1.0df) FAILURE
135 if (arg2_32 (d32) != 2.0df) FAILURE
136 if (arg3_32 (d32) != 3.0df) FAILURE
137 if (arg4_32 (d32) != 4.0df) FAILURE
138 if (arg5_32 (d32) != 5.0df) FAILURE
139
140 /* _Decimal64 variants. */
141 if (arg0_64 (d64) != 0.0dd) FAILURE
142 if (arg1_64 (d64) != 1.0dd) FAILURE
143 if (arg2_64 (d64) != 2.0dd) FAILURE
144 if (arg3_64 (d64) != 3.0dd) FAILURE
145 if (arg4_64 (d64) != 4.0dd) FAILURE
146 if (arg5_64 (d64) != 5.0dd) FAILURE
147
148 /* _Decimal128 variants. */
149 if (arg0_128 (d128) != 0.0dl) FAILURE
150 if (arg1_128 (d128) != 1.0dl) FAILURE
151 if (arg2_128 (d128) != 2.0dl) FAILURE
152 if (arg3_128 (d128) != 3.0dl) FAILURE
153 if (arg4_128 (d128) != 4.0dl) FAILURE
154 if (arg5_128 (d128) != 5.0dl) FAILURE
155
156 FINISH
157 }