sparc: specifying ins in constructor variants makes no sense
[libfirm] / ir / be / sparc / sparc_spec.pl
1 # Creation: 2006/02/13
2 # $Id$
3
4 $arch = "sparc";
5
6 $mode_gp      = "mode_Iu";
7 $mode_flags   = "mode_Bu";
8 $mode_fpflags = "mode_Bu";
9 $mode_fp      = "mode_F";
10 $mode_fp2     = "mode_D";
11 $mode_fp4     = "mode_E"; # not correct, we need to register a new mode
12
13 $normal      =  0; # no special type
14 $caller_save =  1; # caller save (register must be saved by the caller of a function)
15 $callee_save =  2; # callee save (register must be saved by the called function)
16 $ignore      =  4; # ignore (do not assign this register)
17 $arbitrary   =  8; # emitter can choose an arbitrary register of this class
18 $virtual     = 16; # the register is a virtual one
19 $state       = 32; # register represents a state
20
21 # available SPARC registers: 8 globals, 24 window regs (8 ins, 8 outs, 8 locals)
22 %reg_classes = (
23         gp => [
24                 { name => "g0", type => $ignore }, # hardwired 0, behaves like /dev/null
25                 { name => "g1", type => $caller_save }, # temp. value
26                 { name => "g2", type => $caller_save },
27                 { name => "g3", type => $caller_save },
28                 { name => "g4", type => $caller_save },
29                 { name => "g5", type => $ignore }, # reserved by SPARC ABI
30                 { name => "g6", type => $ignore }, # reserved by SPARC ABI
31                 { name => "g7", type => $ignore }, # reserved by SPARC ABI
32
33                 # window's out registers
34                 { name => "o0", type => $caller_save }, # param 1 / return value from callee
35                 { name => "o1", type => $caller_save }, # param 2
36                 { name => "o2", type => $caller_save }, # param 3
37                 { name => "o3", type => $caller_save }, # param 4
38                 { name => "o4", type => $caller_save }, # param 5
39                 { name => "o5", type => $caller_save }, # param 6
40                 { name => "sp", type => $ignore }, # our stackpointer
41                 { name => "o7", type => $ignore }, # temp. value / address of CALL instr.
42
43                 # window's local registers
44                 { name => "l0", type => 0 },
45                 { name => "l1", type => 0 },
46                 { name => "l2", type => 0 },
47                 { name => "l3", type => 0 },
48                 { name => "l4", type => 0 },
49                 { name => "l5", type => 0 },
50                 { name => "l6", type => 0 },
51                 { name => "l7", type => 0 },
52
53                 # window's in registers
54                 { name => "i0", type => 0 }, # incoming param1 / return value to caller
55                 { name => "i1", type => 0 }, # param 2
56                 { name => "i2", type => 0 }, # param 3
57                 { name => "i3", type => 0 }, # param 4
58                 { name => "i4", type => 0 }, # param 5
59                 { name => "i5", type => 0 }, # param 6
60                 { name => "frame_pointer", realname => "fp", type => $ignore }, # our framepointer
61                 { name => "i7", type => $ignore }, # return address - 8
62                 { mode => $mode_gp }
63         ],
64         fpflags_class => [
65                 { name => "fpflags", type => $ignore },
66                 { mode => $mode_fpflags, flags => "manual_ra" }
67         ],
68         flags_class => [
69                 { name => "flags", type => $ignore },
70                 { mode => $mode_flags, flags => "manual_ra" }
71         ],
72         mul_div_high_res => [
73                 { name => "y", type => $ignore },
74                 { mode => $mode_gp, flags => "manual_ra" }
75         ],
76         # fp registers can be accessed any time
77         fp => [
78                 { name => "f0",  type => $caller_save },
79                 { name => "f1",  type => $caller_save },
80                 { name => "f2",  type => $caller_save },
81                 { name => "f3",  type => $caller_save },
82                 { name => "f4",  type => $caller_save },
83                 { name => "f5",  type => $caller_save },
84                 { name => "f6",  type => $caller_save },
85                 { name => "f7",  type => $caller_save },
86                 { name => "f8",  type => $caller_save },
87                 { name => "f9",  type => $caller_save },
88                 { name => "f10", type => $caller_save },
89                 { name => "f11", type => $caller_save },
90                 { name => "f12", type => $caller_save },
91                 { name => "f13", type => $caller_save },
92                 { name => "f14", type => $caller_save },
93                 { name => "f15", type => $caller_save },
94                 { name => "f16", type => $caller_save },
95                 { name => "f17", type => $caller_save },
96                 { name => "f18", type => $caller_save },
97                 { name => "f19", type => $caller_save },
98                 { name => "f20", type => $caller_save },
99                 { name => "f21", type => $caller_save },
100                 { name => "f22", type => $caller_save },
101                 { name => "f23", type => $caller_save },
102                 { name => "f24", type => $caller_save },
103                 { name => "f25", type => $caller_save },
104                 { name => "f26", type => $caller_save },
105                 { name => "f27", type => $caller_save },
106                 { name => "f28", type => $caller_save },
107                 { name => "f29", type => $caller_save },
108                 { name => "f30", type => $caller_save },
109                 { name => "f31", type => $caller_save },
110                 { mode => $mode_fp }
111         ]
112 ); # %reg_classes
113
114 %emit_templates = (
115 # emit source reg or imm dep. on node's arity
116         RI  => "${arch}_emit_reg_or_imm(node, -1);",
117         R1I => "${arch}_emit_reg_or_imm(node, 0);",
118         R2I => "${arch}_emit_reg_or_imm(node, 1);",
119         R3I => "${arch}_emit_reg_or_imm(node, 2);",
120         S1  => "${arch}_emit_source_register(node, 0);",
121         S2  => "${arch}_emit_source_register(node, 1);",
122         S3  => "${arch}_emit_source_register(node, 2);",
123         S4  => "${arch}_emit_source_register(node, 3);",
124         S5  => "${arch}_emit_source_register(node, 4);",
125         S6  => "${arch}_emit_source_register(node, 5);",
126         D1  => "${arch}_emit_dest_register(node, 0);",
127         D2  => "${arch}_emit_dest_register(node, 1);",
128         D3  => "${arch}_emit_dest_register(node, 2);",
129         D4  => "${arch}_emit_dest_register(node, 3);",
130         D5  => "${arch}_emit_dest_register(node, 4);",
131         D6  => "${arch}_emit_dest_register(node, 5);",
132         IM  => "${arch}_emit_immediate(node);",
133         HIM => "${arch}_emit_high_immediate(node);",
134         LM  => "${arch}_emit_load_mode(node);",
135         SM  => "${arch}_emit_store_mode(node);",
136         FLSM => "${arch}_emit_float_load_store_mode(node);",
137         FPM  => "${arch}_emit_fp_mode_suffix(node);",
138         FCONVS => "${arch}_emit_fp_conv_source(node);",
139         FCONVD => "${arch}_emit_fp_conv_destination(node);",
140         O      => "${arch}_emit_offset(node);",
141 );
142
143 $default_attr_type = "sparc_attr_t";
144 $default_copy_attr = "sparc_copy_attr";
145
146
147 %init_attr = (
148         sparc_attr_t             => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
149         sparc_load_store_attr_t  => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
150                                     "\tinit_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity);",
151         sparc_jmp_cond_attr_t    => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
152         sparc_jmp_switch_attr_t  => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
153         sparc_save_attr_t        => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
154         sparc_fp_attr_t          => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
155                                     "\tinit_sparc_fp_attributes(res, fp_mode);\n",
156         sparc_fp_conv_attr_t     => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);".
157                                     "\tinit_sparc_fp_conv_attributes(res, src_mode, dest_mode);\n",
158 );
159
160 %compare_attr = (
161         sparc_attr_t            => "cmp_attr_sparc",
162         sparc_load_store_attr_t => "cmp_attr_sparc_load_store",
163         sparc_jmp_cond_attr_t   => "cmp_attr_sparc_jmp_cond",
164         sparc_jmp_switch_attr_t => "cmp_attr_sparc_jmp_switch",
165         sparc_save_attr_t       => "cmp_attr_sparc_save",
166         sparc_fp_attr_t         => "cmp_attr_sparc_fp",
167         sparc_fp_conv_attr_t    => "cmp_attr_sparc_fp_conv",
168 );
169
170 %custom_irn_flags = (
171         modifies_flags    => "sparc_arch_irn_flag_modifies_flags",
172         modifies_fp_flags => "sparc_arch_irn_flag_modifies_fp_flags",
173 );
174
175 # addressing modes: imm, reg, reg +/- imm, reg + reg
176 # max. imm = 13 bits signed (-4096 ... 4096)
177
178 my %cmp_operand_constructors = (
179         imm => {
180                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
181                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
182                 reg_req    => { in => [ "gp" ], out => [ "flags" ] },
183                 ins        => [ "left" ],
184         },
185         reg => {
186                 reg_req    => { in => [ "gp", "gp" ], out => [ "flags" ] },
187                 ins        => [ "left", "right" ],
188         },
189 );
190
191 my %unop_operand_constructors = (
192         imm => {
193                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
194                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
195                 reg_req    => { in => [], out => [ "gp" ] },
196         },
197         reg => {
198                 reg_req    => { in => [ "gp" ], out => [ "gp" ] },
199         },
200 );
201
202 my %binop_operand_constructors = (
203         imm => {
204                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
205                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
206                 reg_req    => { in => [ "gp" ], out => [ "gp" ] },
207                 ins        => [ "left" ],
208         },
209         reg => {
210                 reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
211                 ins        => [ "left", "right" ],
212         },
213 );
214
215 my %div_operand_constructors = (
216         imm => {
217                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
218                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
219                 reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
220         },
221         reg => {
222                 reg_req    => { in => [ "gp", "gp", "gp" ], out => [ "gp" ] },
223         },
224 );
225
226 my %float_binop_constructors = (
227         s => {
228                 reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
229                 mode    => $mode_fp,
230         },
231         d => {
232                 reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fp:a|2" ] },
233                 mode    => $mode_fp2,
234         },
235         q => {
236                 reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fp:a|4" ] },
237                 mode    => $mode_fp4,
238         }
239 );
240
241 my %float_unop_constructors = (
242         s => {
243                 reg_req => { in => [ "fp" ], out => [ "fp" ] },
244                 mode    => $mode_fp,
245         },
246         d => {
247                 reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|2" ] },
248                 mode    => $mode_fp2,
249         },
250         q => {
251                 reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|4" ] },
252                 mode    => $mode_fp4,
253         }
254 );
255
256 %nodes = (
257
258 Add => {
259         irn_flags    => [ "rematerializable" ],
260         mode         => $mode_gp,
261         emit         => '. add %S1, %R2I, %D1',
262         constructors => \%binop_operand_constructors,
263 },
264
265 Sub => {
266         irn_flags    => [ "rematerializable" ],
267         mode         => $mode_gp,
268         emit         => '. sub %S1, %R2I, %D1',
269         constructors => \%binop_operand_constructors,
270 },
271
272
273 # Load / Store
274 Ld => {
275         op_flags  => [ "labeled", "fragile" ],
276         state     => "exc_pinned",
277         constructors => {
278                 "" => {
279                         reg_req   => { in => [ "gp", "none" ], out => [ "gp", "none" ] },
280                 },
281                 d => {
282                         reg_req => { in => [ "gp", "none" ], out => [ "gp:a|2", "none" ] },
283                 },
284         },
285         outs      => [ "res", "M" ],
286         ins       => [ "ptr", "mem" ],
287         attr_type => "sparc_load_store_attr_t",
288         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
289         emit      => '. ld%LM [%S1%O], %D1'
290 },
291
292 SetHi => {
293         irn_flags  => [ "rematerializable" ],
294         outs       => [ "res" ],
295         mode       => $mode_gp,
296         reg_req    => { in => [], out => [ "gp" ] },
297         attr       => "ir_entity *entity, int32_t immediate_value",
298         custominit => "sparc_set_attr_imm(res, entity, immediate_value);",
299         emit       => '. sethi %HIM, %D1'
300 },
301
302 St => {
303         op_flags  => [ "labeled", "fragile" ],
304         mode      => "mode_M",
305         state     => "exc_pinned",
306         constructors => {
307                 "" => {
308                         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
309                 },
310                 d => {
311                         reg_req   => { in => [ "gp", "gp:a|2", "none" ], out => [ "none" ] },
312                 },
313         },
314         ins       => [ "ptr", "val", "mem" ],
315         outs      => [ "M" ],
316         attr_type => "sparc_load_store_attr_t",
317         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
318         emit      => '. st%SM %S2, [%S1%O]'
319 },
320
321 Save => {
322         reg_req   => {
323                 in => [ "sp", "none"],
324                 out => [ "sp:I|S", "frame_pointer:I", "none" ]
325         },
326         ins       => [ "stack", "mem" ],
327         outs      => [ "stack", "frame", "mem" ],
328         attr      => "int initial_stacksize",
329         attr_type => "sparc_save_attr_t",
330         init_attr => "\tinit_sparc_save_attributes(res, initial_stacksize);",
331 },
332
333 SubSP => {
334         reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "gp", "none" ] },
335         ins       => [ "stack", "size", "mem" ],
336         outs      => [ "stack", "addr", "M" ],
337         emit      => ". sub %S1, %S2, %D1\n",
338 },
339
340 AddSP => {
341         reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "none" ] },
342         ins       => [ "stack", "size", "mem" ],
343         outs      => [ "stack", "M" ],
344         emit      => ". add %S1, %S2, %D1\n",
345 },
346
347 FrameAddr => {
348         op_flags   => [ "constlike" ],
349         irn_flags  => [ "rematerializable" ],
350         attr       => "ir_entity *entity, int32_t offset",
351         reg_req    => { in => [ "gp" ], out => [ "gp" ] },
352         ins        => [ "base" ],
353         attr_type  => "sparc_attr_t",
354         custominit => "sparc_set_attr_imm(res, entity, offset);",
355         mode       => $mode_gp,
356 },
357
358 Bicc => {
359         op_flags  => [ "labeled", "cfopcode", "forking" ],
360         state     => "pinned",
361         mode      => "mode_T",
362         attr_type => "sparc_jmp_cond_attr_t",
363         attr      => "pn_Cmp pnc, bool is_unsigned",
364         init_attr => "\tinit_sparc_jmp_cond_attr(res, pnc, is_unsigned);",
365         reg_req   => { in => [ "flags" ], out => [ "none", "none" ] },
366 },
367
368 fbfcc => {
369         op_flags  => [ "labeled", "cfopcode", "forking" ],
370         state     => "pinned",
371         mode      => "mode_T",
372         attr_type => "sparc_jmp_cond_attr_t",
373         attr      => "pn_Cmp pnc",
374         init_attr => "\tinit_sparc_jmp_cond_attr(res, pnc, false);",
375         reg_req   => { in => [ "fpflags" ], out => [ "none", "none" ] },
376 },
377
378 Ba => {
379         state     => "pinned",
380         op_flags  => [ "cfopcode" ],
381         irn_flags => [ "simple_jump" ],
382         reg_req   => { out => [ "none" ] },
383         mode      => "mode_X",
384 },
385
386 Call => {
387         irn_flags => [ "modifies_flags", "modifies_fp_flags" ],
388         state     => "exc_pinned",
389         arity     => "variable",
390         out_arity => "variable",
391         constructors => {
392                 imm => {
393                         attr       => "ir_entity *entity, int32_t offset",
394                         custominit => "\tsparc_set_attr_imm(res, entity, offset);",
395                         arity     => "variable",
396                         out_arity => "variable",
397                 },
398                 reg => {
399                         arity     => "variable",
400                         out_arity => "variable",
401                 }
402         },
403 },
404
405 Cmp => {
406         irn_flags    => [ "rematerializable", "modifies_flags" ],
407         emit         => '. cmp %S1, %R2I',
408         ins          => [ "left", "right" ],
409         mode         => $mode_flags,
410         constructors => \%cmp_operand_constructors,
411 },
412
413 Tst => {
414         irn_flags    => [ "rematerializable", "modifies_flags" ],
415         emit         => '. tst %S1',
416         mode         => $mode_flags,
417         reg_req      => { in => [ "gp" ], out => [ "flags" ] },
418         ins          => [ "val" ],
419 },
420
421 SwitchJmp => {
422         op_flags  => [ "labeled", "cfopcode", "forking" ],
423         irn_flags => [ "modifies_flags" ],
424         state     => "pinned",
425         mode      => "mode_T",
426         attr      => "int n_projs, long def_proj_num",
427         init_attr => "\tset_sparc_jmp_switch_n_projs(res, n_projs);\n".
428                                         "\tset_sparc_jmp_switch_default_proj_num(res, def_proj_num);",
429         reg_req   => { in => [ "gp" ], out => [ "none" ] },
430         attr_type => "sparc_jmp_switch_attr_t",
431 },
432
433 Sll => {
434         irn_flags    => [ "rematerializable" ],
435         mode         => $mode_gp,
436         emit         => '. sll %S1, %R2I, %D1',
437         constructors => \%binop_operand_constructors,
438 },
439
440 Slr => {
441         irn_flags    => [ "rematerializable" ],
442         mode         => $mode_gp,
443         emit         => '. srl %S1, %R2I, %D1',
444         constructors => \%binop_operand_constructors,
445 },
446
447 Sra => {
448         irn_flags    => [ "rematerializable" ],
449         mode         => $mode_gp,
450         emit         => '. sra %S1, %R2I, %D1',
451         constructors => \%binop_operand_constructors,
452 },
453
454 And => {
455         irn_flags    => [ "rematerializable" ],
456         mode         => $mode_gp,
457         emit         => '. and %S1, %R2I, %D1',
458         constructors => \%binop_operand_constructors,
459 },
460
461 AndN => {
462         irn_flags => [ "rematerializable" ],
463         mode      => $mode_gp,
464         emit      => '. andn %S1, %R2I, %D1',
465         constructors => \%binop_operand_constructors,
466 },
467
468 Or => {
469         irn_flags    => [ "rematerializable" ],
470         mode         => $mode_gp,
471         emit         => '. or %S1, %R2I, %D1',
472         constructors => \%binop_operand_constructors,
473 },
474
475 OrN => {
476         irn_flags => [ "rematerializable" ],
477         mode      => $mode_gp,
478         emit      => '. orn %S1, %R2I, %D1',
479         constructors => \%binop_operand_constructors,
480 },
481
482 Xor => {
483         irn_flags    => [ "rematerializable" ],
484         mode         => $mode_gp,
485         emit         => '. xor %S1, %R2I, %D1',
486         constructors => \%binop_operand_constructors,
487 },
488
489 XNor => {
490         irn_flags => [ "rematerializable" ],
491         mode      => $mode_gp,
492         emit      => '. xnor %S1, %R2I, %D1',
493         constructors => \%binop_operand_constructors,
494 },
495
496 Mul => {
497         irn_flags    => [ "rematerializable" ],
498         mode         => $mode_gp,
499         emit         => '. smul %S1, %R2I, %D1',
500         constructors => \%binop_operand_constructors,
501 },
502
503 Mulh => {
504         irn_flags    => [ "rematerializable" ],
505         outs         => [ "low", "high" ],
506         constructors => \%binop_operand_constructors,
507 },
508
509 SDiv => {
510         irn_flags    => [ "rematerializable" ],
511         state        => "exc_pinned",
512         ins          => [ "dividend_high", "dividend_low", "divisor" ],
513         outs         => [ "res", "M" ],
514         constructors => \%div_operand_constructors,
515 },
516
517 UDiv => {
518         irn_flags    => [ "rematerializable" ],
519         state        => "exc_pinned",
520         ins          => [ "dividend_high", "dividend_low", "divisor" ],
521         outs         => [ "res", "M" ],
522         constructors => \%div_operand_constructors,
523 },
524
525 fcmp => {
526         irn_flags => [ "rematerializable", "modifies_fp_flags" ],
527         emit      => '. fcmp%FPM %S1, %S2',
528         attr_type => "sparc_fp_attr_t",
529         attr      => "ir_mode *fp_mode",
530         mode      => $mode_fpflags,
531         constructors => {
532                 s => {
533                         reg_req => { in => [ "fp", "fp" ], out => [ "fpflags" ] },
534                 },
535                 d => {
536                         reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fpflags" ] },
537                 },
538                 q => {
539                         reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fpflags" ] },
540                 },
541         },
542 },
543
544 fadd => {
545         op_flags     => [ "commutative" ],
546         irn_flags    => [ "rematerializable" ],
547         emit         => '. fadd%FPM %S1, %S2, %D1',
548         attr_type    => "sparc_fp_attr_t",
549         attr         => "ir_mode *fp_mode",
550         ins          => [ "left", "right" ],
551         constructors => \%float_binop_constructors,
552 },
553
554 fsub => {
555         irn_flags    => [ "rematerializable" ],
556         emit         => '. fsub%FPM %S1, %S2, %D1',
557         attr_type    => "sparc_fp_attr_t",
558         attr         => "ir_mode *fp_mode",
559         ins          => [ "left", "right" ],
560         constructors => \%float_binop_constructors,
561 },
562
563 fmul => {
564         irn_flags    => [ "rematerializable" ],
565         op_flags     => [ "commutative" ],
566         emit         =>'. fmul%FPM %S1, %S2, %D1',
567         attr_type    => "sparc_fp_attr_t",
568         attr         => "ir_mode *fp_mode",
569         ins          => [ "left", "right" ],
570         constructors => \%float_binop_constructors,
571 },
572
573 fdiv => {
574         irn_flags    => [ "rematerializable" ],
575         emit         => '. fdiv%FPM %S1, %S2, %D1',
576         attr_type    => "sparc_fp_attr_t",
577         attr         => "ir_mode *fp_mode",
578         ins          => [ "left", "right" ],
579         outs         => [ "res", "M" ],
580         constructors => \%float_binop_constructors,
581 },
582
583 fneg => {
584         irn_flags => [ "rematerializable" ],
585         reg_req   => { in => [ "fp" ], out => [ "fp" ] },
586         # note that we only need the first register even for wide-values
587         emit      => '. fneg %S1, %D1',
588         attr_type => "sparc_fp_attr_t",
589         attr      => "ir_mode *fp_mode",
590         ins          => [ "val" ],
591         constructors => \%float_unop_constructors,
592 },
593
594 "fabs" => {
595         irn_flags    => [ "rematerializable" ],
596         # note that we only need the first register even for wide-values
597         emit         => '. fabs %S1, %D1',
598         attr_type    => "sparc_fp_attr_t",
599         attr         => "ir_mode *fp_mode",
600         ins          => [ "val" ],
601         constructors => \%float_unop_constructors,
602 },
603
604 fftof => {
605         irn_flags => [ "rematerializable" ],
606         emit      => '. f%FCONVS%.to%FCONVD %S1, %D1',
607         attr_type => "sparc_fp_conv_attr_t",
608         attr      => "ir_mode *src_mode, ir_mode *dest_mode",
609         constructors => {
610                 s_d => {
611                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
612                         mode    => $mode_fp2,
613                 },
614                 s_q => {
615                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
616                         mode    => $mode_fp4,
617                 },
618                 d_s => {
619                         reg_req => { in => [ "fp:a|2" ], out => [ "fp" ] },
620                         mode    => $mode_fp,
621                 },
622                 d_q => {
623                         reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|4" ] },
624                         mode    => $mode_fp4,
625                 },
626                 q_s => {
627                         reg_req => { in => [ "fp:a|4" ], out => [ "fp" ] },
628                         mode    => $mode_fp,
629                 },
630                 q_d => {
631                         reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|2" ] },
632                         mode    => $mode_fp2,
633                 },
634         },
635 },
636
637 fitof => {
638         irn_flags => [ "rematerializable" ],
639         reg_req   => { in => [ "gp" ], out => [ "fp" ] },
640         emit      => '. fito%FPM %S1, %D1',
641         attr_type => "sparc_fp_attr_t",
642         attr      => "ir_mode *fp_mode",
643         constructors => {
644                 s => {
645                         reg_req => { in => [ "gp" ], out => [ "fp" ] },
646                         mode    => $mode_fp,
647                 },
648                 d => {
649                         reg_req => { in => [ "gp" ], out => [ "fp:a|2" ] },
650                         mode    => $mode_fp2,
651                 },
652                 q => {
653                         reg_req => { in => [ "gp" ], out => [ "fp:a|4" ] },
654                         mode    => $mode_fp4,
655                 },
656         },
657 },
658
659 fftoi => {
660         irn_flags => [ "rematerializable" ],
661         reg_req   => { in => [ "fp" ], out => [ "gp" ] },
662         emit      => '. f%FPM.toi %S1, %D1',
663         attr_type => "sparc_fp_attr_t",
664         attr      => "ir_mode *fp_mode",
665         mode      => $mode_gp,
666         constructors => {
667                 s => {
668                         reg_req => { in => [ "gp" ], out => [ "gp" ] },
669                 },
670                 d => {
671                         reg_req => { in => [ "fp:a|2" ], out => [ "gp" ] },
672                 },
673                 q => {
674                         reg_req => { in => [ "fp:a|4" ], out => [ "gp" ] },
675                 },
676         },
677 },
678
679 Ldf => {
680         op_flags  => [ "labeled", "fragile" ],
681         state     => "exc_pinned",
682         constructors => {
683                 s => {
684                         reg_req => { in => [ "gp", "none" ], out => [ "fp", "none" ] },
685                 },
686                 d => {
687                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|2", "none" ] },
688                 },
689                 q => {
690                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|4", "none" ] },
691                 },
692         },
693         ins       => [ "ptr", "mem" ],
694         outs      => [ "res", "M" ],
695         attr_type => "sparc_load_store_attr_t",
696         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
697         emit      => '. ld%FLSM [%S1%O], %D1'
698 },
699
700 Stf => {
701         op_flags  => [ "labeled", "fragile" ],
702         state     => "exc_pinned",
703         constructors => {
704                 s => {
705                         reg_req => { in => [ "gp", "fp", "none" ], out => [ "none" ] },
706                 },
707                 d => {
708                         reg_req => { in => [ "gp", "fp:a|2", "none" ], out => [ "none" ] },
709                 },
710                 q => {
711                         reg_req => { in => [ "gp", "fp:a|4", "none" ], out => [ "none" ] },
712                 },
713         },
714         ins       => [ "ptr", "val", "mem" ],
715         outs      => [ "M" ],
716         attr_type => "sparc_load_store_attr_t",
717         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
718         emit      => '. st%FLSM %S2, [%S1%O]',
719         mode      => 'mode_M',
720 },
721
722 ); # end of %nodes