Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20060318153043

Diff

Diff from 1.72 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/pcc/pcc/arch/i386/table.c

Annotated File View

ragge
1.72
1 /*      $Id: table.c,v 1.72 2006/03/18 15:30:45 ragge Exp $     */
ragge
1.1
2 /*
3  * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29
30 # include "pass2.h"
31
32 # define TLL TLONGLONG|TULONGLONG
33 # define ANYSIGNED TINT|TLONG|TSHORT|TCHAR
34 # define ANYUSIGNED TUNSIGNED|TULONG|TUSHORT|TUCHAR
35 # define ANYFIXED ANYSIGNED|ANYUSIGNED
36 # define TUWORD TUNSIGNED|TULONG
37 # define TSWORD TINT|TLONG
38 # define TWORD TUWORD|TSWORD
ragge
1.50
39 #define  SHINT  SAREG   /* short and int */
40 #define  ININT  INAREG
41 #define  SHCH   SBREG   /* shape for char */
42 #define  INCH   INBREG
43 #define  SHLL   SCREG   /* shape for long long */
44 #define  INLL   INCREG
45 #define  SHFL   SDREG   /* shape for float/double */
46 #define  INFL   INDREG  /* shape for float/double */
ragge
1.1
47
48 struct optab table[] = {
ragge
1.12
49 /* First entry must be an empty entry */
50 { -1FOREFFSANYTANYSANYTANY00"", },
ragge
1.1
51
52 /*
53  * A bunch conversions of integral<->integral types
ragge
1.59
54  * There are lots of them, first in table conversions to itself
55  * and then conversions from each type to the others.
ragge
1.1
56  */
57
ragge
1.59
58 /* itself to itself, including pointers */
59
ragge
1.55
60 /* convert (u)char to (u)char. */
61 SCONV,        INCH,
62         SHCH,   TCHAR|TUCHAR,
63         SHCH,   TCHAR|TUCHAR,
64                 0,      RLEFT,
65                 "", },
66
ragge
1.6
67 /* convert pointers to int. */
ragge
1.50
68 SCONV,        ININT,
69         SHINT,  TPOINT|TWORD,
ragge
1.1
70         SANY,   TWORD,
71                 0,      RLEFT,
72                 "", },
73
ragge
1.29
74 /* convert (u)longlong to (u)longlong. */
ragge
1.50
75 SCONV,        INLL,
76         SHLL,   TLL,
77         SHLL,   TLL,
ragge
1.29
78                 0,      RLEFT,
79                 "", },
80
ragge
1.59
81 /* convert double <-> float. nothing to do here */
82 SCONV,        INFL,
83         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
84         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
ragge
1.27
85                 0,      RLEFT,
86                 "", },
87
ragge
1.72
88 /* convert pointers to pointers. */
89 SCONV,        ININT,
90         SHINT,  TPOINT,
91         SANY,   TPOINT,
92                 0,      RLEFT,
93                 "", },
94
ragge
1.59
95 /* char to something */
ragge
1.15
96
ragge
1.65
97 /* convert char to (unsigned) short. */
ragge
1.50
98 SCONV,        ININT,
ragge
1.65
99         SBREG|SOREG|SNAME,      TCHAR,
100         SAREG,  TSHORT|TUSHORT,
ragge
1.29
101                 NASL|NAREG,     RESC1,
ragge
1.65
102                 "       movsbw AL,A1\n", },
ragge
1.29
103
ragge
1.59
104 /* convert unsigned char to (u)short. */
105 SCONV,        ININT,
106         SHCH|SOREG|SNAME,       TUCHAR,
107         SAREG,  TSHORT|TUSHORT,
108                 NASL|NAREG,     RESC1,
ragge
1.65
109                 "       movzbw AL,A1\n", },
ragge
1.59
110
111 /* convert signed char to int (or pointer). */
112 SCONV,        ININT,
113         SHCH|SOREG|SNAME,       TCHAR,
114         SAREG,  TWORD|TPOINT,
115                 NASL|NAREG,     RESC1,
116                 "       movsbl AL,A1\n", },
117
ragge
1.15
118 /* convert unsigned char to (u)int. */
ragge
1.50
119 SCONV,        ININT,
ragge
1.62
120         SHCH|SOREG|SNAME,       TUCHAR,
ragge
1.49
121         SAREG,  TWORD,
ragge
1.15
122                 NASL|NAREG,     RESC1,
ragge
1.62
123                 "       movzbl AL,A1\n", },
ragge
1.15
124
ragge
1.59
125 /* convert char to (u)long long */
126 SCONV,        INLL,
127         SHCH|SOREG|SNAME,       TCHAR,
128         SANY,   TLL,
129                 NSPECIAL|NAREG|NASL,    RESC1,
ragge
1.65
130                 "       movsbl AL,%eax\n        cltd\n", },
ragge
1.59
131
132 /* convert unsigned char to (u)long long */
133 SCONV,        INLL,
134         SHCH|SOREG|SNAME,       TUCHAR,
135         SANY,                   TLL,
ragge
1.68
136                 NCREG|NCSL,     RESC1,
137                 "       movzbl AL,A1\n  xorl U1,U1\n", },
ragge
1.59
138
139 /* convert char (in register) to double XXX - use NTEMP */
ragge
1.64
140 SCONV,        INFL,
141         SHCH|SOREG|SNAME,       TCHAR,
142         SHFL,                   TLDOUBLE|TDOUBLE|TFLOAT,
ragge
1.65
143                 NAREG|NASL|NDREG,       RESC2,
144                 "       movsbl AL,A1\n  pushl A1\n"
ragge
1.59
145                 "       fildl (%esp)\n  addl $4,%esp\n", },
146
147 /* convert (u)char (in register) to double XXX - use NTEMP */
ragge
1.64
148 SCONV,        INFL,
149         SHCH|SOREG|SNAME,       TUCHAR,
150         SHFL,                   TLDOUBLE|TDOUBLE|TFLOAT,
ragge
1.65
151                 NAREG|NASL|NDREG,       RESC2,
152                 "       movzbl AL,A1\n  pushl A1\n"
ragge
1.59
153                 "       fildl (%esp)\n  addl $4,%esp\n", },
154
155 /* short to something */
156
ragge
1.65
157 /* convert short (in memory) to char */
158 SCONV,        INCH,
159         SNAME|SOREG,    TSHORT|TUSHORT,
160         SHCH,           TCHAR|TUCHAR,
161                 NBREG|NBSL,     RESC1,
162                 "       movb AL,A1\n", },
163
164 /* convert short (in reg) to char. */
ragge
1.59
165 SCONV,        INCH,
ragge
1.65
166         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
167         SHCH,                   TCHAR|TUCHAR,
168                 NSPECIAL|NBREG|NBSL,    RESC1,
169                 "ZM", },
ragge
1.59
170
ragge
1.16
171 /* convert short to (u)int. */
ragge
1.50
172 SCONV,        ININT,
ragge
1.49
173         SAREG|SOREG|SNAME,      TSHORT,
174         SAREG,  TWORD,
ragge
1.16
175                 NASL|NAREG,     RESC1,
ragge
1.62
176                 "       movswl AL,A1\n", },
ragge
1.16
177
ragge
1.26
178 /* convert unsigned short to (u)int. */
ragge
1.50
179 SCONV,        ININT,
ragge
1.49
180         SAREG|SOREG|SNAME,      TUSHORT,
181         SAREG,  TWORD,
ragge
1.16
182                 NASL|NAREG,     RESC1,
ragge
1.62
183                 "       movzwl AL,A1\n", },
ragge
1.16
184
ragge
1.59
185 /* convert short to (u)long long */
186 SCONV,        INLL,
187         SAREG|SOREG|SNAME,      TSHORT,
ragge
1.65
188         SHLL,                   TLL,
189                 NSPECIAL|NCREG|NCSL,    RESC1,
190                 "       movswl AL,%eax\n        cltd\n", },
ragge
1.26
191
192 /* convert unsigned short to (u)long long */
ragge
1.50
193 SCONV,        INLL,
ragge
1.49
194         SAREG|SOREG|SNAME,      TUSHORT,
ragge
1.65
195         SHLL,                   TLL,
196                 NCREG|NCSL,     RESC1,
197                 "       movzwl AL,A1\n  xorl U1,U1\n", },
ragge
1.26
198
ragge
1.59
199 /* convert short (in memory) to float/double */
ragge
1.64
200 SCONV,        INFL,
ragge
1.59
201         SOREG|SNAME,    TSHORT,
ragge
1.64
202         SDREG,  TLDOUBLE|TDOUBLE|TFLOAT,
203                 NDREG,  RESC1,
ragge
1.59
204                 "       fild AL\n", },
205
206 /* convert short (in register) to float/double */
ragge
1.64
207 SCONV,        INFL,
ragge
1.59
208         SAREG,  TSHORT,
ragge
1.64
209         SDREG,  TLDOUBLE|TDOUBLE|TFLOAT,
210                 NTEMP|NDREG,    RESC1,
ragge
1.68
211                 "       pushw AL\n      fild (%esp)\n   addl $2,%esp\n", },
ragge
1.59
212
213 /* convert unsigned short to double XXX - use NTEMP */
ragge
1.64
214 SCONV,        INFL,
ragge
1.59
215         SAREG|SOREG|SNAME,      TUSHORT,
ragge
1.64
216         SHFL,                   TLDOUBLE|TDOUBLE|TFLOAT,
ragge
1.68
217                 NAREG|NASL|NDREG|NTEMPRESC2,
218                 "       movzwl AL,A1\n  pushl A1\n"
ragge
1.59
219                 "       fildl (%esp)\n  addl $4,%esp\n", },
ragge
1.27
220
ragge
1.59
221 /* int to something */
ragge
1.27
222
ragge
1.59
223 /* convert int to char. This is done when register is loaded */
224 SCONV,        INCH,
225         SAREG,  TWORD,
226         SANY,   TCHAR|TUCHAR,
ragge
1.61
227                 NSPECIAL|NBREG|NBSL,    RESC1,
ragge
1.59
228                 "ZM", },
ragge
1.29
229
ragge
1.61
230 /* convert int to short. Nothing to do */
231 SCONV,        INAREG,
232         SAREG,  TWORD,
233         SANY,   TSHORT|TUSHORT,
234                 0,      RLEFT,
235                 "", },
236
ragge
1.18
237 /* convert int to long long */
ragge
1.50
238 SCONV,        INLL,
ragge
1.49
239         SAREG,  TWORD|TPOINT,
ragge
1.59
240         SCREG,  TLONGLONG,
241                 NSPECIAL|NCREG|NCSL,    RESC1,
ragge
1.18
242                 "       cltd\n", },
243
ragge
1.59
244 /* convert int to unsigned long long */
245 SCONV,        INLL,
246         SAREG|SOREG|SNAME,      TWORD|TPOINT,
247         SHLL,   TULONGLONG,
248                 NCSL|NCREG,     RESC1,
249                 "       movl AL,A1\n    xorl U1,U1\n", },
250
251 /* convert int (in memory) to double */
252 SCONV,        INFL,
253         SOREG|SNAME,    TWORD,
254         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
255                 NDREG,  RESC1,
256                 "       fildl AL\n", },
257
258 /* convert int (in register) to double */
259 SCONV,        INFL,
260         SAREG,  TWORD,
261         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
262                 NTEMP|NDREG,    RESC1,
263                 "       pushl AL\n      fildl (%esp)\n  addl $4,%esp\n", },
264
265 /* long long to something */
266
267 /* convert (u)long long to (u)char (mem->reg) */
268 SCONV,        INCH,
ragge
1.37
269         SOREG|SNAME,    TLL,
ragge
1.59
270         SANY,   TCHAR|TUCHAR,
ragge
1.26
271                 NAREG|NASL,     RESC1,
ragge
1.59
272                 "       movb ZL,Z1\n", },
ragge
1.26
273
ragge
1.59
274 /* convert (u)long long to (u)char (reg->reg, do nothing) */
275 SCONV,        INCH,
276         SHLL,   TLL,
277         SANY,   TCHAR|TUCHAR,
ragge
1.37
278                 NAREG|NASL,     RESC1,
279                 "", },
280
281 /* convert (u)long long to (u)short (mem->reg) */
ragge
1.50
282 SCONV,        INAREG,
ragge
1.37
283         SOREG|SNAME,    TLL,
ragge
1.49
284         SAREG,  TSHORT|TUSHORT,
ragge
1.29
285                 NAREG|NASL,     RESC1,
286                 "       movw ZL,Z1\n", },
287
ragge
1.37
288 /* convert (u)long long to (u)short (reg->reg, do nothing) */
ragge
1.50
289 SCONV,        INAREG,
290         SHLL|SOREG|SNAME,       TLL,
ragge
1.49
291         SAREG,  TSHORT|TUSHORT,
ragge
1.37
292                 NAREG|NASL,     RESC1,
293                 "", },
294
ragge
1.59
295 /* convert long long to int (mem->reg) */
296 SCONV,        INAREG,
ragge
1.37
297         SOREG|SNAME,    TLL,
ragge
1.59
298         SAREG,  TWORD|TPOINT,
ragge
1.29
299                 NAREG|NASL,     RESC1,
ragge
1.59
300                 "       movl AL,A1\n", },
ragge
1.29
301
ragge
1.59
302 /* convert long long to int (reg->reg, do nothing) */
303 SCONV,        INAREG,
304         SHLL|SOREG|SNAME,       TLL,
305         SAREG,  TWORD|TPOINT,
ragge
1.37
306                 NAREG|NASL,     RESC1,
307                 "", },
308
ragge
1.33
309 /* convert long long (in memory) to floating */
ragge
1.64
310 SCONV,        INFL,
ragge
1.33
311         SOREG|SNAME,    TLONGLONG,
ragge
1.64
312         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
313                 NDREG,  RESC1,
ragge
1.26
314                 "       fildq AL\n", },
315
ragge
1.34
316 /* convert long long (in register) to floating */
ragge
1.64
317 SCONV,        INFL,
318         SHLL,   TLONGLONG,
319         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
320                 NTEMP|NDREG,    RESC1,
ragge
1.34
321                 "       pushl UL\n      pushl AL\n"
322                 "       fildq (%esp)\n  addl $8,%esp\n", },
323
ragge
1.59
324 /* convert unsigned long long to floating */
ragge
1.64
325 SCONV,        INFL,
ragge
1.69
326         SCREG,  TULONGLONG,
327         SDREG,  TLDOUBLE|TDOUBLE|TFLOAT,
328                 NDREG,  RESC1,
329                 "ZJ", },
ragge
1.25
330
ragge
1.59
331 /* float to something */
ragge
1.27
332
ragge
1.65
333 #if 0 /* go via int by adding an extra sconv in clocal() */
334 /* convert float/double to (u) char. XXX should use NTEMP here */
335 SCONV,        INCH,
336         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
337         SHCH,   TWORD|TSHORT|TUSHORT|TCHAR|TUCHAR,
338                 NBREG,  RESC1,
339                 "       subl $4,%esp\n  fistpl (%esp)\n popl A1\n", },
340
ragge
1.59
341 /* convert float/double to (u) int/short/char. XXX should use NTEMP here */
342 SCONV,        INCH,
343         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
344         SHCH,   TWORD|TSHORT|TUSHORT|TCHAR|TUCHAR,
ragge
1.65
345                 NCREG,  RESC1,
346                 "       subl $4,%esp\n  fistpl (%esp)\n popl A1\n", },
347 #endif
348
349 /* convert float/double to (u)int. XXX should use NTEMP here */
350 SCONV,        INAREG,
351         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
352         SAREG,  TWORD,
ragge
1.59
353                 NAREG,  RESC1,
ragge
1.65
354                 "       subl $4,%esp\n  fistpl (%esp)\n popl A1\n", },
ragge
1.29
355
ragge
1.59
356 /* convert float/double (in register) to (unsigned) long long */
357 /* XXX - unsigned is not handled correct */
358 SCONV,        INLL,
359         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
360         SHLL,   TLONGLONG|TULONGLONG,
ragge
1.65
361                 NCREG,  RESC1,
362                 "       subl $8,%esp\n  fistpq (%esp)\n"
363                 "       popl A1\n       popl U1\n", },
ragge
1.29
364
ragge
1.59
365 /* slut sconv */
ragge
1.29
366
ragge
1.1
367 /*
368  * Subroutine calls.
369  */
370
ragge
1.67
371 CALL,         FOREFF,
372         SCON,   TANY,
373         SANY,   TANY,
374                 0,      0,
375                 "       call CL\nZC", },
376
ragge
1.64
377 UCALL,        FOREFF,
378         SCON,   TANY,
379         SAREG,  TWORD|TPOINT,
380                 0,      0,
ragge
1.68
381                 "       call CL\n", },
382
383 CALLINAREG,
384         SCON,   TANY,
385         SAREG,  TWORD|TPOINT,
386                 NAREG|NASL,     RESC1,  /* should be 0 */
ragge
1.64
387                 "       call CL\nZC", },
388
389 UCALL,        INAREG,
ragge
1.1
390         SCON,   TANY,
ragge
1.57
391         SAREG,  TWORD|TPOINT,
ragge
1.1
392                 NAREG|NASL,     RESC1,  /* should be 0 */
ragge
1.68
393                 "       call CL\n", },
394
395 CALLINBREG,
396         SCON,   TANY,
397         SBREG,  TCHAR|TUCHAR,
398                 NBREG,  RESC1,  /* should be 0 */
ragge
1.12
399                 "       call CL\nZC", },
ragge
1.1
400
ragge
1.64
401 UCALL,        INBREG,
ragge
1.55
402         SCON,   TANY,
ragge
1.57
403         SBREG,  TCHAR|TUCHAR,
ragge
1.68
404                 NBREG,  RESC1,  /* should be 0 */
405                 "       call CL\n", },
406
407 CALL,         INCREG,
408         SCON,   TANY,
409         SCREG,  TANY,
410                 NCREG|NCSL,     RESC1,  /* should be 0 */
ragge
1.55
411                 "       call CL\nZC", },
412
ragge
1.64
413 UCALL,        INCREG,
ragge
1.55
414         SCON,   TANY,
415         SCREG,  TANY,
ragge
1.58
416                 NCREG|NCSL,     RESC1,  /* should be 0 */
ragge
1.68
417                 "       call CL\n", },
418
419 CALLINDREG,
420         SCON,   TANY,
421         SDREG,  TANY,
422                 NDREG|NDSL,     RESC1,  /* should be 0 */
ragge
1.55
423                 "       call CL\nZC", },
424
ragge
1.64
425 UCALL,        INDREG,
ragge
1.45
426         SCON,   TANY,
ragge
1.55
427         SDREG,  TANY,
ragge
1.58
428                 NDREG|NDSL,     RESC1,  /* should be 0 */
ragge
1.45
429                 "       call CL\nZC", },
430
ragge
1.68
431 CALL,         FOREFF,
432         SAREG,  TANY,
433         SANY,   TANY,
434                 0,      0,
435                 "       call *AL\nZC", },
436
ragge
1.64
437 UCALL,        FOREFF,
438         SAREG,  TANY,
439         SANY,   TANY,
440                 0,      0,
441                 "       call *AL\nZC", },
442
ragge
1.68
443 CALL,         INCREG,
444         SAREG,  TANY,
445         SANY,   TANY,
446                 NCREG|NCSL,     RESC1,  /* should be 0 */
447                 "       call *AL\nZC", },
448
449 UCALL,        INCREG,
450         SAREG,  TANY,
451         SANY,   TANY,
452                 NCREG|NCSL,     RESC1,  /* should be 0 */
453                 "       call *AL\nZC", },
454
455 CALL,         INAREG,
456         SAREG,  TANY,
457         SANY,   TANY,
458                 NAREG|NASL,     RESC1,  /* should be 0 */
459                 "       call *AL\nZC", },
460
ragge
1.64
461 UCALL,        INAREG,
ragge
1.49
462         SAREG,  TANY,
ragge
1.25
463         SANY,   TANY,
ragge
1.9
464                 NAREG|NASL,     RESC1,  /* should be 0 */
ragge
1.12
465                 "       call *AL\nZC", },
ragge
1.9
466
ragge
1.64
467 UCALL,        INBREG,
ragge
1.49
468         SAREG,  TANY,
ragge
1.45
469         SANY,   TANY,
470                 NBREG|NBSL,     RESC1,  /* should be 0 */
471                 "       call *AL\nZC", },
472
ragge
1.25
473 /* struct return */
ragge
1.64
474 USTCALL,      FOREFF,
475         SCON,   TANY,
476         SANY,   TANY,
477                 0,      0,
ragge
1.69
478                 "ZP     call CL\nZC", },
ragge
1.64
479
480 USTCALL,      INAREG,
ragge
1.25
481         SCON,   TANY,
482         SANY,   TANY,
483                 NAREG|NASL,     RESC1,  /* should be 0 */
ragge
1.69
484                 "ZP     call CL\nZC", },
ragge
1.25
485
ragge
1.64
486 USTCALL,      INAREG,
ragge
1.49
487         SNAME|SAREG,    TANY,
ragge
1.29
488         SANY,   TANY,
489                 NAREG|NASL,     RESC1,  /* should be 0 */
ragge
1.69
490                 "ZP     call *AL\nZC", },
491
492 STCALL,       FOREFF,
493         SCON,   TANY,
494         SANY,   TANY,
495                 0,      0,
496                 "ZP     call CL\nZC", },
497
498 STCALL,       INAREG,
499         SCON,   TANY,
500         SANY,   TANY,
501                 NAREG|NASL,     RESC1,  /* should be 0 */
502                 "ZP     call CL\nZC", },
503
504 STCALL,       INAREG,
505         SNAME|SAREG,    TANY,
506         SANY,   TANY,
507                 NAREG|NASL,     RESC1,  /* should be 0 */
508                 "ZP     call *AL\nZC", },
ragge
1.29
509
ragge
1.1
510 /*
ragge
1.12
511  * The next rules handle all binop-style operators.
ragge
1.1
512  */
ragge
1.17
513 /* Special treatment for long long */
ragge
1.60
514 PLUS,         INLL|FOREFF,
ragge
1.49
515         SHLL,           TLL,
516         SHLL|SNAME|SOREG,       TLL,
ragge
1.17
517                 0,      RLEFT,
518                 "       addl AR,AL\n    adcl UR,UL\n", },
519
ragge
1.29
520 /* Special treatment for long long  XXX - fix commutative check */
ragge
1.60
521 PLUS,         INLL|FOREFF,
ragge
1.49
522         SHLL|SNAME|SOREG,       TLL,
523         SHLL,                   TLL,
ragge
1.29
524                 0,      RRIGHT,
525                 "       addl AL,AR\n    adcl UL,UR\n", },
526
ragge
1.60
527 PLUS,         INFL,
ragge
1.49
528         SHFL,           TDOUBLE,
ragge
1.25
529         SNAME|SOREG,    TDOUBLE,
530                 0,      RLEFT,
531                 "       faddl AR\n", },
532
ragge
1.60
533 PLUS,         INFL,
534         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
ragge
1.49
535         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
ragge
1.26
536                 0,      RLEFT,
537                 "       faddp %st,%st(1)\n", },
538
ragge
1.30
539 /* address as register offset, positive */
ragge
1.60
540 PLUS,         INAREG,
ragge
1.49
541         SAREG,  TWORD|TPOINT,
ragge
1.30
542         SCON,   TANY,
543                 NAREG|NASL,     RESC1,
544                 "       leal CR(AL),A1\n", },
545
ragge
1.60
546 PLUS,         INCH,
ragge
1.49
547         SHCH|SNAME|SOREG,       TCHAR|TUCHAR,
ragge
1.48
548         SONE,   TANY,
ragge
1.60
549                 0,      RLEFT,
ragge
1.48
550                 "       incb AL\n", },
551
ragge
1.30
552 /* address as register offset, negative */
ragge
1.60
553 MINUS,        INAREG,
ragge
1.49
554         SAREG,  TWORD|TPOINT,
ragge
1.71
555         SPCON,  TANY,
ragge
1.30
556                 NAREG|NASL,     RESC1,
557                 "       leal -CR(AL),A1\n", },
558
ragge
1.60
559 MINUS,        INLL|FOREFF,
560         SHLL,   TLL,
ragge
1.49
561         SHLL|SNAME|SOREG,       TLL,
ragge
1.17
562                 0,      RLEFT,
563                 "       subl AR,AL\n    sbbl UR,UL\n", },
564
ragge
1.60
565 MINUS,        INFL,
566         SHFL,   TDOUBLE,
ragge
1.25
567         SNAME|SOREG,    TDOUBLE,
568                 0,      RLEFT,
569                 "       fsubl AR\n", },
570
ragge
1.60
571 MINUS,        INFL,
572         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
573         SHFL,   TLDOUBLE|TDOUBLE|TFLOAT,
ragge
1.25
574                 0,      RLEFT,
575                 "       fsubZHp %st,%st(1)\n", },
576
ragge
1.19
577 /* Simple r/m->reg ops */
ragge
1.12
578 OPSIMP,       INAREG|FOREFF,
ragge
1.49
579         SAREG,                  TWORD|TPOINT,
580         SAREG|SNAME|SOREG,      TWORD|TPOINT,
ragge
1.10
581                 0,      RLEFT,
582                 "       Ol AR,AL\n", },
583
ragge
1.12
584 OPSIMP,       INAREG|FOREFF,
ragge
1.50
585         SHINT,          TSHORT|TUSHORT,
586         SHINT|SNAME|SOREG,      TSHORT|TUSHORT,
ragge
1.19
587                 0,      RLEFT,
ragge
1.61
588                 "       Ow AR,AL\n", },
ragge
1.19
589
ragge
1.60
590 OPSIMP,       INCH|FOREFF,
ragge
1.49
591         SHCH,           TCHAR|TUCHAR,
592         SHCH|SNAME|SOREG,       TCHAR|TUCHAR,
ragge
1.19
593                 0,      RLEFT,
ragge
1.65
594                 "       Ob AR,AL\n", },
ragge
1.19
595
596 OPSIMP,       INAREG|FOREFF,
ragge
1.60
597         SAREG,  TWORD|TPOINT,
ragge
1.20
598         SCON,   TWORD|TPOINT,
ragge
1.1
599                 0,      RLEFT,
ragge
1.5
600                 "       Ol AR,AL\n", },
ragge
1.1
601
ragge
1.15
602 OPSIMP,       INAREG|FOREFF,
ragge
1.50
603         SHINT|SNAME|SOREG,      TSHORT|TUSHORT,
ragge
1.19
604         SCON,   TANY,
605                 0,      RLEFT,
ragge
1.61
606                 "       Ow AR,AL\n", },
ragge
1.19
607
ragge
1.60
608 OPSIMP,       INCH|FOREFF,
ragge
1.49
609         SHCH|SNAME|SOREG,       TCHAR|TUCHAR,
ragge
1.15
610         SCON,   TANY,
611                 0,      RLEFT,
ragge
1.68
612                 "       Ob AR,AL\n", },
ragge
1.15
613
ragge
1.60
614 OPSIMP,       INLL|FOREFF,
ragge
1.49
615         SHLL,   TLL,
616         SHLL|SNAME|SOREG,       TLL,
ragge
1.29
617                 0,      RLEFT,
618                 "       orl AR,AL\n     orl UR,UL\n", },
619
620
ragge
1.5
621 /*
622  * The next rules handle all shift operators.
623  */
ragge
1.68
624 /* (u)longlong left shift is emulated */
625 LS,   INCREG,
626         SCREG|SNAME|SOREG|SCONTLL,
627         SAREG|SNAME|SOREG|SCONTINT/* will be int */
628                 NSPECIAL|NCREG|NCSL|NCSR,       RESC1,
629                 "ZO", },
630
ragge
1.56
631 LS,   INAREG|FOREFF,
ragge
1.49
632         SAREG|SNAME|SOREG,      TWORD,
ragge
1.56
633         SAREG|SHCH,             TWORD|TCHAR|TUCHAR|TSHORT|TUSHORT,
634                 NSPECIAL,       RLEFT,
ragge
1.5
635                 "       sall ZA,AL\n", },
ragge
1.1
636
ragge
1.56
637 LS,   INAREG|FOREFF,
ragge
1.49
638         SAREG,  TWORD,
ragge
1.29
639         SCON,   TANY,
640                 0,      RLEFT,
641                 "       sall ZA,AL\n", },
642
ragge
1.56
643 LS,   INAREG|FOREFF,
644         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
645         SAREG,                  TANY,
646                 NSPECIAL,       RLEFT,
ragge
1.69
647                 "       shlw ZA,AL\n", },
ragge
1.56
648
649 LS,   INAREG|FOREFF,
ragge
1.49
650         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
ragge
1.26
651         SCON,   TANY,
652                 0,      RLEFT,
ragge
1.69
653                 "       shlw ZA,AL\n", },
ragge
1.26
654
ragge
1.56
655 LS,   INCH|FOREFF,
656         SHCH|SNAME|SOREG,       TCHAR|TUCHAR,
657         SAREG,                  TANY,
658                 NSPECIAL,       RLEFT,
ragge
1.68
659                 "       salb ZA,AL\n", },
ragge
1.30
660
ragge
1.56
661 LS,   INCH|FOREFF,
662         SHCH|SNAME|SOREG,       TCHAR|TUCHAR,
663         SCON,                   TANY,
ragge
1.30
664                 0,      RLEFT,
ragge
1.68
665                 "       salb ZA,AL\n", },
666
667 /* (u)longlong right shift is emulated */
668 RS,   INCREG,
669         SCREG|SNAME|SOREG|SCONTLL,
670         SAREG|SNAME|SOREG|SCONTINT/* will be int */
671                 NSPECIAL|NCREG|NCSL|NCSR,       RESC1,
672                 "ZO", },
ragge
1.30
673
ragge
1.56
674 RS,   INAREG|FOREFF,
675         SAREG|SNAME|SOREG,      TSWORD,
676         SAREG,                  TWORD|TCHAR|TUCHAR|TSHORT|TUSHORT,
677                 NSPECIAL,       RLEFT,
678                 "       sarl ZA,AL\n", },
ragge
1.23
679
ragge
1.56
680 RS,   INAREG|FOREFF,
ragge
1.49
681         SAREG|SNAME|SOREG,      TSWORD,
ragge
1.56
682         SCON,                   TWORD|TCHAR|TUCHAR|TSHORT|TUSHORT,
683                 0,              RLEFT,
ragge
1.5
684                 "       sarl ZA,AL\n", },
ragge
1.1
685
ragge
1.56
686 RS,   INAREG|FOREFF,
ragge
1.49
687         SAREG|SNAME|SOREG,      TUWORD,
ragge
1.56
688         SAREG,                  TWORD|TCHAR|TUCHAR|TSHORT|TUSHORT,
689                 NSPECIAL,       RLEFT,
ragge
1.5
690                 "       shrl ZA,AL\n", },
ragge
1.1
691
ragge
1.56
692 RS,   INAREG|FOREFF,
693         SAREG|SNAME|SOREG,      TUWORD,
694         SCON,                   TWORD|TCHAR|TUCHAR|TSHORT|TUSHORT,
695                 0,              RLEFT,
696                 "       shrl ZA,AL\n", },
ragge
1.26
697
ragge
1.56
698 RS,   INAREG|FOREFF,
699         SAREG|SNAME|SOREG,      TSHORT,
700         SAREG,                  TANY,
701                 NSPECIAL,       RLEFT,
ragge
1.68
702                 "       sarw ZA,AL\n", },
ragge
1.29
703
ragge
1.56
704 RS,   INAREG|FOREFF,
ragge
1.49
705         SAREG|SNAME|SOREG,      TSHORT,
ragge
1.56
706         SCON,                   TANY,
707                 0,              RLEFT,
ragge
1.68
708                 "       sarw AR,AL\n", },
ragge
1.29
709
ragge
1.56
710 RS,   INAREG|FOREFF,
711         SAREG|SNAME|SOREG,      TUSHORT,
712         SAREG,                  TANY,
713                 NSPECIAL,       RLEFT,
ragge
1.68
714                 "       shrw ZA,AL\n", },
ragge
1.29
715
ragge
1.56
716 RS,   INAREG|FOREFF,
717         SAREG|SNAME|SOREG,      TUSHORT,
718         SCON,                   TANY,
719                 0,              RLEFT,
ragge
1.68
720                 "       shrw AR,AL\n", },
ragge
1.26
721
ragge
1.56
722 RS,   INCH|FOREFF,
723         SHCH|SNAME|SOREG,       TCHAR,
ragge
1.68
724         SAREG,                  TANY,
ragge
1.56
725                 NSPECIAL,       RLEFT,
ragge
1.68
726                 "       sarb ZA,AL\n", },
ragge
1.29
727
ragge
1.56
728 RS,   INCH|FOREFF,
729         SHCH|SNAME|SOREG,       TCHAR,
730         SCON,                   TANY,
731                 0,              RLEFT,
ragge
1.68
732                 "       sarb AR,AL\n", },
ragge
1.29
733
ragge
1.56
734 RS,   INCH|FOREFF,
735         SHCH|SNAME|SOREG,       TUCHAR,
ragge
1.68
736         SAREG,                  TANY,
ragge
1.56
737                 NSPECIAL,       RLEFT,
ragge
1.68
738                 "       shrb ZA,AL\n", },
ragge
1.56
739
740 RS,   INCH|FOREFF,
741         SHCH|SNAME|SOREG,       TUCHAR,
742         SCON,                   TANY,
743                 0,              RLEFT,
ragge
1.68
744                 "       shrb AR,AL\n", },
ragge
1.29
745
ragge
1.1
746 /*
747  * The next rules takes care of assignments. "=".
748  */
ragge
1.56
749 ASSIGN,       FOREFF,
ragge
1.49
750         SHLL|SNAME|SOREG,       TLL,
ragge
1.17
751         SCON,           TANY,
752                 0,      0,
753                 "       movl AR,AL\n    movl UR,UL\n", },
754
ragge
1.56
755 ASSIGN,       FOREFF|INLL,
756         SHLL,           TLL,
757         SCON,           TANY,
758                 0,      RLEFT,
759                 "       movl AR,AL\n    movl UR,UL\n", },
760
761 ASSIGN,       FOREFF,
ragge
1.49
762         SAREG|SNAME|SOREG,      TWORD|TPOINT,
ragge
1.15
763         SCON,           TANY,
ragge
1.13
764                 0,      0,
765                 "       movl AR,AL\n", },
766
ragge
1.56
767 ASSIGN,       FOREFF|INAREG,
768         SAREG,  TWORD|TPOINT,
769         SCON,           TANY,
770                 0,      RLEFT,
771                 "       movl AR,AL\n", },
772
773 ASSIGN,       FOREFF,
ragge
1.49
774         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
ragge
1.15
775         SCON,           TANY,
776                 0,      0,
ragge
1.63
777                 "       movw AR,AL\n", },
ragge
1.15
778
ragge
1.56
779 ASSIGN,       FOREFF|INAREG,
780         SAREG,  TSHORT|TUSHORT,
781         SCON,           TANY,
782                 0,      RLEFT,
ragge
1.63
783                 "       movw AR,AL\n", },
ragge
1.56
784
785 ASSIGN,       FOREFF,
ragge
1.54
786         SHCH|SNAME|SOREG,       TCHAR|TUCHAR,
ragge
1.15
787         SCON,           TANY,
788                 0,      0,
ragge
1.54
789                 "       movb AR,AL\n", },
ragge
1.15
790
ragge
1.56
791 ASSIGN,       FOREFF|INCH,
792         SHCH,           TCHAR|TUCHAR,
793         SCON,           TANY,
794                 0,      RLEFT,
795                 "       movb AR,AL\n", },
796
ragge
1.50
797 ASSIGN,       FOREFF|INLL,
ragge
1.49
798         SHLL|SNAME|SOREG,       TLL,
799         SHLL,                   TLL,
ragge
1.17
800                 0,      RRIGHT,
801                 "       movl AR,AL\n    movl UR,UL\n", },
802
ragge
1.56
803 ASSIGN,       FOREFF|INAREG,
ragge
1.49
804         SAREG|SNAME|SOREG,      TWORD|TPOINT,
805         SAREG,          TWORD|TPOINT,
ragge
1.8
806                 0,      RRIGHT,
ragge
1.2
807                 "       movl AR,AL\n", },
808
ragge
1.56
809 ASSIGN,       FOREFF|INAREG,
ragge
1.49
810         SAREG,                  TWORD|TPOINT,
811         SAREG|SNAME|SOREG,      TWORD|TPOINT,
ragge
1.19
812                 0,      RLEFT,
813                 "       movl AR,AL\n", },
814
ragge
1.56
815 ASSIGN,       FOREFF|INAREG,
ragge
1.49
816         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
817         SAREG,          TSHORT|TUSHORT,
ragge
1.1
818                 0,      RRIGHT,
ragge
1.61
819                 "       movw AR,AL\n", },
ragge
1.1
820
ragge
1.56
821 ASSIGN,       FOREFF|INCH,
822         SHCH|SNAME|SOREG,       TCHAR|TUCHAR,
823         SHCH,           TCHAR|TUCHAR|TWORD,
ragge
1.11
824                 0,      RRIGHT,
ragge
1.55
825                 "       movb AR,AL\n", },
ragge
1.1
826
ragge
1.68
827 ASSIGN,       FOREFF|INAREG,
ragge
1.21
828         SFLD,           TANY,
ragge
1.49
829         SAREG,  TANY,
ragge
1.22
830                 NAREG,  RRIGHT,
831                 "ZE", },
832
ragge
1.68
833 ASSIGN,       FOREFF|INAREG,
ragge
1.22
834         SFLD,           TANY,
ragge
1.49
835         SAREG|SNAME|SOREG|SCONTANY,
ragge
1.22
836                 NAREG,  0,
ragge
1.19
837                 "ZE", },
838
ragge
1.68
839 ASSIGN,       INDREG|FOREFF,
840         SHFL,   TFLOAT|TDOUBLE|TLDOUBLE,
841         SHFL,   TFLOAT|TDOUBLE|TLDOUBLE,
842                 0,      RRIGHT,
843                 "", }, /* This will always be in the correct register */
844
ragge
1.28
845 /* order of table entries is very important here! */
ragge
1.56
846 ASSIGN,       FOREFF|INFL,
ragge
1.28
847         SNAME|SOREG,    TLDOUBLE,
ragge
1.50
848         SHFL,   TFLOAT|TDOUBLE|TLDOUBLE,
ragge
1.28
849                 0,      RRIGHT,
ragge
1.46
850                 "       fld %st(0)\n    fstpt AL\n", },
ragge
1.28
851
852 ASSIGN,       FOREFF,
853         SNAME|SOREG,    TLDOUBLE,
ragge
1.50
854         SHFL,   TFLOAT|TDOUBLE|TLDOUBLE,
ragge
1.28
855                 0,      0,
856                 "       fstpt AL\n", },
857
ragge
1.56
858 ASSIGN,       FOREFF|INFL,
ragge
1.25
859         SNAME|SOREG,    TDOUBLE,
ragge
1.50
860         SHFL,   TFLOAT|TDOUBLE|TLDOUBLE,
ragge
1.26
861                 0,      RRIGHT,
862                 "       fstl AL\n", },
863
864 ASSIGN,       FOREFF,
865         SNAME|SOREG,    TDOUBLE,
ragge
1.50
866         SHFL,   TFLOAT|TDOUBLE|TLDOUBLE,
ragge
1.25
867                 0,      0,
868                 "       fstpl AL\n", },
869
ragge
1.56
870 ASSIGN,       FOREFF|INFL,
ragge
1.26
871         SNAME|SOREG,    TFLOAT,
ragge
1.50
872         SHFL,   TFLOAT|TDOUBLE|TLDOUBLE,
ragge
1.28
873                 0,      RRIGHT,
874                 "       fsts AL\n", },
875
876 ASSIGN,       FOREFF,
877         SNAME|SOREG,    TFLOAT,
ragge
1.50
878         SHFL,   TFLOAT|TDOUBLE|TLDOUBLE,
ragge
1.26
879                 0,      0,
880                 "       fstps AL\n", },
ragge
1.28
881 /* end very important order */
ragge
1.26
882
ragge
1.65
883 ASSIGN,       INFL|FOREFF,
884         SHFL,           TLDOUBLE,
885         SHFL|SOREG|SNAME,       TLDOUBLE,
886                 0,      RLEFT,
887                 "       fldt AR\n", },
888
889 ASSIGN,       INFL|FOREFF,
890         SHFL,           TDOUBLE,
891         SHFL|SOREG|SNAME,       TDOUBLE,
892                 0,      RLEFT,
893                 "       fldl AR\n", },
894
895 ASSIGN,       INFL|FOREFF,
896         SHFL,           TFLOAT,
897         SHFL|SOREG|SNAME,       TFLOAT,
898                 0,      RLEFT,
899                 "       flds AR\n", },
900
ragge
1.69
901 /* Do not generate memcpy if return from funcall */
902 #if 0
903 STASG,        INAREG|FOREFF,
904         SOREG|SNAME|SAREG,      TPTRTO|TSTRUCT,
905         SFUNCALL,       TPTRTO|TSTRUCT,
906                 0,      RRIGHT,
907                 "", },
908 #endif
909
910 STASG,        INAREG|FOREFF,
911         SOREG|SNAME,    TANY,
912         SAREG|SOREG|SNAME,      TPTRTO|TANY,
913