git subrepo pull --force deps/lightrec
[pcsx_rearmed.git] / deps / lightning / check / clobber.tst
1 /* do not bother about result of operations, only ensure valid arguments
2  * and that registers not modified by the operation are not clobbered  */
3
4 #define IV0             0x10000
5 #define IV1             0x10001
6 #define IV2             0x10002
7 #define IV3             0x10003
8 #define IV4             0x10004
9 #define IV5             0x10005
10 #define FV0             100.0
11 #define FV1             101.0
12 #define FV2             102.0
13 #define FV3             103.0
14 #define FV4             104.0
15 #define FV5             105.0
16 #define IR0             r0
17 #define IR1             r1
18 #define IR2             r2
19 #define IR3             v0
20 #define IR4             v1
21 #define IR5             v2
22 #define FR0             f0
23 #define FR1             f1
24 #define FR2             f2
25 #define FR3             f3
26 #define FR4             f4
27 #define FR5             f5
28
29 #define setup()                                                 \
30         movi %r0 IV0                                            \
31         movi %r1 IV1                                            \
32         movi %r2 IV2                                            \
33         movi %v0 IV3                                            \
34         movi %v1 IV4                                            \
35         movi %v2 IV5
36 #define setup_f()                                               \
37         movi_f %f0 FV0                                          \
38         movi_f %f1 FV1                                          \
39         movi_f %f2 FV2                                          \
40         movi_f %f3 FV3                                          \
41         movi_f %f4 FV4                                          \
42         movi_f %f5 FV5
43 #define setup_d()                                               \
44         movi_d %f0 FV0                                          \
45         movi_d %f1 FV1                                          \
46         movi_d %f2 FV2                                          \
47         movi_d %f3 FV3                                          \
48         movi_d %f4 FV4                                          \
49         movi_d %f5 FV5
50
51 #define check(label, rn)                                        \
52         beqi label %IR##rn IV##rn                               \
53         calli @abort                                            \
54 label:
55 #define check1(k, l, i0)                                        \
56         check(k##l##i0##_0, i0)
57 #define check2(k, l, i0, i1)                                    \
58         check(k##l##i0##i1##_0, i0)                             \
59         check(k##l##i0##i1##_1, i1)
60 #define check3(k, l, i0, i1, i2)                                \
61         check(k##l##i0##i1##i2##_0, i0)                         \
62         check(k##l##i0##i1##i2##_1, i1)                         \
63         check(k##l##i0##i1##i2##_2, i2)
64 #define check4(k, l, i0, i1, i2, i3)                            \
65         check(k##l##i0##i1##i2##i3##_0, i0)                     \
66         check(k##l##i0##i1##i2##i3##_1, i1)                     \
67         check(k##l##i0##i1##i2##i3##_2, i2)                     \
68         check(k##l##i0##i1##i2##i3##_3, i3)
69 #define check5(k, l, i0, i1, i2, i3, i4)                        \
70         check(k##l##i0##i1##i2##i3##i4##_0, i0)                 \
71         check(k##l##i0##i1##i2##i3##i4##_1, i1)                 \
72         check(k##l##i0##i1##i2##i3##i3##_2, i2)                 \
73         check(k##l##i0##i1##i2##i3##i4##_3, i3)                 \
74         check(k##l##i0##i1##i2##i3##i4##_4, i4)
75 #define check6(k, l, i0, i1, i2, i3, i4, i5)                    \
76         check(k##l##i0##i1##i2##i3##i4##i5##_0, i0)             \
77         check(k##l##i0##i1##i2##i3##i4##i5##_1, i1)             \
78         check(k##l##i0##i1##i2##i3##i3##i5##_2, i2)             \
79         check(k##l##i0##i1##i2##i3##i4##i5##_3, i3)             \
80         check(k##l##i0##i1##i2##i3##i4##i5##_4, i4)             \
81         check(k##l##i0##i1##i2##i3##i4##i5##_5, i5)
82
83 #define checkf(f, label, rn)                                    \
84         beqi##f label %FR##rn FV##rn                            \
85         calli @abort                                            \
86 label:
87 #define checkf1(f, k, l, i0)                                    \
88         checkf(f, f##k##l##i0##_0, i0)
89 #define checkf2(f, k, l, i0, i1)                                \
90         checkf(f, f##k##l##i0##i1##_0, i0)                      \
91         checkf(f, f##k##l##i0##i1##_1, i1)
92 #define checkf3(f, k, l, i0, i1, i2)                            \
93         checkf(f, f##k##l##i0##i1##i2##_0, i0)                  \
94         checkf(f, f##k##l##i0##i1##i2##_1, i1)                  \
95         checkf(f, f##k##l##i0##i1##i2##_2, i2)
96 #define checkf4(f, k, l, i0, i1, i2, i3)                        \
97         checkf(f, f##k##l##i0##i1##i2##i3##_0, i0)              \
98         checkf(f, f##k##l##i0##i1##i2##i3##_1, i1)              \
99         checkf(f, f##k##l##i0##i1##i2##i3##_2, i2)              \
100         checkf(f, f##k##l##i0##i1##i2##i3##_3, i3)
101 #define checkf5(f, k, l, i0, i1, i2, i3, i4)                    \
102         checkf(f, f##k##l##i0##i1##i2##i3##i4##_0, i0)          \
103         checkf(f, f##k##l##i0##i1##i2##i3##i4##_1, i1)          \
104         checkf(f, f##k##l##i0##i1##i2##i3##i3##_2, i2)          \
105         checkf(f, f##k##l##i0##i1##i2##i3##i4##_3, i3)          \
106         checkf(f, f##k##l##i0##i1##i2##i3##i4##_4, i4)
107 #define checkf6(f, k, l, i0, i1, i2, i3, i4, i5)                \
108         checkf(f, f##k##l##i0##i1##i2##i3##i4##i5##_0, i0)      \
109         checkf(f, f##k##l##i0##i1##i2##i3##i4##i5##_1, i1)      \
110         checkf(f, f##k##l##i0##i1##i2##i3##i3##i5##_2, i2)      \
111         checkf(f, f##k##l##i0##i1##i2##i3##i4##i5##_3, i3)      \
112         checkf(f, f##k##l##i0##i1##i2##i3##i4##i5##_4, i4)      \
113         checkf(f, f##k##l##i0##i1##i2##i3##i4##i5##_5, i5)
114
115 #define alui(l, op, i0, i1, i2, i3, i4, i5)                     \
116         setup()                                                 \
117         movi %IR##i0 1                                          \
118         op##i %IR##i1 %IR##i0 1                                 \
119         check4(i, l, i2, i3, i4, i5)
120 #define aluic(l, op, i0, i1, i2, i3, i4, i5)                    \
121         setup()                                                 \
122         movi %IR##i0 1                                          \
123         op##i %IR##i0 %IR##i0 1                                 \
124         check5(ic, l, i1, i2, i3, i4, i5)
125 #define alur(l, op, i0, i1, i2, i3, i4, i5)                     \
126         setup()                                                 \
127         movi %IR##i0 1                                          \
128         movi %IR##i1 1                                          \
129         op##r %IR##i2 %IR##i0 %IR##i1                           \
130         check3(r, l, i3, i4, i5)
131 #define alurc0(l, op, i0, i1, i2, i3, i4, i5)                   \
132         setup()                                                 \
133         movi %IR##i0 1                                          \
134         movi %IR##i1 1                                          \
135         op##r %IR##i0 %IR##i0 %IR##i1                           \
136         check4(r0, l, i2, i3, i4, i5)
137 #define alurc1(l, op, i0, i1, i2, i3, i4, i5)                   \
138         setup()                                                 \
139         movi %IR##i0 1                                          \
140         movi %IR##i1 1                                          \
141         op##r %IR##i1 %IR##i0 %IR##i1                           \
142         check4(r1, l, i2, i3, i4, i5)
143 #define alurc2(l, op, i0, i1, i2, i3, i4, i5)                   \
144         setup()                                                 \
145         movi %IR##i0 1                                          \
146         op##r %IR##i0 %IR##i0 %IR##i0                           \
147         check5(r2, l, i1, i2, i3, i4, i5)
148 #define   xalu(l, op, i0, i1, i2, i3, i4, i5)                   \
149           alui(l, op, i0, i1,   i2, i3, i4, i5)                 \
150          aluic(l, op, i0,               i1, i2, i3, i4, i5)     \
151           alur(l, op, i0, i1, i2,       i3, i4, i5)             \
152         alurc0(l, op, i0, i1,   i2, i3, i4, i5)                 \
153         alurc1(l, op, i0, i1,   i2, i3, i4, i5)                 \
154         alurc2(l, op, i0,               i1, i2, i3, i4, i5)
155
156 #if __ia64__
157 #  define alu(l, op)                                            \
158          xalu(l, op, 0, 1, 2, 3, 4, 5)
159 #else
160 #  define alu(l, op)                                            \
161          xalu(l, op, 0, 1, 2, 3, 4, 5)                          \
162          xalu(l, op, 1, 2, 3, 4, 5, 0)                          \
163          xalu(l, op, 2, 3, 4, 5, 0, 1)                          \
164          xalu(l, op, 3, 4, 5, 0, 1, 2)                          \
165          xalu(l, op, 4, 5, 0, 1, 2, 3)                          \
166          xalu(l, op, 5, 0, 1, 2, 3, 4)
167 #endif
168
169 #define fopi(f, l, op, f0, f1, f2, f3, f4, f5)                  \
170         setup##f()                                              \
171         movi##f %FR##f0 1.0                                     \
172         op##i##f %FR##f1 %FR##f0 1.0                            \
173         checkf4(f, i, l, f2, f3, f4, f5)
174 #define fopic(f, l, op, f0, f1, f2, f3, f4, f5)                 \
175         setup##f()                                              \
176         movi##f %FR##f0 1.0                                     \
177         op##i##f %FR##f0 %FR##f0 1.0                            \
178         checkf5(f, ic, l, f1, f2, f3, f4, f5)
179 #define fopr(f, l, op, f0, f1, f2, f3, f4, f5)                  \
180         setup##f()                                              \
181         movi##f %FR##f0 1.0                                     \
182         movi##f %FR##f1 1.0                                     \
183         op##r##f %FR##f2 %FR##f0 %FR##f1                        \
184         checkf3(f, r, l, f3, f4, f5)
185 #define foprc0(f, l, op, f0, f1, f2, f3, f4, f5)                \
186         setup##f()                                              \
187         movi##f %FR##f0 1.0                                     \
188         movi##f %FR##f1 1.0                                     \
189         op##r##f %FR##f0 %FR##f0 %FR##f1                        \
190         checkf4(f, r0, l, f2, f3, f4, f5)
191 #define foprc1(f, l, op, f0, f1, f2, f3, f4, f5)                \
192         setup##f()                                              \
193         movi##f %FR##f0 1.0                                     \
194         movi##f %FR##f1 1.0                                     \
195         op##r##f %FR##f1 %FR##f0 %FR##f1                        \
196         checkf4(f, r1, l, f2, f3, f4, f5)
197 #define foprc2(f, l, op, f0, f1, f2, f3, f4, f5)                \
198         setup##f()                                              \
199         movi##f %FR##f0 1.0                                     \
200         op##r##f %FR##f0 %FR##f0 %FR##f0                        \
201         checkf5(f, r2, l, f1, f2, f3, f4, f5)
202 #define   xfop(f, l, op, f0, f1, f2, f3, f4, f5)                \
203           fopi(f, l, op, f0, f1, f2,            f3, f4, f5)     \
204          fopic(f, l, op, f0, f1, f2,            f3, f4, f5)     \
205           fopr(f, l, op, f0, f1, f2,            f3, f4, f5)     \
206         foprc0(f, l, op, f0, f1,                f2, f3, f4, f5) \
207         foprc1(f, l, op, f0, f1,                f2, f3, f4, f5) \
208         foprc2(f, l, op, f0, f1,                f2, f3, f4, f5)
209 #if __ia64__
210 #  define xxfop(l, op, f, f0, f1, f2, f3, f4, f5)               \
211            xfop(_f, l, op, f0, f1, f2, f3, f4, f5)
212 #else
213 #  define xxfop(l, op, f, f0, f1, f2, f3, f4, f5)               \
214            xfop(_f, l, op, f0, f1, f2, f3, f4, f5)              \
215            xfop(_d, l, op, f0, f1, f2, f3, f4, f5)
216 #endif
217 #if __ia64__
218 #  define fop(l, op)                                            \
219         xxfop(l, op, f, 0, 1, 2, 3, 4, 5)
220 #else
221 #  define fop(l, op)                                            \
222         xxfop(l, op, f, 0, 1, 2, 3, 4, 5)                       \
223         xxfop(l, op, f, 1, 2, 3, 4, 5, 0)                       \
224         xxfop(l, op, f, 2, 3, 4, 5, 0, 1)                       \
225         xxfop(l, op, f, 3, 4, 5, 0, 1, 2)                       \
226         xxfop(l, op, f, 4, 5, 0, 1, 2, 3)                       \
227         xxfop(l, op, f, 5, 0, 1, 2, 3, 4)
228 #endif
229
230 #define aluxii(l, op, i0, i1, i2, i3, i4, i5)                   \
231         setup()                                                 \
232         movi %IR##i0 1                                          \
233         op##ci %IR##i1 %IR##i0 1                                \
234         op##xi %IR##i2 %IR##i0 1                                \
235         check3(ii, l, i3, i4, i5)
236 #define aluxir(l, op, i0, i1, i2, i3, i4, i5)                   \
237         setup()                                                 \
238         movi %IR##i0 1                                          \
239         op##ci %IR##i1 %IR##i0 1                                \
240         op##xr %IR##i2 %IR##i0 %IR##i1                          \
241         check3(ir, l, i3, i4, i5)
242 #define aluxri(l, op, i0, i1, i2, i3, i4, i5)                   \
243         setup()                                                 \
244         movi %IR##i0 1                                          \
245         movi %IR##i1 1                                          \
246         op##cr %IR##i2 %IR##i0 %IR##i1                          \
247         op##xi %IR##i0 %IR##i1 1                                \
248         check3(ri, l, i3, i4, i5)
249 #define aluxrr(l, op, i0, i1, i2, i3, i4, i5)                   \
250         setup()                                                 \
251         movi %IR##i0 1                                          \
252         movi %IR##i1 1                                          \
253         op##cr %IR##i2 %IR##i0 %IR##i1                          \
254         op##xr %IR##i2 %IR##i0 %IR##i1                          \
255         check3(rr, l, i3, i4, i5)
256 #define  xalux(l, op, i0, i1, i2, i3, i4, i5)                   \
257         aluxii(l, op, i0, i1, i2,       i3, i4, i5)             \
258         aluxir(l, op, i0, i1, i2,       i3, i4, i5)             \
259         aluxri(l, op, i0, i1, i2,       i3, i4, i5)             \
260         aluxrr(l, op, i0, i1, i2,       i3, i4, i5)
261 #if __ia64__
262 #  define alux(l, op)                                           \
263          xalux(l, op, 0, 1, 2, 3, 4, 5)
264 #else
265 #  define alux(l, op)                                           \
266          xalux(l, op, 0, 1, 2, 3, 4, 5)                         \
267          xalux(l, op, 1, 2, 3, 4, 5, 0)                         \
268          xalux(l, op, 2, 3, 4, 5, 0, 1)                         \
269          xalux(l, op, 3, 4, 5, 0, 1, 2)                         \
270          xalux(l, op, 4, 5, 0, 1, 2, 3)                         \
271          xalux(l, op, 5, 0, 1, 2, 3, 4)
272 #endif
273
274 #define alui_u(l, op, i0, i1, i2, i3, i4, i5)                   \
275         setup()                                                 \
276         movi %IR##i0 1                                          \
277         op##i_u %IR##i1 %IR##i0 1                               \
278         check4(i_u, l, i2, i3, i4, i5)
279 #define aluic_u(l, op, i0, i1, i2, i3, i4, i5)                  \
280         setup()                                                 \
281         movi %IR##i0 1                                          \
282         op##i_u %IR##i0 %IR##i0 1                               \
283         check5(ic_u, l, i1, i2, i3, i4, i5)
284 #define alur_u(l, op, i0, i1, i2, i3, i4, i5)                   \
285         setup()                                                 \
286         movi %IR##i0 1                                          \
287         movi %IR##i1 1                                          \
288         op##r_u %IR##i2 %IR##i0 %IR##i1                         \
289         check3(r_u, l, i3, i4, i5)
290 #define alurc0_u(l, op, i0, i1, i2, i3, i4, i5)                 \
291         setup()                                                 \
292         movi %IR##i0 1                                          \
293         movi %IR##i1 1                                          \
294         op##r_u %IR##i0 %IR##i0 %IR##i1                         \
295         check4(r0_u, l, i2, i3, i4, i5)
296 #define alurc1_u(l, op, i0, i1, i2, i3, i4, i5)                 \
297         setup()                                                 \
298         movi %IR##i0 1                                          \
299         movi %IR##i1 1                                          \
300         op##r_u %IR##i1 %IR##i0 %IR##i1                         \
301         check4(r1_u, l, i2, i3, i4, i5)
302 #define alurc2_u(l, op, i0, i1, i2, i3, i4, i5)                 \
303         setup()                                                 \
304         movi %IR##i0 1                                          \
305         op##r_u %IR##i0 %IR##i0 %IR##i0                         \
306         check5(r2_u, l, i1, i2, i3, i4, i5)
307 #define   xalu_u(l, op, i0, i1, i2, i3, i4, i5)                 \
308           alui_u(l, op, i0, i1, i2, i3, i4, i5)                 \
309          aluic_u(l, op, i0,             i1, i2, i3, i4, i5)     \
310           alur_u(l, op, i0, i1, i2,     i3, i4, i5)             \
311         alurc0_u(l, op, i0, i1, i2, i3, i4, i5)                 \
312         alurc1_u(l, op, i0, i1, i2, i3, i4, i5)                 \
313         alurc2_u(l, op, i0,             i1, i2, i3, i4, i5)
314 #if __ia64__
315 #  define alu_u(l, op)                                          \
316          xalu_u(l, op, 0, 1, 2, 3, 4, 5)
317 #else
318 #  define alu_u(l, op)                                          \
319          xalu_u(l, op, 0, 1, 2, 3, 4, 5)                        \
320          xalu_u(l, op, 1, 2, 3, 4, 5, 0)                        \
321          xalu_u(l, op, 2, 3, 4, 5, 0, 1)                        \
322          xalu_u(l, op, 3, 4, 5, 0, 1, 2)                        \
323          xalu_u(l, op, 4, 5, 0, 1, 2, 3)                        \
324          xalu_u(l, op, 5, 0, 1, 2, 3, 4)
325 #endif
326
327 #define unir(l, op, i0, i1, i2, i3, i4, i5)                     \
328         setup()                                                 \
329         movi %IR##i0 1                                          \
330         op %IR##i1 %IR##i0                                      \
331         check4(rr, l, i2, i3, i4, i5)
332 #define unirc(l, op, i0, i1, i2, i3, i4, i5)                    \
333         setup()                                                 \
334         movi %IR##i0 1                                          \
335         op %IR##i0 %IR##i0                                      \
336         check5(rc, l, i1, i2, i3, i4, i5)
337 #define   xuni(l, op, i0, i1, i2, i3, i4, i5)                   \
338           unir(l, op, i0, i1,   i2, i3, i4, i5)                 \
339          unirc(l, op, i0,               i1, i2, i3, i4, i5)
340 #if __ia64__
341 #  define uni(l, op)                                            \
342          xuni(l, op, 0, 1, 2, 3, 4, 5)
343 #else
344 #  define uni(l, op)                                            \
345          xuni(l, op, 0, 1, 2, 3, 4, 5)                          \
346          xuni(l, op, 1, 2, 3, 4, 5, 0)                          \
347          xuni(l, op, 2, 3, 4, 5, 0, 1)                          \
348          xuni(l, op, 3, 4, 5, 0, 1, 2)                          \
349          xuni(l, op, 4, 5, 0, 1, 2, 3)                          \
350          xuni(l, op, 5, 0, 1, 2, 3, 4)
351 #endif
352
353 #define unfr(f, l, op, f0, f1, f2, f3, f4, f5)                  \
354         setup##f()                                              \
355         movi##f %FR##f0 1                                       \
356         op##f %FR##f1 %FR##f0                                   \
357         checkf4(f, rr, l, f2, f3, f4, f5)
358 #define unfrc(f, l, op, f0, f1, f2, f3, f4, f5)                 \
359         setup##f()                                              \
360         movi##f %FR##f0 1                                       \
361         op##f %FR##f0 %FR##f0                                   \
362         checkf5(f, rc, l, f1, f2, f3, f4, f5)
363 #define   xunf(f, l, op, f0, f1, f2, f3, f4, f5)                \
364           unfr(f, l, op, f0, f1,        f2, f3, f4, f5)         \
365          unfrc(f, l, op, f0,            f1, f2, f3, f4, f5)
366 #define xxunf(l, op, f0, f1, f2, f3, f4, f5)                    \
367          xunf(_f, l, op, f0, f1, f2, f3, f4, f5)                \
368          xunf(_d, l, op, f0, f1, f2, f3, f4, f5)
369 #if __ia64__
370 #  define unf(l, op)                                            \
371         xxunf(l, op, 0, 1, 2, 3, 4, 5)
372 #else
373 #  define unf(l, op)                                            \
374         xxunf(l, op, 0, 1, 2, 3, 4, 5)                          \
375         xxunf(l, op, 1, 2, 3, 4, 5, 0)                          \
376         xxunf(l, op, 2, 3, 4, 5, 0, 1)                          \
377         xxunf(l, op, 3, 4, 5, 0, 1, 2)                          \
378         xxunf(l, op, 4, 5, 0, 1, 2, 3)                          \
379         xxunf(l, op, 5, 0, 1, 2, 3, 4)
380 #endif
381
382 #define fcpi(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)    \
383         setup()                                                 \
384         setup##f()                                              \
385         movi##f %FR##f0 1.0                                     \
386         op##i##f %IR##r0 %FR##f0 1.0                            \
387         check5(i##f##f0, l, r1, r2, r3, r4, r5)                 \
388         checkf5(f, i##r0, l, f1, f2, f3, f4, f5)
389 #define fcpr(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)    \
390         setup()                                                 \
391         setup##f()                                              \
392         movi##f %FR##f0 1.0                                     \
393         movi##f %FR##f1 1.0                                     \
394         op##r##f %IR##r0 %FR##f0 %FR##f1                        \
395         check5(r##f##f0, l, r1, r2, r3, r4, r5)                 \
396         checkf4(f, r##r0, l, f2, f3, f4, f5)
397 #define fcprc(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)   \
398         setup()                                                 \
399         setup##f()                                              \
400         movi##f %FR##f0 1.0                                     \
401         op##r##f %IR##r0 %FR##f0 %FR##f0                        \
402         check5(rc##f##f0, l, r1, r2, r3, r4, r5)                \
403         checkf5(f, rc##r0, l, f1, f2, f3, f4, f5)
404 #if __ia64__
405 #  define ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
406           fcpi(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
407 #else
408 #  define ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
409           fcpi(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
410           fcpr(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
411          fcprc(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
412           fcpi(f, l, op, r1,r2,r3,r4,r5,r0, f0,f1,f2,f3,f4,f5)  \
413           fcpr(f, l, op, r1,r2,r3,r4,r5,r0, f0,f1,f2,f3,f4,f5)  \
414          fcprc(f, l, op, r1,r2,r3,r4,r5,r0, f0,f1,f2,f3,f4,f5)  \
415           fcpi(f, l, op, r2,r3,r4,r5,r0,r1, f0,f1,f2,f3,f4,f5)  \
416           fcpr(f, l, op, r2,r3,r4,r5,r0,r1, f0,f1,f2,f3,f4,f5)  \
417          fcprc(f, l, op, r2,r3,r4,r5,r0,r1, f0,f1,f2,f3,f4,f5)  \
418           fcpi(f, l, op, r3,r4,r5,r0,r1,r2, f0,f1,f2,f3,f4,f5)  \
419           fcpr(f, l, op, r3,r4,r5,r0,r1,r2, f0,f1,f2,f3,f4,f5)  \
420          fcprc(f, l, op, r3,r4,r5,r0,r1,r2, f0,f1,f2,f3,f4,f5)  \
421           fcpi(f, l, op, r4,r5,r0,r1,r2,r3, f0,f1,f2,f3,f4,f5)  \
422           fcpr(f, l, op, r4,r5,r0,r1,r2,r3, f0,f1,f2,f3,f4,f5)  \
423          fcprc(f, l, op, r4,r5,r0,r1,r2,r3, f0,f1,f2,f3,f4,f5)  \
424           fcpi(f, l, op, r5,r0,r1,r2,r3,r4, f0,f1,f2,f3,f4,f5)  \
425           fcpr(f, l, op, r5,r0,r1,r2,r3,r4, f0,f1,f2,f3,f4,f5)  \
426          fcprc(f, l, op, r5,r0,r1,r2,r3,r4, f0,f1,f2,f3,f4,f5)
427 #endif
428 #if __ia64__
429 #  define xfcp(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
430           ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
431 #else
432 #  define xfcp(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
433           ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
434           ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f1,f2,f3,f4,f5,f0)  \
435           ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f2,f3,f4,f5,f0,f1)  \
436           ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f3,f4,f5,f0,f1,f2)  \
437           ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f4,f5,f0,f1,f2,f3)  \
438           ifcp(f, l, op, r0,r1,r2,r3,r4,r5, f5,f0,f1,f2,f3,f4)
439 #endif
440 #if __ia64__
441 #  define fcmp(l, op)                                           \
442           xfcp(_f, l, op, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5)
443 #else
444 #  define fcmp(l, op)                                           \
445           xfcp(_f, l, op, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5)   \
446           xfcp(_d, l, op, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5)
447 #endif
448
449 #define imvi(l, i0, i1, i2, i3, i4, i5)                         \
450         setup()                                                 \
451         movi %IR##i0 1                                          \
452         check5(i, l, i1, i2, i3, i4, i5)
453 #define imvr(l, i0, i1, i2, i3, i4, i5)                         \
454         setup()                                                 \
455         movi %IR##i1 1                                          \
456         movr %IR##i0 %IR##i1                                    \
457         check4(r, l, i2, i3, i4, i5)
458 #define xmvi(l, i0, i1, i2, i3, i4, i5)                         \
459         imvi(l, i0,     i1, i2, i3, i4, i5)                     \
460         imvr(l, i0, i1, i2, i3, i4, i5)
461 #if __ia64__
462 #  define mvi(l)                                                \
463          xmvi(l, 0, 1, 2, 3, 4, 5)
464 #else
465 #  define mvi(l)                                                \
466          xmvi(l, 0, 1, 2, 3, 4, 5)                              \
467          xmvi(l, 1, 2, 3, 4, 5, 0)                              \
468          xmvi(l, 2, 3, 4, 5, 0, 1)                              \
469          xmvi(l, 3, 4, 5, 0, 1, 2)                              \
470          xmvi(l, 4, 5, 0, 1, 2, 3)                              \
471          xmvi(l, 5, 0, 1, 2, 3, 4)
472 #endif
473
474 #define fmvi(f, l, f0, f1, f2, f3, f4, f5)                      \
475         setup##f()                                              \
476         movi##f %FR##f0 1                                       \
477         checkf5(f, i, l, f1, f2, f3, f4, f5)
478 #define fmvr(f, l, f0, f1, f2, f3, f4, f5)                      \
479         setup##f()                                              \
480         movi##f %FR##f1 1                                       \
481         movr##f %FR##f0 %FR##f1                                 \
482         checkf4(f, r, l, f2, f3, f4, f5)
483 #define xmvf(f, l, f0, f1, f2, f3, f4, f5)                      \
484         fmvi(f, l, f0, f1, f2, f3, f4, f5)                      \
485         fmvr(f, l, f0, f1,      f2, f3, f4, f5)
486 #if __ia64__
487 #  define xxmvf(f, l)                                           \
488           xmvf(f, l, 0, 1, 2, 3, 4, 5)
489 #else
490 #  define xxmvf(f, l)                                           \
491            xmvf(f, l, 0, 1, 2, 3, 4, 5)                         \
492            xmvf(f, l, 1, 2, 3, 4, 5, 0)                         \
493            xmvf(f, l, 2, 3, 4, 5, 0, 1)                         \
494            xmvf(f, l, 3, 4, 5, 0, 1, 2)                         \
495            xmvf(f, l, 4, 5, 0, 1, 2, 3)                         \
496            xmvf(f, l, 5, 0, 1, 2, 3, 4)
497 #endif
498 #define   mvf(l)                                                \
499         xxmvf(_f, l)                                            \
500         xxmvf(_d, l)
501
502 #define f2fr(f, l, op, f0, f1, f2, f3, f4, f5)                  \
503         setup##f()                                              \
504         movi##f %FR##f0 1                                       \
505         op %FR##f1 %FR##f0                                      \
506         checkf4(f, rr, l, f2, f3, f4, f5)
507 #define f2frc(f, l, op, f0, f1, f2, f3, f4, f5)                 \
508         setup##f()                                              \
509         movi##f %FR##f0 1                                       \
510         op %FR##f0 %FR##f0                                      \
511         checkf5(f, rc, l, f1, f2, f3, f4, f5)
512 #define  xf2f(f, l, op, f0, f1, f2, f3, f4, f5)                 \
513          f2fr(f, l, op, f0, f1, f2, f3, f4, f5)                 \
514         f2frc(f, l, op, f0,             f1, f2, f3, f4, f5)
515 #if __ia64__
516 #  define f2f(l, f, op)                                         \
517          xf2f(f, l, op, 0, 1, 2, 3, 4, 5)
518 #else
519 #  define f2f(l, f, op)                                         \
520          xf2f(f, l, op, 0, 1, 2, 3, 4, 5)                       \
521          xf2f(f, l, op, 1, 2, 3, 4, 5, 0)                       \
522          xf2f(f, l, op, 2, 3, 4, 5, 0, 1)                       \
523          xf2f(f, l, op, 3, 4, 5, 0, 1, 2)                       \
524          xf2f(f, l, op, 4, 5, 0, 1, 2, 3)                       \
525          xf2f(f, l, op, 5, 0, 1, 2, 3, 4)
526 #endif
527
528 #define f2ir(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)    \
529         setup()                                                 \
530         setup##f()                                              \
531         movi##f %FR##f0 1                                       \
532         op##f %IR##r0 %FR##f0                                   \
533         check5(r##f##f0, l, r1, r2, r3, r4, r5)                 \
534         checkf5(f, i##r0, l, f1, f2, f3, f4, f5)
535 #if __ia64__
536 #  define if2i(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
537           f2ir(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
538 #  define xf2i(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
539           if2i(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
540 #else
541 #  define if2i(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
542           f2ir(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
543           f2ir(f, l, op, r1,r2,r3,r4,r5,r0, f0,f1,f2,f3,f4,f5)  \
544           f2ir(f, l, op, r2,r3,r4,r5,r0,r1, f0,f1,f2,f3,f4,f5)  \
545           f2ir(f, l, op, r3,r4,r5,r0,r1,r2, f0,f1,f2,f3,f4,f5)  \
546           f2ir(f, l, op, r4,r5,r0,r1,r2,r3, f0,f1,f2,f3,f4,f5)  \
547           f2ir(f, l, op, r5,r0,r1,r2,r3,r4, f0,f1,f2,f3,f4,f5)
548 #  define xf2i(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
549           if2i(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
550           if2i(f, l, op, r0,r1,r2,r3,r4,r5, f1,f2,f3,f4,f5,f0)  \
551           if2i(f, l, op, r0,r1,r2,r3,r4,r5, f2,f3,f4,f5,f0,f1)  \
552           if2i(f, l, op, r0,r1,r2,r3,r4,r5, f3,f4,f5,f0,f1,f2)  \
553           if2i(f, l, op, r0,r1,r2,r3,r4,r5, f4,f5,f0,f1,f2,f3)  \
554           if2i(f, l, op, r0,r1,r2,r3,r4,r5, f5,f0,f1,f2,f3,f4)
555 #endif
556 #define f2i(l, op)                                              \
557         xf2i(_f, l, op, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5)     \
558         xf2i(_d, l, op, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5)
559
560 #define i2fr(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)    \
561         setup()                                                 \
562         setup##f()                                              \
563         movi %IR##r0 1                                          \
564         op##f %FR##f0 %IR##r0                                   \
565         check5(r##f##f0, l, r1, r2, r3, r4, r5)                 \
566         checkf5(f, i##r0, l, f1, f2, f3, f4, f5)
567 #if __ia64__
568 #  define ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
569           i2fr(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
570 #  define xi2f(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
571           ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
572 #else
573 #  define ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
574           i2fr(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
575           i2fr(f, l, op, r1,r2,r3,r4,r5,r0, f0,f1,f2,f3,f4,f5)  \
576           i2fr(f, l, op, r2,r3,r4,r5,r0,r1, f0,f1,f2,f3,f4,f5)  \
577           i2fr(f, l, op, r3,r4,r5,r0,r1,r2, f0,f1,f2,f3,f4,f5)  \
578           i2fr(f, l, op, r4,r5,r0,r1,r2,r3, f0,f1,f2,f3,f4,f5)  \
579           i2fr(f, l, op, r5,r0,r1,r2,r3,r4, f0,f1,f2,f3,f4,f5)
580 #  define xi2f(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
581           ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)  \
582           ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f1,f2,f3,f4,f5,f0)  \
583           ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f2,f3,f4,f5,f0,f1)  \
584           ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f3,f4,f5,f0,f1,f2)  \
585           ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f4,f5,f0,f1,f2,f3)  \
586           ii2f(f, l, op, r0,r1,r2,r3,r4,r5, f5,f0,f1,f2,f3,f4)
587 #endif
588 #define i2f(l, op)                                              \
589         xi2f(_f, l, op, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5)     \
590         xi2f(_d, l, op, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5)
591
592 #define off_c           1
593 #define off_uc          off_c
594 #define off_s           2
595 #define off_us          off_s
596 #define off_i           4
597 #define off_ui          off_i
598 #define off_l           8
599 #define off_f           4
600 #define off_d           8
601
602 #define ildi(i, l, r0, r1, r2, r3, r4, r5)                      \
603         setup()                                                 \
604         ldi##i %IR##r0 buff                                     \
605         check5(ldi##i, l, r1, r2, r3, r4, r5)
606 #define ildr(i, l, r0, r1, r2, r3, r4, r5)                      \
607         setup()                                                 \
608         movi %IR##r1 buff                                       \
609         ldr##i %IR##r0 %IR##r1                                  \
610         check4(ldr##i, l, r2, r3, r4, r5)
611 #define ildr0(i, l, r0, r1, r2, r3, r4, r5)                     \
612         setup()                                                 \
613         movi %IR##r0 buff                                       \
614         ldr##i %IR##r0 %IR##r0                                  \
615         check5(ldr##i, l, r1, r2, r3, r4, r5)
616 #define ildxi(i, l, r0, r1, r2, r3, r4, r5)                     \
617         setup()                                                 \
618         movi %IR##r1 buff                                       \
619         ldxi##i %IR##r0 %IR##r1 off##i                          \
620         check4(ldxi##i, l, r2, r3, r4, r5)
621 #define ildxr(i, l, r0, r1, r2, r3, r4, r5)                     \
622         setup()                                                 \
623         movi %IR##r1 buff                                       \
624         movi %IR##r2 off##i                                     \
625         ldxr##i %IR##r0 %IR##r1 %IR##r2                         \
626         check3(ldxr##i, l, r3, r4, r5)
627 #define ildxr0(i, l, r0, r1, r2, r3, r4, r5)                    \
628         setup()                                                 \
629         movi %IR##r1 buff                                       \
630         movi %IR##r0 off##i                                     \
631         ldxr##i %IR##r0 %IR##r1 %IR##r0                         \
632         check4(ldxr0##i, l, r2, r3, r4, r5)
633 #define ildxr1(i, l, r0, r1, r2, r3, r4, r5)                    \
634         setup()                                                 \
635         movi %IR##r0 buff                                       \
636         movi %IR##r1 off##i                                     \
637         ldxr##i %IR##r0 %IR##r0 %IR##r1                         \
638         check4(ldxr1##i, l, r2, r3, r4, r5)
639 #define  xxldi(i, l, r0, r1, r2, r3, r4, r5)                    \
640           ildi(i, l, r0, r1, r2, r3, r4, r5)                    \
641           ildr(i, l, r0, r1, r2, r3, r4, r5)                    \
642          ildr0(i, l, r0, r1, r2, r3, r4, r5)                    \
643          ildxi(i, l, r0, r1, r2, r3, r4, r5)                    \
644          ildxr(i, l, r0, r1, r2, r3, r4, r5)                    \
645         ildxr0(i, l, r0, r1, r2, r3, r4, r5)                    \
646         ildxr1(i, l, r0, r1, r2, r3, r4, r5)
647 #if __WORDSIZE == 32
648 #define xxxldi(l, r0, r1, r2, r3, r4, r5)
649 #else
650 #define xxxldi(l, r0, r1, r2, r3, r4, r5)                       \
651          xxldi(_ui, l, r0, r1, r2, r3, r4, r5)                  \
652          xxldi( _l, l, r0, r1, r2, r3, r4, r5)
653 #endif
654 #define   xldi(l, r0, r1, r2, r3, r4, r5)                       \
655          xxldi( _c, l, r0, r1, r2, r3, r4, r5)                  \
656          xxldi(_uc, l, r0, r1, r2, r3, r4, r5)                  \
657          xxldi( _s, l, r0, r1, r2, r3, r4, r5)                  \
658          xxldi(_us, l, r0, r1, r2, r3, r4, r5)                  \
659          xxldi( _i, l, r0, r1, r2, r3, r4, r5)                  \
660         xxxldi(l, r0, r1, r2, r3, r4, r5)
661 #if __ia64__
662 #  define ldi(l)                                                \
663          xldi(l, 0, 1, 2, 3, 4, 5)
664 #else
665 #  define ldi(l)                                                \
666          xldi(l, 0, 1, 2, 3, 4, 5)                              \
667          xldi(l, 1, 2, 3, 4, 5, 0)                              \
668          xldi(l, 2, 3, 4, 5, 0, 1)                              \
669          xldi(l, 3, 4, 5, 0, 1, 2)                              \
670          xldi(l, 4, 5, 0, 1, 2, 3)                              \
671          xldi(l, 5, 0, 1, 2, 3, 4)
672 #endif
673
674 #define fldi(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
675         setup()                                                 \
676         setup##f()                                              \
677         ldi##f %FR##f0 buff                                     \
678         check6(ldi##f##r0##f0, l, r0, r1, r2, r3, r4, r5)       \
679         checkf5(f, ldi##r0##f0, l, f1, f2, f3, f4, f5)
680 #define fldr(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
681         setup()                                                 \
682         setup##f()                                              \
683         movi %IR##r0 buff                                       \
684         ldr##f %FR##f0 %IR##r0                                  \
685         check5(ldr##f##r0##f0, l, r1, r2, r3, r4, r5)           \
686         checkf5(f, ldr##r0##f0, l, f1, f2, f3, f4, f5)
687 #define fldxi(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)       \
688         setup()                                                 \
689         setup##f()                                              \
690         movi %IR##r0 buff                                       \
691         ldxi##f %FR##f0 %IR##r0 off##f                          \
692         check5(ldxi##f##r0##f0, l, r1, r2, r3, r4, r5)          \
693         checkf5(f, ldxi##r0##f0, l, f1, f2, f3, f4, f5)
694 #define fldxr(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)       \
695         setup()                                                 \
696         setup##f()                                              \
697         movi %IR##r0 buff                                       \
698         movi %IR##r1 off##f                                     \
699         ldxr##f %FR##f0 %IR##r0 %IR##r1                         \
700         check4(ldxr##f##r0##f0, l, r2, r3, r4, r5)              \
701         checkf5(f, ldxr##r0##f0, l, f1, f2, f3, f4, f5)
702 #define   xldf(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)      \
703         fldi(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
704         fldr(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
705         fldxi(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)       \
706         fldxr(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
707 #define  xxldf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)         \
708           xldf(_f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)     \
709           xldf(_d, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
710 #if __ia64__
711 #  define ixldf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
712           xxldf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
713 #else
714 #  define fxldf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
715           xxldf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
716           xxldf(l, r0,r1,r2,r3,r4,r5, f1,f2,f3,f4,f5,f0)        \
717           xxldf(l, r0,r1,r2,r3,r4,r5, f2,f3,f4,f5,f0,f1)        \
718           xxldf(l, r0,r1,r2,r3,r4,r5, f3,f4,f5,f0,f1,f2)        \
719           xxldf(l, r0,r1,r2,r3,r4,r5, f4,f5,f0,f1,f2,f3)        \
720           xxldf(l, r0,r1,r2,r3,r4,r5, f5,f0,f1,f2,f3,f4)
721 #  define ixldf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
722           fxldf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
723           fxldf(l, r1,r2,r3,r4,r5,r0, f0,f1,f2,f3,f4,f5)        \
724           fxldf(l, r2,r3,r4,r5,r0,r1, f0,f1,f2,f3,f4,f5)        \
725           fxldf(l, r3,r4,r5,r0,r1,r2, f0,f1,f2,f3,f4,f5)        \
726           fxldf(l, r4,r5,r0,r1,r2,r3, f0,f1,f2,f3,f4,f5)        \
727           fxldf(l, r5,r0,r1,r2,r3,r4, f0,f1,f2,f3,f4,f5)
728 #endif
729 #define   ldf(l)                                                \
730         ixldf(l, 0,1,2,3,4,5, 0,1,2,3,4,5)
731
732 #define isti(i, l, r0, r1, r2, r3, r4, r5)                      \
733         setup()                                                 \
734         sti##i buff %IR##r0                                     \
735         check5(sti##i, l, r1, r2, r3, r4, r5)
736 #define istr(i, l, r0, r1, r2, r3, r4, r5)                      \
737         setup()                                                 \
738         movi %IR##r1 buff                                       \
739         str##i %IR##r1 %IR##r0                                  \
740         check4(str##i, l, r2, r3, r4, r5)
741 #define istr0(i, l, r0, r1, r2, r3, r4, r5)                     \
742         setup()                                                 \
743         movi %IR##r1 buff                                       \
744         str##i %IR##r1 %IR##r0                                  \
745         check4(str0##i, l, r2, r3, r4, r5)
746 #define istxi(i, l, r0, r1, r2, r3, r4, r5)                     \
747         setup()                                                 \
748         movi %IR##r1 buff                                       \
749         stxi##i off##i %IR##r1 %IR##r0                          \
750         check4(stxi##i, l, r2, r3, r4, r5)
751 #define istxr(i, l, r0, r1, r2, r3, r4, r5)                     \
752         setup()                                                 \
753         movi %IR##r1 buff                                       \
754         movi %IR##r2 off##i                                     \
755         stxr##i %IR##r2 %IR##r1 %IR##r0                         \
756         check3(stxr##i, l, r3, r4, r5)
757 #define istxr0(i, l, r0, r1, r2, r3, r4, r5)                    \
758         setup()                                                 \
759         movi %IR##r1 buff                                       \
760         movi %IR##r0 off##i                                     \
761         stxr##i %IR##r0 %IR##r1 %IR##r0                         \
762         check4(stxr0##i, l, r2, r3, r4, r5)
763 #define istxr1(i, l, r0, r1, r2, r3, r4, r5)                    \
764         setup()                                                 \
765         movi %IR##r0 buff                                       \
766         movi %IR##r1 off##i                                     \
767         stxr##i %IR##r1 %IR##r0 %IR##r0                         \
768         check4(stxr1##i, l, r2, r3, r4, r5)
769 #define  xxsti(i, l, r0, r1, r2, r3, r4, r5)                    \
770           isti(i, l, r0, r1, r2, r3, r4, r5)                    \
771           istr(i, l, r0, r1, r2, r3, r4, r5)                    \
772          istr0(i, l, r0, r1, r2, r3, r4, r5)                    \
773          istxi(i, l, r0, r1, r2, r3, r4, r5)                    \
774          istxr(i, l, r0, r1, r2, r3, r4, r5)                    \
775         istxr0(i, l, r0, r1, r2, r3, r4, r5)                    \
776         istxr1(i, l, r0, r1, r2, r3, r4, r5)
777 #if __WORDSIZE == 32
778 #define xxxsti(l, r0, r1, r2, r3, r4, r5)
779 #else
780 #define xxxsti(l, r0, r1, r2, r3, r4, r5)                       \
781          xxsti( _l, l, r0, r1, r2, r3, r4, r5)
782 #endif
783 #define   xsti(l, r0, r1, r2, r3, r4, r5)                       \
784          xxsti( _c, l, r0, r1, r2, r3, r4, r5)                  \
785          xxsti( _s, l, r0, r1, r2, r3, r4, r5)                  \
786          xxsti( _i, l, r0, r1, r2, r3, r4, r5)                  \
787         xxxsti(l, r0, r1, r2, r3, r4, r5)
788 #if __ia64__
789 #  define sti(l)                                                \
790          xsti(l, 0, 1, 2, 3, 4, 5)
791 #else
792 #  define sti(l)                                                \
793          xsti(l, 0, 1, 2, 3, 4, 5)                              \
794          xsti(l, 1, 2, 3, 4, 5, 0)                              \
795          xsti(l, 2, 3, 4, 5, 0, 1)                              \
796          xsti(l, 3, 4, 5, 0, 1, 2)                              \
797          xsti(l, 4, 5, 0, 1, 2, 3)                              \
798          xsti(l, 5, 0, 1, 2, 3, 4)
799 #endif
800
801 #define fsti(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
802         setup()                                                 \
803         setup##f()                                              \
804         sti##f buff %FR##f0                                     \
805         check6(sti##f##r0##f0, l, r0, r1, r2, r3, r4, r5)       \
806         checkf5(f, sti##r0##f0, l, f1, f2, f3, f4, f5)
807 #define fstr(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
808         setup()                                                 \
809         setup##f()                                              \
810         movi %IR##r0 buff                                       \
811         str##f %IR##r0 %FR##f0                                  \
812         check5(str##f##r0##f0, l, r1, r2, r3, r4, r5)           \
813         checkf5(f, str##r0##f0, l, f1, f2, f3, f4, f5)
814 #define fstxi(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)       \
815         setup()                                                 \
816         setup##f()                                              \
817         movi %IR##r0 buff                                       \
818         stxi##f off##f %IR##r0 %FR##f0                          \
819         check5(stxi##f##r0##f0, l, r1, r2, r3, r4, r5)          \
820         checkf5(f, stxi##r0##f0, l, f1, f2, f3, f4, f5)
821 #define fstxr(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)       \
822         setup()                                                 \
823         setup##f()                                              \
824         movi %IR##r0 buff                                       \
825         movi %IR##r1 off##f                                     \
826         stxr##f %IR##r1 %IR##r0 %FR##f0                         \
827         check4(stxr##f##r0##f0, l, r2, r3, r4, r5)              \
828         checkf5(f, stxr##r0##f0, l, f1, f2, f3, f4, f5)
829 #define   xstf(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)      \
830         fsti(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
831         fstr(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
832         fstxi(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)       \
833         fstxr(f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
834 #define  xxstf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)         \
835           xstf(_f, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)     \
836           xstf(_d, l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
837 #if __ia64__
838 #  define ixstf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
839           xxstf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)
840 #else
841 #  define fxstf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
842           xxstf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
843           xxstf(l, r0,r1,r2,r3,r4,r5, f1,f2,f3,f4,f5,f0)        \
844           xxstf(l, r0,r1,r2,r3,r4,r5, f2,f3,f4,f5,f0,f1)        \
845           xxstf(l, r0,r1,r2,r3,r4,r5, f3,f4,f5,f0,f1,f2)        \
846           xxstf(l, r0,r1,r2,r3,r4,r5, f4,f5,f0,f1,f2,f3)        \
847           xxstf(l, r0,r1,r2,r3,r4,r5, f5,f0,f1,f2,f3,f4)
848 # define ixstf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)         \
849           fxstf(l, r0,r1,r2,r3,r4,r5, f0,f1,f2,f3,f4,f5)        \
850           fxstf(l, r1,r2,r3,r4,r5,r0, f0,f1,f2,f3,f4,f5)        \
851           fxstf(l, r2,r3,r4,r5,r0,r1, f0,f1,f2,f3,f4,f5)        \
852           fxstf(l, r3,r4,r5,r0,r1,r2, f0,f1,f2,f3,f4,f5)        \
853           fxstf(l, r4,r5,r0,r1,r2,r3, f0,f1,f2,f3,f4,f5)        \
854           fxstf(l, r5,r0,r1,r2,r3,r4, f0,f1,f2,f3,f4,f5)
855 #endif
856 #define   stf(l)                                                \
857         ixstf(l, 0,1,2,3,4,5, 0,1,2,3,4,5)
858
859 /* Need a valid jump or simple optimization will remove it */
860 #define bri(l, op, u, il, ir, r0, r1, r2, r3, r4, r5)           \
861         setup()                                                 \
862         movi %IR##r0 il                                         \
863         b##op##i##u i##l##op##r0 %IR##r0 ir                     \
864         calli @abort                                            \
865 i##l##op##r0:                                                   \
866         check5(i, l, r1, r2, r3, r4, r5)
867 #define brr(l, op, u, il, ir, r0, r1, r2, r3, r4, r5)           \
868         setup()                                                 \
869         movi %IR##r0 il                                         \
870         movi %IR##r1 ir                                         \
871         b##op##r##u r##l##op##r0 %IR##r0 %IR##r1                \
872         calli @abort                                            \
873 r##l##op##r0:                                                   \
874         check4(r, l, r2, r3, r4, r5)
875 #define  xjmpi(l, op, u, il, ir, r0, r1, r2, r3, r4, r5)        \
876            bri(l, op, u, il, ir, r0, r1, r2, r3, r4, r5)        \
877            brr(l, op, u, il, ir, r0, r1, r2, r3, r4, r5)
878 #if __ia64__
879 #  define jmpi(l, op, u, il, ir)                                \
880          xjmpi(l, op, u, il, ir, 0, 1, 2, 3, 4, 5)
881 #else
882 #  define jmpi(l, op, u, il, ir)                                \
883          xjmpi(l, op, u, il, ir, 0, 1, 2, 3, 4, 5)              \
884          xjmpi(l, op, u, il, ir, 1, 2, 3, 4, 5, 0)              \
885          xjmpi(l, op, u, il, ir, 2, 3, 4, 5, 0, 1)              \
886          xjmpi(l, op, u, il, ir, 3, 4, 5, 0, 1, 2)              \
887          xjmpi(l, op, u, il, ir, 4, 5, 0, 1, 2, 3)              \
888          xjmpi(l, op, u, il, ir, 5, 0, 1, 2, 3, 4)
889 #endif
890
891 #define bfi(f, l, op, il, ir, f0, f1, f2, f3, f4, f5)           \
892         setup##f()                                              \
893         movi##f %FR##f0 il                                      \
894         b##op##i##f i##l##op##f##f0 %FR##f0 ir                  \
895         calli @abort                                            \
896 i##l##op##f##f0:                                                \
897         checkf5(f, i, l, f1, f2, f3, f4, f5)
898 #define bff(f, l, op, il, ir, f0, f1, f2, f3, f4, f5)           \
899         setup##f()                                              \
900         movi##f %FR##f0 il                                      \
901         movi##f %FR##f1 ir                                      \
902         b##op##r##f r##l##op##f##f0 %FR##f0 %FR##f1             \
903         calli @abort                                            \
904 r##l##op##f##f0:                                                \
905         checkf4(f, r, l, f2, f3, f4, f5)
906 #define  xjmpf(f, l, op, il, ir, f0, f1, f2, f3, f4, f5)        \
907            bfi(f, l, op, il, ir, f0, f1, f2, f3, f4, f5)        \
908            bff(f, l, op, il, ir, f0, f1, f2, f3, f4, f5)
909 #define xxjmpf(l, op, il, ir, f0, f1, f2, f3, f4, f5)           \
910          xjmpf(_f, l, op, il, ir, f0, f1, f2, f3, f4, f5)       \
911          xjmpf(_d, l, op, il, ir, f0, f1, f2, f3, f4, f5)
912 #if __ia64__
913 #  define jmpf(l, op, il, ir)                                   \
914         xxjmpf(l, op, il, ir, 0, 1, 2, 3, 4, 5)
915 #else
916 #  define jmpf(l, op, il, ir)                                   \
917         xxjmpf(l, op, il, ir, 0, 1, 2, 3, 4, 5)                 \
918         xxjmpf(l, op, il, ir, 1, 2, 3, 4, 5, 0)                 \
919         xxjmpf(l, op, il, ir, 2, 3, 4, 5, 0, 1)                 \
920         xxjmpf(l, op, il, ir, 3, 4, 5, 0, 1, 2)                 \
921         xxjmpf(l, op, il, ir, 4, 5, 0, 1, 2, 3)                 \
922         xxjmpf(l, op, il, ir, 5, 0, 1, 2, 3, 4)
923 #endif
924
925 .data   32
926 buff:
927 .size   16
928 ok:
929 .c      "ok\n"
930
931 .code
932         prolog
933
934           alu(__LINE__, add)
935          alux(__LINE__, add)
936           fop(__LINE__, add)
937           alu(__LINE__, sub)
938          alux(__LINE__, sub)
939           fop(__LINE__, sub)
940           alu(__LINE__, mul)
941           fop(__LINE__, mul)
942           alu(__LINE__, div)
943         alu_u(__LINE__, div)
944           fop(__LINE__, div)
945           alu(__LINE__, rem)
946         alu_u(__LINE__, rem)
947           alu(__LINE__, and)
948           alu(__LINE__, or)
949           alu(__LINE__, xor)
950           alu(__LINE__, lsh)
951           alu(__LINE__, rsh)
952         alu_u(__LINE__, rsh)
953           uni(__LINE__, negr)
954           unf(__LINE__, negr)
955           uni(__LINE__, comr)
956           unf(__LINE__, absr)
957           unf(__LINE__, sqrtr)
958           alu(__LINE__, lt)
959         alu_u(__LINE__, lt)
960          fcmp(__LINE__, lt)
961           alu(__LINE__, le)
962         alu_u(__LINE__, le)
963          fcmp(__LINE__, le)
964           alu(__LINE__, eq)
965          fcmp(__LINE__, eq)
966           alu(__LINE__, ge)
967         alu_u(__LINE__, ge)
968          fcmp(__LINE__, ge)
969           alu(__LINE__, gt)
970         alu_u(__LINE__, gt)
971          fcmp(__LINE__, gt)
972           alu(__LINE__, ne)
973          fcmp(__LINE__, ne)
974          fcmp(__LINE__, unlt)
975          fcmp(__LINE__, unle)
976          fcmp(__LINE__, uneq)
977          fcmp(__LINE__, unge)
978          fcmp(__LINE__, ungt)
979          fcmp(__LINE__, ltgt)
980          fcmp(__LINE__, ord)
981          fcmp(__LINE__, unord)
982           mvi(__LINE__)
983           mvf(__LINE__)
984           uni(__LINE__, extr_c)
985           uni(__LINE__, extr_uc)
986           uni(__LINE__, extr_s)
987           uni(__LINE__, extr_us)
988 #if __WORDSIZE == 64
989           uni(__LINE__, extr_ui)
990 #endif
991           uni(__LINE__, htonr)
992           f2f(__LINE__, _f, extr_d_f)
993           f2f(__LINE__, _d, extr_f_d)
994           f2i(__LINE__, truncr)
995           i2f(__LINE__, extr)
996           ldi(__LINE__)
997           ldf(__LINE__)
998           sti(__LINE__)
999           stf(__LINE__)
1000          jmpi(__LINE__, lt,   ,  0,  1)
1001          jmpi(__LINE__, lt, _u,  0,  1)
1002          jmpf(__LINE__, lt,      0,  1)
1003          jmpi(__LINE__, le,   ,  1,  1)
1004          jmpi(__LINE__, le, _u,  1,  1)
1005          jmpf(__LINE__, le,      1,  1)
1006          jmpi(__LINE__, eq,   , -1, -1)
1007          jmpf(__LINE__, eq,     -1, -1)
1008          jmpi(__LINE__, ge,   ,  2,  2)
1009          jmpi(__LINE__, ge, _u,  2,  2)
1010          jmpf(__LINE__, ge,      2,  2)
1011          jmpi(__LINE__, gt,   ,  2,  1)
1012          jmpi(__LINE__, gt, _u,  2,  1)
1013          jmpf(__LINE__, gt,      2,  1)
1014          jmpi(__LINE__, ne,   ,  3,  2)
1015          jmpf(__LINE__, ne,      3,  2)
1016          jmpi(__LINE__, ms, , 1, 1)
1017          jmpi(__LINE__, mc, , 1, 2)
1018 #if __WORDSIZE == 32
1019 #  define ix7f          0x7fffffff
1020 #  define ix80          0x80000000
1021 #  define ixff          0xffffffff
1022 #else
1023 #  define ix7f          0x7fffffffffffffff
1024 #  define ix80          0x8000000000000000
1025 #  define ixff          0xffffffffffffffff
1026 #endif
1027          jmpi(__LINE__, oadd,   , ix7f, 1)
1028          jmpi(__LINE__, oadd, _u, ixff, 1)
1029          jmpi(__LINE__, xadd,   , ix80, 1)
1030          jmpi(__LINE__, xadd, _u, ix7f, 1)
1031          jmpi(__LINE__, osub,   , ix80, 1)
1032          jmpi(__LINE__, osub, _u,    0, 1)
1033          jmpi(__LINE__, xsub,   , ix7f, 1)
1034          jmpi(__LINE__, xsub, _u, ix80, 1)
1035          jmpf(__LINE__, unlt,        0, 1)
1036          jmpf(__LINE__, unle,        1, 1)
1037          jmpf(__LINE__, uneq,        2, 2)
1038          jmpf(__LINE__, unge,        3, 3)
1039          jmpf(__LINE__, ungt,        4, 3)
1040          jmpf(__LINE__, ltgt,        5, 4)
1041          jmpf(__LINE__, ord,         0, 0)
1042          jmpf(__LINE__, unord,       0, $(0.0 / 0.0))
1043
1044         prepare
1045                 pushargi ok
1046                 ellipsis
1047         finishi @printf
1048
1049         ret
1050         epilog