Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:plunky:20110605085442

Diff

Diff from 1.29 to:

Annotations

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

Annotated File View

plunky
1.29
1 /*      $Id: table.c,v 1.29 2011/06/05 08:54:42 plunky Exp $    */
2
david
1.1
3 /*
4  * Copyright (c) 2008 David Crawshaw <david@zentus.com>
5  * 
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  * 
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18
19 #include "pass2.h"
20
david
1.14
21 #define TS64   TLONG|TLONGLONG
22 #define TU64   TULONG|TULONGLONG|TPOINT
23 #define T64    TS64|TU64
24
david
1.1
25 struct optab table[] = {
26
27 { -1FOREFFSANYTANYSANYTANY00"", },      /* empty */
28
29 PCONV,        INAREG,
david
1.24
30         SAREG,  T64|TINT,
david
1.14
31         SAREG,  T64,
david
1.1
32                 0,      RLEFT,
david
1.12
33                 "       ! convert between word and pointer\n", },
david
1.1
34
david
1.17
35 /* Conversions. */
david
1.1
36
37 SCONV,        INAREG,
david
1.17
38         SAREG,  T64|TUNSIGNED,
david
1.14
39         SAREG,  TINT,
david
1.17
40                 NAREG|NASL,     RESC1,
41                 "       sra AL,0,A1     \t\t! (u)int64/32 -> (u)int32\n", },
david
1.1
42
43 SCONV,        INAREG,
david
1.17
44         SAREG,  T64|TINT|TUNSIGNED,
45         SAREG,  TSHORT,
46                 NAREG|NASL,     RESC1,
47                 "       sll AL,16,A1    \t\t! (u)int64/32 -> int16\n"
48                 "       sra AL,16,A1\n"
49                 "       sra AL, 0,A1\n", },
david
1.1
50
51 SCONV,        INAREG,
david
1.17
52         SAREG,  T64|TINT|TUNSIGNED,
53         SAREG,  TUSHORT,
54                 NAREG|NASL,     RESC1,
55                 "       sll AL,16,A1    \t\t! (u)int64/32 -> uint16\n"
56                 "       srl AL,16,A1\n", },
david
1.1
57
58 SCONV,        INAREG,
david
1.17
59         SAREG,  T64|TINT|TUNSIGNED|TSHORT|TUSHORT,
david
1.1
60         SAREG,  TCHAR,
david
1.17
61                 NAREG|NASL,     RESC1,
62                 "       sll AL,24,A1    \t\t! (u)int64/32/16 -> int8\n"
63                 "       sra AL,24,A1\n"
64                 "       sra AL, 0,A1\n", },
david
1.1
65
66 SCONV,        INAREG,
david
1.17
67         SAREG,  T64|TINT|TUNSIGNED|TSHORT|TUSHORT,
david
1.1
68         SAREG,  TUCHAR,
david
1.17
69                 NAREG|NASL,     RESC1,
70                 "       and AL,0xff,A1  \t\t! (u)int64/32/16 -> uint8\n", },
david
1.1
71
72 SCONV,        INAREG,
ragge
1.27
73         SAREG,  T64|TINT|TUNSIGNED|TSHORT|TUSHORT|TCHAR|TUCHAR/* TCHAR|TUCHAR added to handle char -> long (among others) */
david
1.14
74         SAREG,  T64,
david
1.17
75                 0,      RLEFT,
76                 "                       \t\t! (u)int64...8 -> (u)int64\n", },
david
1.1
77
78 SCONV,        INAREG,
david
1.17
79         SAREG,  TSHORT|TUSHORT|TCHAR|TUCHAR,
80         SAREG,  TINT,
81                 0,      RLEFT,
82                 "                       \t\t! (u)int16/8 -> int32\n", },
david
1.1
83
84 SCONV,        INAREG,
david
1.17
85         SAREG,  T64|TINT|TSHORT|TCHAR,
86         SAREG,  TUNSIGNED,
87                 0,      RLEFT,
88                 "       srl AL, 0,A1    \t\t! int32/16/8 -> uint32\n", },
david
1.1
89
david
1.9
90 SCONV,        INAREG,
david
1.17
91         SAREG,  TUSHORT|TUCHAR,
92         SAREG,  TUNSIGNED,
david
1.9
93                 0,      RLEFT,
david
1.17
94                 "                       \t\t! uint16/8 -> uint32\n", },
david
1.9
95
david
1.25
96 SCONV,        INBREG,
97         SBREG,  TINT|TUNSIGNED,
98         SBREG,  TFLOAT,
99                 NBREG|NASL,     RESC1,
100                 "       fitos AL,A1         \t\t! (u)int32 -> float\n", },
101
102 SCONV,        INBREG,
103         SBREG,  T64,
104         SBREG,  TFLOAT,
105                 NBREG|NASL,     RESC1,
106                 "       fxtos AL,A1         \t\t! (u)int64 -> float\n", },
107
108 SCONV,        INCREG,
109         SCREG,  TINT|TUNSIGNED,
110         SCREG,  TDOUBLE,
111                 NCREG|NASL,     RESC1,
112                 "       fitod AL,A1         \t\t! (u)int32 -> double\n", },
113
114 SCONV,        INCREG,
115         SCREG,  T64,
116         SCREG,  TDOUBLE,
117                 NCREG|NASL,     RESC1,
118                 "       fxtod AL,A1         \t\t! (u)int64 -> double\n", },
119
120
david
1.21
121 /* Floating-point conversions must be stored and loaded. */
122
david
1.24
123 SCONV,        INAREG,
124         SOREG,  TFLOAT,
125         SAREG,  TINT,
126                 NAREG|(2*NBREG),        RESC1,
127                 "       ld [AL],A2    \t\t! float -> int32\n"
128                 "       nop\n"
129                 "       fmovs A2,A3\n"
130                 "       fstoi A2,A2\n"
131                 "       st A2,[AL]\n"
132                 "       nop\n"
133                 "       ld [AL],A1\n"
134                 "       nop\n"
135                 "       st A3,[AL]\n"
136                 "       nop\n", },
137
138 SCONV,        INAREG,
139         SOREG,  TDOUBLE,
140         SAREG,  TINT,
141                 NAREG|(2*NCREG),        RESC1,
142                 "       ld [AL],A2    \t\t! double -> int32\n"
143                 "       nop\n"
144                 "       fmovd A2,A3\n"
145                 "       fdtoi A2,A2\n"
146                 "       std A2,[AL]\n"
147                 "       nop\n"
148                 "       ldd [AL],A1\n"
149                 "       nop\n"
150                 "       std A3,[AL]\n"
151                 "       nop\n", },
152
david
1.19
153 SCONV,        INBREG,
david
1.21
154         SOREG,  T64|TUNSIGNED,
david
1.19
155         SBREG,  TFLOAT,
156                 NBREG,  RESC1,
david
1.21
157                 "       ld [AL],A1      \t\t! int64 -> float\n"
david
1.19
158                 "       fxtos A1,A1\n", },
159
160 SCONV,        INBREG,
david
1.21
161         SOREG,  TINT|TSHORT|TCHAR,
david
1.19
162         SBREG,  TFLOAT,
163                 NBREG,  RESC1,
david
1.21
164                 "       ld [AL],A1      \t\t! int32/16/8 -> float\n"
165                 "       fitos A1,A1\n", }, // XXX need 'lds', 'ldh', etc
david
1.19
166
167 SCONV,        INCREG,
david
1.24
168         SOREG,  T64|TUNSIGNED,
david
1.19
169         SCREG,  TDOUBLE,
170                 NCREG,  RESC1,
david
1.21
171                 "       ldd [AL],A1     \t\t! (u)int64 -> double\n"
david
1.19
172                 "       fxtod A1,A1\n", },
173
174 SCONV,        INCREG,
david
1.21
175         SOREG,  TINT|TSHORT|TCHAR,
david
1.19
176         SCREG,  TDOUBLE,
177                 NCREG,  RESC1,
david
1.24
178                 "       ld [AL],A1      \t\t! int32/16/8 -> double\n"
david
1.21
179                 "       fitod A1,A1\n", }, // XXX need 'lds' 'ldh' 'ld', etc.
david
1.1
180
david
1.22
181 SCONV,        INBREG,
182         SCREG,  TDOUBLE,
183         SBREG,  TFLOAT,
184                 NBREG,  RESC1,
185                 "       fdtos AL,A1     \t\t! double -> float\n",},
186
187 SCONV,        INCREG,
188         SBREG,  TFLOAT,
189         SCREG,  TDOUBLE,
190                 NCREG,  RESC1,
191                 "       fstod AL,A1     \t\t! float -> double\n",},
192
david
1.26
193 SCONV,    INAREG,
194         SBREG,  TFLOAT,
195         SAREG,  TINT,
196                 NAREG|NBREG,    RESC1,
197                 "       fstoi AL,A2     \t\t! float -> int\n"
198                 "       st A2,[%fp+2047]\n"
199                 "       nop\n"
200                 "       ld [%fp+2047],A1\n"
201                 "       nop\n",},
202
203 SCONV,    INAREG,
204         SCREG,  TDOUBLE,
205         SAREG,  TINT,
206                 NAREG|NCREG,    RESC1,
207                 "       fdtoi AL,A2     \t\t! double -> int\n"
208                 "       st A2,[%fp+2047]\n"
209                 "       nop\n"
210                 "       ld [%fp+2047],A1\n"
211         "       nop\n",},
212
david
1.22
213
david
1.1
214 /* Multiplication and division */
215
216 MUL,  INAREG,
217         SAREG,  TANY,
218         SAREG,  TANY,
219                 NAREG|NASR|NASL,        RESC1,
david
1.16
220                 "       mulx AL,AR,A1           ! multiply\n", },
david
1.1
221
david
1.19
222 MUL,  INBREG,
223         SBREG,  TFLOAT,
224         SBREG,  TFLOAT,
225                 NBREG|NBSR|NBSL,        RESC1,
226                 "       fmuls AL,AR,A1          ! multiply float\n", },
227
228 MUL,  INCREG,
229         SCREG,  TDOUBLE,
230         SCREG,  TDOUBLE,
231                 NCREG|NCSR|NCSL,        RESC1,
232                 "       fmuld AL,AR,A1          ! multiply double\n", },
233
david
1.1
234 DIV,  INAREG,
david
1.14
235         SAREG,  TUNSIGNED|TUSHORT|TUCHAR|TU64,
236         SAREG,  TUNSIGNED|TUSHORT|TUCHAR|TU64,
david
1.1
237                 NAREG|NASR|NASL,        RESC1,
david
1.16
238                 "       udivx AL,AR,A1          ! unsigned division\n", },
david
1.1
239
240 DIV,  INAREG,
david
1.14
241         SAREG,  TINT|TSHORT|TCHAR|TS64,
242         SAREG,  TINT|TSHORT|TCHAR|TS64,
david
1.1
243                 NAREG|NASR|NASL,        RESC1,
david
1.16
244                 "       sdivx AL,AR,A1          ! signed division\n", },
david
1.1
245
david
1.19
246 DIV,  INBREG,
247         SBREG,  TFLOAT,
248         SBREG,  TFLOAT,
249                 NBREG|NBSR|NBSL,        RESC1,
250                 "       fdivs AL,AR,A1          ! divide float\n", },
251
252 DIV,  INCREG,
253         SCREG,  TDOUBLE,
254         SCREG,  TDOUBLE,
255                 NCREG|NCSR|NCSL,        RESC1,
256                 "       fdivd AL,AR,A1          ! divide double\n", },
257
david
1.15
258 MOD,  INAREG,
259         SAREG,  TUNSIGNED|TUSHORT|TUCHAR|TU64,
260         SAREG,  TUNSIGNED|TUSHORT|TUCHAR|TU64,
261                 NAREGRESC1,
262                 "       udivx AL,AR,A1          ! unsigned modulo\n"
263                 "       mulx A1,AR,A1\n"
264                 "       sub AL,A1,A1\n", },
265
266 MOD,  INAREG,
267         SAREG,  TINT|TSHORT|TCHAR|TS64,
268         SAREG,  TINT|TSHORT|TCHAR|TS64,
269                 NAREGRESC1,
270                 "       sdivx AL,AR,A1          ! signed modulo\n"
271                 "       mulx A1,AR,A1\n"
272                 "       sub AL,A1,A1\n", },
david
1.1
273
274 PLUSINAREG,
david
1.6
275         SAREG,  TANY,
276         SAREG,  TANY,
david
1.1
277                 NAREG|NASL,     RESC1,
david
1.14
278                 "       add AL,AR,A1\n", },
david
1.1
279
david
1.19
280 PLUSINBREG,
281         SBREG,  TFLOAT,
282         SBREG,  TFLOAT,
283                 NBREG|NBSL,     RESC1,
284                 "       fadds AL,AR,A1\n", },
285
286 PLUSINCREG,
287         SCREG,  TDOUBLE,
288         SCREG,  TDOUBLE,
289                 NCREG|NCSL,     RESC1,
290                 "       faddd AL,AR,A1\n", },
291
david
1.1
292 PLUSINAREG,
david
1.6
293         SAREG,  TANY,
david
1.15
294         SCON,   TANY,
ragge
1.27
295                 (3*NAREG),      RESC1,
david
1.15
296                 "ZA", },
david
1.1
297
298 MINUS,        INAREG,
david
1.6
299         SAREG,  TANY,
300         SAREG,  TANY,
david
1.1
301                 NAREG|NASL,     RESC1,
david
1.14
302                 "       sub AL,AR,A1\n", },
david
1.1
303
david
1.19
304 MINUS,        INBREG,
305         SBREG,  TANY,
306         SBREG,  TANY,
307                 NBREG|NBSL|NBSR,        RESC1,
308                 "       fsubs AL,AR,A1\n", },
309
310 MINUS,        INCREG,
311         SCREG,  TANY,
312         SCREG,  TANY,
313                 NCREG|NCSL|NBSR,        RESC1,
314                 "       fsubd AL,AR,A1\n", },
315
david
1.1
316 MINUS,        INAREG,
david
1.12
317         SAREG,  TANY,
david
1.15
318         SCON,   TANY,
ragge
1.27
319                 (3*NAREG),      RESC1,
david
1.15
320                 "ZB", },
david
1.9
321
david
1.1
322 UMINUS,       INAREG,
david
1.6
323         SAREG,  TANY,
david
1.1
324         SANY,   TANY,
325                 NAREG|NASL,     RESC1,
david
1.16
326                 "       sub %g0,AL,A1\n", },
david
1.1
327
david
1.20
328 UMINUS,       INBREG,
329         SBREG,  TANY,
330         SANY,   TANY,
331                 NBREG|NBSL,     RESC1,
332                 "       fsubs %g0,AL,A1\n", },
333
334 UMINUS,       INCREG,
335         SCREG,  TANY,
336         SANY,   TANY,
337                 NCREG|NCSL,     RESC1,
338                 "       fsubd %g0,AL,A1\n", },
339
david
1.4
340 /* Shifts */
341
342 RS,   INAREG,
david
1.15
343         SAREG,  TINT|TUNSIGNED|TSHORT|TUSHORT|TCHAR|TUCHAR,
ragge
1.23
344         SAREG|SCON,     TINT|TUNSIGNED|TSHORT|TUSHORT|TCHAR|TUCHAR,
david
1.4
345                 NAREG|NASL,     RESC1,
ragge
1.27
346                 "       srl AL,AR,A1                    ! shift right\n", },
david
1.4
347
348 RS,   INAREG,
david
1.14
349         SAREG,  T64,
david
1.24
350         SAREG|SCON,     T64|TINT|TUNSIGNED|TSHORT|TUSHORT|TCHAR|TUCHAR,
david
1.4
351                 NAREG|NASL,     RESC1,
ragge
1.27
352                 "       srlx AL,AR,A1                   ! shift right\n", },
david
1.4
353
354 LS,   INAREG,
david
1.14
355         SAREG,  TINT|TUNSIGNED|TSHORT|TUSHORT|TCHAR|TUCHAR,
ragge
1.23
356         SAREG|SCON,     TINT|TUNSIGNED|TSHORT|TUSHORT|TCHAR|TUCHAR,
david
1.4
357                 NAREG|NASL,     RESC1,
david
1.16
358                 "       sll AL,AR,A1                    ! shift left\n", },
david
1.4
359
360 LS,   INAREG,
david
1.14
361         SAREG,  T64,
ragge
1.23
362         SAREG|SCON,     TINT|TUNSIGNED|TSHORT|TUSHORT|TCHAR|TUCHAR,
david
1.4
363                 NAREG|NASL,     RESC1,
david
1.16
364                 "       sllx AL,AR,A1                   ! shift left\n", },
david
1.4
365
david
1.15
366 COMPL,        INAREG,
367         SAREG,  TANY,
368         SANY,   TANY,
369                 NAREG|NASL,     RESC1,
ragge
1.27
370                 "       not AL,A1                       ! complement\n", },
david
1.4
371
david
1.1
372 /* Assignments */
373
ragge
1.27
374 ASSIGN,       FOREFF|INAREG,                  /* FIXME: Remove [,] here and add them in adrput instead. */
375         SAREG|SOREG,    TINT|TUNSIGNED,
david
1.14
376         SAREG,  TINT|TUNSIGNED,
david
1.1
377                 0,      RDEST,
david
1.3
378                 "       stw AR,[AL]             ! store (u)int32\n"
david
1.12
379                 "       nop\n", },
david
1.1
380
381 ASSIGN,       FOREFF|INAREG,
david
1.14
382         SOREG,  TSHORT|TUSHORT,
383         SAREG,  TSHORT|TUSHORT,
david
1.1
384                 0,      RDEST,
david
1.12
385                 "       sth AR,[AL]             ! store (u)int16\n"
david
1.1
386                 "       nop\n", },      
387
388 ASSIGN,       FOREFF|INAREG,
david
1.14
389         SOREG,  TCHAR|TUCHAR,
390         SAREG,  TCHAR|TUCHAR,
david
1.1
391                 0,      RDEST,
392                 "       stb AR,[AL]             ! store (u)int8\n"
393                 "       nop\n", },      
394
395 ASSIGN,       FOREFF|INAREG,
david
1.14
396         SOREG,  T64,
397         SAREG,  T64,
david
1.1
398                 0,      RDEST,
399                 "       stx AR,[AL]             ! store (u)int64\n"
400                 "       nop\n", },
401
david
1.19
402 ASSIGN,       FOREFF|INBREG,
403         SOREG,  TFLOAT,
404         SBREG,  TFLOAT,
405                 0,      RDEST,
406                 "       st AR,[AL]              ! store float\n"
407                 "       nop\n", },
408
david
1.25
409 ASSIGN,       FOREFF|INBREG,
410         SOREG,  TINT,
411         SBREG,  TINT,
412                 0,      RDEST,
413                 "       st AR,[AL]              ! store int from fp address\n"
414                 "       nop\n", },
415
david
1.19
416 ASSIGN,       FOREFF|INCREG,
417         SOREG,  TDOUBLE,
418         SCREG,  TDOUBLE,
419                 0,      RDEST,
420                 "       std AR,[AL]             ! store double\n"
421                 "       nop\n", },
422
david
1.25
423 ASSIGN,       FOREFF|INCREG,
424         SOREG,  TINT,
425         SCREG,  TINT,
426                 0,      RDEST,
427                 "       st AR,[AL]              ! store int from fp address\n"
428                 "       nop\n", },
429
430
david
1.1
431 ASSIGN,       FOREFF|INAREG,
david
1.14
432         SNAME,  TINT|TUNSIGNED,
433         SAREG,  TINT|TUNSIGNED,
david
1.12
434                 NAREG,  RDEST,
435                 "       sethi %h44(AL),A1       \t! store (u)int32 into sname\n"
436                 "       or A1,%m44(AL),A1\n"
437                 "       sllx A1,12,A1\n"
438                 "       stw AR,[A1+%l44(AL)]\n"
439                 "       nop\n", },
440
441 ASSIGN,       FOREFF|INAREG,
442         SNAME,  TSHORT|TUSHORT,
443         SAREG,  TSHORT|TUSHORT,
444                 NAREG,  RDEST,
445                 "       sethi %h44(AL),A1       \t! store (u)int16 into sname\n"
446                 "       or A1,%m44(AL),A1\n"
447                 "       sllx A1,12,A1\n"
448                 "       sth AR,[A1+%l44(AL)]\n"
449                 "       nop\n", },
450
451 ASSIGN,       FOREFF|INAREG,
452         SNAME,  TCHAR|TUCHAR,
453         SAREG,  TCHAR|TUCHAR,
454                 NAREG,  RDEST,
455                 "       sethi %h44(AL),A1       \t! store (u)int8 into sname\n"
456                 "       or A1,%m44(AL),A1\n"
457                 "       sllx A1,12,A1\n"
458                 "       stb AR,[A1+%l44(AL)]\n"
459                 "       nop\n", },
460
461 ASSIGN,       FOREFF|INAREG,
david
1.14
462         SNAME,  T64,
463         SAREG,  T64,
david
1.12
464                 NAREG,  RDEST,
465                 "       sethi %h44(AL),A1       \t! store (u)int64 into sname\n"
466                 "       or A1,%m44(AL),A1\n"
467                 "       sllx A1,12,A1\n"
468                 "       stx AR,[A1+%l44(AL)]\n"
469                 "       nop\n", },
470
david
1.20
471 ASSIGN,       FOREFF|INBREG,
david
1.25
472         SNAME,  TFLOAT|TINT,
473         SBREG,  TFLOAT|TINT,
david
1.20
474                 NAREG,  RDEST,
475                 "       sethi %h44(AL),A1       \t! store float into sname\n"
476                 "       or A1,%m44(AL),A1\n"
477                 "       sllx A1,12,A1\n"
478                 "       st AR,[A1+%l44(AL)]\n"
479                 "       nop\n", },
480
david
1.24
481 ASSIGN,       FOREFF|INCREG,
david
1.20
482         SNAME,  TDOUBLE,
483         SCREG,  TDOUBLE,
484                 NAREG,  RDEST,
485                 "       sethi %h44(AL),A1       \t! store double into sname\n"
486                 "       or A1,%m44(AL),A1\n"
487                 "       sllx A1,12,A1\n"
488                 "       std AR,[A1+%l44(AL)]\n"
489                 "       nop\n", },
490
david
1.25
491 ASSIGN,       FOREFF|INCREG,
492         SNAME,  TINT,
493         SCREG,  TINT,
494                 NAREG,  RDEST,
495                 "       sethi %h44(AL),A1       \t! store int into sname\n"
496                 "       or A1,%m44(AL),A1\n"
497                 "       sllx A1,12,A1\n"
498                 "       st AR,[A1+%l44(AL)]\n"
499                 "       nop\n", },
500
david
1.12
501 ASSIGN,       FOREFF|INAREG,
david
1.1
502         SAREG,  TANY,
503         SAREG,  TANY,
504                 0,      RDEST,
david
1.17
505                 "       mov AR,AL                       ! register move\n", },
david
1.1
506
david
1.20
507 ASSIGN,       FOREFF|INBREG,
508         SBREG,  TANY,
509         SBREG,  TANY,
510                 0,      RDEST,
511                 "       fmovs AR,AL                     ! move float\n", },
512
513 ASSIGN,       FOREFF|INCREG,
514         SCREG,  TANY,
515         SCREG,  TANY,
516                 0,      RDEST,
517                 "       fmovd AR,AL                     ! move double\n", },
518
david
1.15
519 /* Structure assignment. */
520
521 STASG,        INAREG|FOREFF,
522         SOREG|SNAME,    TANY,
523         SAREG,          TPTRTO|TANY,
gmcgarry
1.28
524                 NSPECIAL,       RDEST,
david
1.15
525                 "ZQ", },
526
david
1.1
527 /* Comparisons. */
528
529 EQ,   FORCC,
david
1.14
530         SAREG,  TANY,
531         SAREG,  TANY,
david
1.1
532                 0,      RESCC,
ragge
1.27
533                 "       cmp AL,AR                       ! eq\n"
david
1.1
534                 "       be LC\n"
535                 "       nop\n", },
536
537 NE,   FORCC,
david
1.14
538         SAREG,  TANY,
539         SAREG,  TANY,
david
1.1
540                 0,      RESCC,
ragge
1.27
541                 "       cmp AL,AR                       ! ne\n"
david
1.1
542                 "       bne LC\n"
543                 "       nop\n", },
544
david
1.7
545 OPLOG,        FORCC,
david
1.12
546         SAREG,  TANY,
547         SZERO,  TANY,
david
1.9
548                 0,      RESCC,
549                 "       O AL,LC\n"
550                 "       nop\n", },
david
1.14
551
david
1.9
552 OPLOG,        FORCC,
david
1.12
553         SAREG,  TANY,
david
1.9
554         SAREG,  TANY,
555                 NAREG|NASL,     RESCC,
david
1.14
556                 "       sub AL,AR,A1                    ! oplog\n"
david
1.9
557                 "       O A1,LC\n"
558                 "       nop\n", },
david
1.14
559
david
1.9
560 OPLOG,        FORCC,
david
1.12
561         SAREG,  TANY,
562         SCCON,  TANY,
david
1.7
563                 NAREG|NASL,     RESCC,
david
1.12
564                 "       sub AL,AR,A1                    ! oplog sccon\n"
david
1.9
565                 "       O A1,LC\n"
566                 "       nop\n", },
david
1.7
567
david
1.20
568 OPLOG,        FORCC,
569         SBREG,  TFLOAT,
570         SBREG,  TFLOAT,
571                 NBREGRESCC,
572                 "       fcmps AL,AR                     ! oplog float\n"
573                 "       ZF LC\n", },
574
575 OPLOG,        FORCC,
576         SOREG,  TFLOAT,
577         SBREG,  TFLOAT,
578                 NBREGRESCC,
579                 "       ld [AL], A1                     ! oplog float oreg\n"
580                 "       nop\n"
581                 "       fcmps A1,AR\n"
582                 "       ZF LC\n", },
583
584 OPLOG,        FORCC,
585         SCREG,  TDOUBLE,
586         SCREG,  TDOUBLE,
587                 NCREGRESCC,
david
1.25
588                 "       fcmpd AL,AR                     ! oplog double\n"
589                 "       ZF LC\n", },
590
591 OPLOG,        FORCC,
592         SOREG,  TDOUBLE,
593         SCREG,  TDOUBLE,
594                 NCREGRESCC,
595                 "       ldd [AL], A1                    ! oplog double oreg\n"
596                 "       nop\n"
597                 "       fcmpd A1,AR\n"
598                 "       ZF LC\n", },
david
1.20
599
david
1.7
600
david
1.8
601 /* Load constants to register. */
602
603 OPLTYPE,      INAREG,
604         SCON,           TANY,
david
1.14
605         SNAME,          T64,
david
1.8
606                 NAREG,  RESC1,
607                 "       sethi %h44(AL),A1\t     ! load const (u)int64 to reg\n"
608                 "       or A1,%m44(AL),A1\n"
609                 "       sllx A1,12,A1\n"
david
1.13
610                 "       ldx [A1+%l44(AL)],A1\n"
611                 "       nop\n", },
david
1.8
612 OPLTYPE,      INAREG,
613         SCON,           TANY,
david
1.14
614         SNAME,          TINT,
david
1.8
615                 NAREG,  RESC1,
616                 "       sethi %h44(AL),A1\t     ! load const int32 to reg\n"
617                 "       or A1,%m44(AL),A1\n"
618                 "       sllx A1,12,A1\n"
david
1.13
619                 "       ldsw [A1+%l44(AL)],A1\n"
620                 "       nop\n", },
david
1.25
621
david
1.8
622 OPLTYPE,      INAREG,
623         SCON,           TANY,
david
1.14
624         SNAME,          TUNSIGNED,
david
1.8
625                 NAREG,  RESC1,
626                 "       sethi %h44(AL),A1\t! load const uint32 to reg\n"
627                 "       or A1,%m44(AL),A1\n"
628                 "       sllx A1,12,A1\n"
david
1.13
629                 "       lduw [A1+%l44(AL)],A1\n"
630                 "       nop\n", },
david
1.8
631 OPLTYPE,      INAREG,
632         SCON,           TANY,
633         SNAME,          TSHORT,
634                 NAREG,  RESC1,
635                 "       sethi %h44(AL),A1\t! load const int16 to reg\n"
636                 "       or A1,%m44(AL),A1\n"
637                 "       sllx A1,12,A1\n"
david
1.13
638                 "       ldsh [A1+%l44(AL)],A1\n"
639                 "       nop\n", },
david
1.8
640 OPLTYPE,      INAREG,
641         SCON,           TANY,
642         SNAME,          TUSHORT,
643                 NAREG,  RESC1,
644                 "       sethi %h44(AL),A1\t     ! load const uint16 to reg\n"
645                 "       or A1,%m44(AL),A1\n"
646                 "       sllx A1,12,A1\n"
david
1.13
647                 "       lduh [A1+%l44(AL)],A1\n"
648                 "       nop\n", },
david
1.8
649 OPLTYPE,      INAREG,
650         SCON,           TANY,
651         SNAME,          TCHAR,
652                 NAREG,  RESC1,
653                 "       sethi %h44(AL),A1\t\t! load const int8 to reg\n"
654                 "       or A1,%m44(AL),A1\n"
655                 "       sllx A1,12,A1\n"
david
1.13
656                 "       ldsb [A1+%l44(AL)],A1\n"
657                 "       nop\n", },
david
1.8
658 OPLTYPE,      INAREG,
659         SCON,           TANY,
660         SNAME,          TUCHAR,
661                 NAREG,  RESC1,
662                 "       sethi %h44(AL),A1\t! load const uint8 to reg\n"
663                 "       or A1,%m44(AL),A1\n"
664                 "       sllx A1,12,A1\n"
david
1.13
665                 "       ldub [A1+%l44(AL)],A1\n"
666                 "       nop\n", },
david
1.8
667
david
1.20
668 OPLTYPE,      INBREG,
david
1.21
669         SBREG,  TANY,
670         SNAME,  TANY,
david
1.22
671                 NAREG|NBREG,    RESC2,
david
1.25
672                 "       sethi %h44(AL),A1\t\t! load const to fp reg\n"
david
1.22
673                 "       or A1,%m44(AL),A1\n"
674                 "       sllx A1,12,A1\n"
675                 "       ld [A1+%l44(AL)],A2\n"
david
1.21
676                 "       nop\n", },
677
678 OPLTYPE,      INCREG,
david
1.22
679         SCREG,  TANY,
david
1.20
680         SNAME,  TANY,
david
1.22
681                 NAREG|NCREG,    RESC2,
david
1.25
682                 "       sethi %h44(AL),A1\t\t! load const to fp reg\n"
david
1.22
683                 "       or A1,%m44(AL),A1\n"
684                 "       sllx A1,12,A1\n"
685                 "       ldd [A1+%l44(AL)],A2\n"
david
1.21
686                 "       nop\n", },
david
1.20
687
david
1.8
688 OPLTYPE,      INAREG,
689         SANY,   TANY,
690         SCON,   TANY,
david
1.17
691                 (2*NAREG),      RESC1,
david
1.15
692                 "ZC" },
david
1.8
693
david
1.1
694 /* Convert LTYPE to reg. */
695
696 OPLTYPE,      INAREG,
david
1.12
697         SAREG,  TANY,
698         SOREG,  TCHAR,
david
1.1
699                 NAREG,  RESC1,
700                 "       ldsb [AL],A1            ! load int8 to reg\n"
701                 "       nop\n", },
david
1.20
702
david
1.1
703 OPLTYPE,      INAREG,
david
1.12
704         SAREG,  TANY,
705         SOREG,  TUCHAR,
david
1.1
706                 NAREG,  RESC1,
707                 "       ldub [AL],A1            ! load uint8 to reg\n"
708                 "       nop\n", },
709
710 OPLTYPE,      INAREG,
david
1.12
711         SAREG,  TANY,
712         SOREG,  TSHORT,
david
1.1
713                 NAREG,  RESC1,
714                 "       ldsh [AL],A1            ! load int16 to reg\n"
715                 "       nop\n", },
716
717 OPLTYPE,      INAREG,
david
1.12
718         SAREG,  TANY,
719         SOREG,  TUSHORT,
david
1.1
720                 NAREG,  RESC1,
721                 "       lduh [AL],A1            ! load uint16 to reg\n"
722                 "       nop\n", },
723
724 OPLTYPE,      INAREG,
david
1.12
725         SAREG,  TANY,
david
1.14
726         SOREG,  TINT,
david
1.1
727                 NAREG,  RESC1,
728                 "       ldsw [AL],A1            ! load int32 to reg\n"
729                 "       nop\n", },
730
731 OPLTYPE,      INAREG,
david
1.12
732         SAREG,  TANY,
david
1.14
733         SOREG,  TUNSIGNED,
david
1.1
734                 NAREG,  RESC1,
735                 "       lduw [AL],A1            ! load uint32 to reg\n"
736                 "       nop\n", },
737
738 OPLTYPE,      INAREG,
david
1.12
739         SAREG,  TANY,
david
1.14
740         SOREG,  T64,
david
1.1
741                 NAREG,  RESC1,
david
1.6
742                 "       ldx [AL],A1             ! load (u)int64 to reg\n"
david
1.1
743                 "       nop\n", },
744
745 OPLTYPE,      INAREG,
746         SANY,   TANY,
747         SZERO,  TANY,
748                 NAREG,  RESC1,
david
1.8
749                 "       mov \%g0,A1\t           ! load 0 to reg\n", },
david
1.4
750
david
1.19
751 OPLTYPE,      INBREG,
752         SBREG,  TFLOAT,
753         SOREG,  TFLOAT,
754                 NBREG,  RESC1,
755                 "       ld [AL],A1              ! load float to reg\n"
756                 "       nop\n", },
757
758 OPLTYPE,      INCREG,
759         SCREG,  TDOUBLE,
760         SOREG,  TDOUBLE,
761                 NCREG,  RESC1,
762                 "       ldd [AL],A1             ! load double to reg\n"
763                 "       nop\n", },
david
1.1
764
765 /* Jumps. */
766
767 GOTO,         FOREFF,
768         SCON,   TANY,
769         SANY,   TANY,
770                 0,      RNOP,
david
1.7
771                 "       call LL                 ! goto LL\n"
david
1.3
772                 "       nop\n", },
david
1.1
773
774 UCALL,        FOREFF,
775         SCON,           TANY,
776         SANY,           TANY,
777                 0,      0,
778                 "       call CL                 ! void CL()\n"
779                 "       nop\n", },
780
781 UCALL,         INAREG,
782         SCON,           TANY,
783         SAREG,          TANY,
784                 NAREG,     RESC1,
785                 "       call CL                 ! = CL()\n"
786                 "       nop\n", },
787
788 CALL,         FOREFF,
789         SCON,           TANY,
790         SANY,           TANY,
791                 0,      0,
792                 "       call CL                 ! void CL(constant)\n"
793                 "       nop\n", },
794
david
1.2
795 CALL,         INAREG,
david
1.1
796         SCON,           TANY,
797         SAREG,          TANY,
798                 NAREG,          RESC1,
799                 "       call CL                 ! = CL(constant)\n"
800                 "       nop\n", },
801
david
1.24
802 CALL,         INBREG,
803         SCON,           TANY,
804         SBREG,          TFLOAT,
805                 NBREG,          RESC1,
806                 "       call CL                 ! = CL(constant)\n"
807                 "       nop\n", },
808
david
1.25
809 CALL,         INCREG,
810         SCON,           TANY,
811         SCREG,          TDOUBLE,
812                 NCREG,          RESC1,
813                 "       call CL                 ! = CL(constant)\n"
814                 "       nop\n", },
815
david
1.10
816 CALL,         INAREG,
817         SAREG,          TANY,
818         SAREG,          TANY,
819                 NAREG,     RESC1,
820                 "       call AL                 ! = AL(args)\n"
821                 "       nop\n", },
822
david
1.1
823 CALL,         FOREFF,
824         SAREG,          TANY,
825         SANY,           TANY,
david
1.11
826                 0,              0,
david
1.10
827                 "       call AL                 ! void AL(args)\n"
828                 "       nop\n", },
829
830 UCALL,        FOREFF,
831         SAREG,          TANY,
832         SANY,           TANY,
david
1.1
833                 0,      0,
david
1.10
834                 "       call AL                 ! (*AL)()\n"
835                 "       nop\n", },
836
837 UCALL,        INAREG,
838         SAREG,          TANY,
839         SAREG,          TANY,
840                 NAREG,          RESC1,
841                 "       call AL                 ! = (*AL)()\n"
david
1.1
842                 "       nop\n", },
843
david
1.10
844 CALL,         INAREG,
845         SAREG,          TANY,
846         SAREG,          TANY,
847                 NAREG,          RESC1,
848                 "       call AL                 ! = (*AL)(args)\n"
david
1.1
849                 "       nop\n", },
850
david
1.18
851 /* Function arguments. */
852
853 FUNARG,       FOREFF,
854         SAREG,  T64,
855         SANY,   TANY,
856                 0,      0,
857                 "       stx AL,[%sp+AR]         \t! save func arg to stack\n"
858                 "       nop\n", },
859
860 FUNARG,       FOREFF,
861         SAREG,  TINT|TUNSIGNED,
862         SANY,   TANY,
863                 0,      0,
864                 "       stw AL,[%sp+AR]         \t! save func arg to stack\n"
865                 "       nop\n", },
866
867 FUNARG,       FOREFF,
868         SAREG,  TSHORT|TUSHORT,
869         SANY,   TANY,
870                 0,      0,
871                 "       sth AL,[%sp+AR]         \t! save func arg to stack\n"
872                 "       nop\n", },
873
874 FUNARG,       FOREFF,
875         SAREG,  TCHAR|TUCHAR,
876         SANY,   TANY,
877                 0,      0,
878                 "       stb AL,[%sp+AR]         \t! save func arg to stack\n"
879                 "       nop\n", },
880
david
1.24
881 FUNARG,       FOREFF,
882         SBREG,  TFLOAT,
883         SANY,   TANY,
884                 0,      0,
885                 "       st AL,[%sp+AR]          \t! save func arg to stack\n"
886                 "       nop\n", },
887
888 FUNARG,       FOREFF,
889         SCREG,  TDOUBLE,
890         SANY,   TANY,
891                 0,      0,
892                 "       std AL,[%sp+AR]         \t! save func arg to stack\n"
893                 "       nop\n", },
894
david
1.10
895
david
1.6
896 /* Indirection. */
897
898 OPSIMP,       INAREG,
899         SAREG,  TANY,
900         SAREG,  TANY,
901                 NAREG|NASR|NASL,        RESC1,
902                 "       O AL,AR,A1\n", },
903
904 UMULINAREG,
ragge
1.27
905         SAREG,  T64,
david
1.14
906         SOREG,  T64,
david
1.6
907                 NAREG,          RESC1,
908                 "       ldx [AL],A1             ! (u)int64 load\n"
909                 "       nop\n", },
910 UMULINAREG,
ragge
1.27
911         SAREG,  TINT,
david
1.14
912         SOREG,  TINT,
david
1.6
913                 NAREG,          RESC1,
914                 "       ldsw [AL],A1            ! int32 load\n"
915                 "       nop\n", },
916 UMULINAREG,
ragge
1.27
917         SAREG,  TUNSIGNED,
david
1.14
918         SOREG,  TUNSIGNED,
david
1.6
919                 NAREG,          RESC1,
920                 "       lduw [AL],A1            ! uint32 load\n"
921                 "       nop\n", },
922 UMULINAREG,
ragge
1.27
923         SAREG,  TCHAR,
david
1.6
924         SOREG,  TCHAR,
925                 NAREG,          RESC1,
926                 "       ldsb [AL],A1            ! int8 load\n"
927                 "       nop\n", },
928 UMULINAREG,
ragge
1.27
929         SAREG,  TUCHAR,
david
1.6
930         SOREG,  TUCHAR,
931                 NAREG,          RESC1,
932                 "       ldub [AL],A1            ! uint8 load\n"
933                 "       nop\n", },
934 UMULINAREG,
ragge
1.27
935         SAREG,  TSHORT,
david
1.6
936         SOREG,  TSHORT,
937                 NAREG,          RESC1,
938                 "       ldsh [AL],A1            ! int16 load\n"
939                 "       nop\n", },
940 UMULINAREG,
ragge
1.27
941         SAREG,  TUSHORT,
david
1.6
942         SOREG,  TUSHORT,
943                 NAREG,          RESC1,
944                 "       lduh [AL],A1            ! uint16 load\n"
945                 "       nop\n", },
946
david
1.19
947 UMULINBREG,
ragge
1.27
948         SAREG,  TFLOAT,
david
1.19
949         SOREG,  TFLOAT,
950                 NBREG,          RESC1,
951                 "       ld [AL],A1              ! load float\n"
952                 "       nop\n", },
953
954 UMULINCREG,
ragge
1.27
955         SAREG,  TDOUBLE,
david
1.19
956         SOREG,  TDOUBLE,
957                 NCREG,          RESC1,
958                 "       ldd [AL],A1             ! load double\n"
959                 "       nop\n", },
960
david
1.1
961 FREE,FREE,FREE,FREE,FREE,FREE,FREE,FREE"ERR: printing free op\n" },
962
963 };
964
965 int tablesize = sizeof(table)/sizeof(table[0]);
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-11-01 08:00 +0100