sparc: rewrite address mode matching, we now use offsets for load/store nodes and...
[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 %float_binop_constructors = (
216         s => {
217                 reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
218                 ins     => [ "left", "right" ],
219                 mode    => $mode_fp,
220         },
221         d => {
222                 reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fp:a|2" ] },
223                 ins     => [ "left", "right" ],
224                 mode    => $mode_fp2,
225         },
226         q => {
227                 reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fp:a|4" ] },
228                 ins     => [ "left", "right" ],
229                 mode    => $mode_fp4,
230         }
231 );
232
233 my %float_unop_constructors = (
234         s => {
235                 reg_req => { in => [ "fp" ], out => [ "fp" ] },
236                 ins     => [ "left", "right" ],
237                 mode    => $mode_fp,
238         },
239         d => {
240                 reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|2" ] },
241                 ins     => [ "left", "right" ],
242                 mode    => $mode_fp2,
243         },
244         q => {
245                 reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|4" ] },
246                 ins     => [ "left", "right" ],
247                 mode    => $mode_fp4,
248         }
249 );
250
251 %nodes = (
252
253 Add => {
254         irn_flags    => [ "rematerializable" ],
255         mode         => $mode_gp,
256         emit         => '. add %S1, %R2I, %D1',
257         constructors => \%binop_operand_constructors,
258 },
259
260 Sub => {
261         irn_flags    => [ "rematerializable" ],
262         mode         => $mode_gp,
263         emit         => '. sub %S1, %R2I, %D1',
264         constructors => \%binop_operand_constructors,
265 },
266
267
268 # Load / Store
269 Ld => {
270         op_flags  => [ "labeled", "fragile" ],
271         state     => "exc_pinned",
272         constructors => {
273                 "" => {
274                         reg_req   => { in => [ "gp", "none" ], out => [ "gp", "none" ] },
275                 },
276                 d => {
277                         reg_req => { in => [ "gp", "none" ], out => [ "gp:a|2", "none" ] },
278                 },
279         },
280         outs      => [ "res", "M" ],
281         ins       => [ "ptr", "mem" ],
282         attr_type => "sparc_load_store_attr_t",
283         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
284         emit      => '. ld%LM [%S1%O], %D1'
285 },
286
287 SetHi => {
288         irn_flags  => [ "rematerializable" ],
289         outs       => [ "res" ],
290         mode       => $mode_gp,
291         reg_req    => { in => [], out => [ "gp" ] },
292         attr       => "ir_entity *entity, int32_t immediate_value",
293         custominit => "sparc_set_attr_imm(res, entity, immediate_value);",
294         emit       => '. sethi %HIM, %D1'
295 },
296
297 St => {
298         op_flags  => [ "labeled", "fragile" ],
299         mode      => "mode_M",
300         state     => "exc_pinned",
301         constructors => {
302                 "" => {
303                         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
304                 },
305                 d => {
306                         reg_req   => { in => [ "gp", "gp:a|2", "none" ], out => [ "none" ] },
307                 },
308         },
309         ins       => [ "ptr", "val", "mem" ],
310         outs      => [ "M" ],
311         attr_type => "sparc_load_store_attr_t",
312         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
313         emit      => '. st%SM %S2, [%S1%O]'
314 },
315
316 Save => {
317         reg_req   => {
318                 in => [ "sp", "none"],
319                 out => [ "sp:I|S", "frame_pointer:I", "none" ]
320         },
321         ins       => [ "stack", "mem" ],
322         outs      => [ "stack", "frame", "mem" ],
323         attr      => "int initial_stacksize",
324         attr_type => "sparc_save_attr_t",
325         init_attr => "\tinit_sparc_save_attributes(res, initial_stacksize);",
326 },
327
328 SubSP => {
329         reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "gp", "none" ] },
330         ins       => [ "stack", "size", "mem" ],
331         outs      => [ "stack", "addr", "M" ],
332         emit      => ". sub %S1, %S2, %D1\n",
333 },
334
335 AddSP => {
336         reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "none" ] },
337         ins       => [ "stack", "size", "mem" ],
338         outs      => [ "stack", "M" ],
339         emit      => ". add %S1, %S2, %D1\n",
340 },
341
342 FrameAddr => {
343         op_flags   => [ "constlike" ],
344         irn_flags  => [ "rematerializable" ],
345         attr       => "ir_entity *entity, int32_t offset",
346         reg_req    => { in => [ "gp" ], out => [ "gp" ] },
347         ins        => [ "base" ],
348         attr_type  => "sparc_attr_t",
349         custominit => "sparc_set_attr_imm(res, entity, offset);",
350         mode       => $mode_gp,
351 },
352
353 Bicc => {
354         op_flags  => [ "labeled", "cfopcode", "forking" ],
355         state     => "pinned",
356         mode      => "mode_T",
357         attr_type => "sparc_jmp_cond_attr_t",
358         attr      => "pn_Cmp pnc, bool is_unsigned",
359         init_attr => "\tinit_sparc_jmp_cond_attr(res, pnc, is_unsigned);",
360         reg_req   => { in => [ "flags" ], out => [ "none", "none" ] },
361 },
362
363 fbfcc => {
364         op_flags  => [ "labeled", "cfopcode", "forking" ],
365         state     => "pinned",
366         mode      => "mode_T",
367         attr_type => "sparc_jmp_cond_attr_t",
368         attr      => "pn_Cmp pnc",
369         init_attr => "\tinit_sparc_jmp_cond_attr(res, pnc, false);",
370         reg_req   => { in => [ "fpflags" ], out => [ "none", "none" ] },
371 },
372
373 Ba => {
374         state     => "pinned",
375         op_flags  => [ "cfopcode" ],
376         irn_flags => [ "simple_jump" ],
377         reg_req   => { out => [ "none" ] },
378         mode      => "mode_X",
379 },
380
381 Call => {
382         irn_flags => [ "modifies_flags", "modifies_fp_flags" ],
383         state     => "exc_pinned",
384         arity     => "variable",
385         out_arity => "variable",
386         constructors => {
387                 imm => {
388                         attr       => "ir_entity *entity, int32_t offset",
389                         custominit => "\tsparc_set_attr_imm(res, entity, offset);",
390                         arity     => "variable",
391                         out_arity => "variable",
392                 },
393                 reg => {
394                         arity     => "variable",
395                         out_arity => "variable",
396                 }
397         },
398 },
399
400 Cmp => {
401         irn_flags    => [ "rematerializable", "modifies_flags" ],
402         emit         => '. cmp %S1, %R2I',
403         ins          => [ "left", "right" ],
404         mode         => $mode_flags,
405         constructors => \%cmp_operand_constructors,
406 },
407
408 Tst => {
409         irn_flags    => [ "rematerializable", "modifies_flags" ],
410         emit         => '. tst %S1',
411         mode         => $mode_flags,
412         reg_req      => { in => [ "gp" ], out => [ "flags" ] },
413         ins          => [ "val" ],
414 },
415
416 SwitchJmp => {
417         op_flags  => [ "labeled", "cfopcode", "forking" ],
418         irn_flags => [ "modifies_flags" ],
419         state     => "pinned",
420         mode      => "mode_T",
421         attr      => "int n_projs, long def_proj_num",
422         init_attr => "\tset_sparc_jmp_switch_n_projs(res, n_projs);\n".
423                                         "\tset_sparc_jmp_switch_default_proj_num(res, def_proj_num);",
424         reg_req   => { in => [ "gp" ], out => [ "none" ] },
425         attr_type => "sparc_jmp_switch_attr_t",
426 },
427
428 Sll => {
429         irn_flags    => [ "rematerializable" ],
430         mode         => $mode_gp,
431         emit         => '. sll %S1, %R2I, %D1',
432         constructors => \%binop_operand_constructors,
433 },
434
435 Slr => {
436         irn_flags    => [ "rematerializable" ],
437         mode         => $mode_gp,
438         emit         => '. srl %S1, %R2I, %D1',
439         constructors => \%binop_operand_constructors,
440 },
441
442 Sra => {
443         irn_flags    => [ "rematerializable" ],
444         mode         => $mode_gp,
445         emit         => '. sra %S1, %R2I, %D1',
446         constructors => \%binop_operand_constructors,
447 },
448
449 And => {
450         irn_flags    => [ "rematerializable" ],
451         mode         => $mode_gp,
452         emit         => '. and %S1, %R2I, %D1',
453         constructors => \%binop_operand_constructors,
454 },
455
456 AndN => {
457         irn_flags => [ "rematerializable" ],
458         mode      => $mode_gp,
459         emit      => '. andn %S1, %R2I, %D1',
460         constructors => \%binop_operand_constructors,
461 },
462
463 Or => {
464         irn_flags    => [ "rematerializable" ],
465         mode         => $mode_gp,
466         emit         => '. or %S1, %R2I, %D1',
467         constructors => \%binop_operand_constructors,
468 },
469
470 OrN => {
471         irn_flags => [ "rematerializable" ],
472         mode      => $mode_gp,
473         emit      => '. orn %S1, %R2I, %D1',
474         constructors => \%binop_operand_constructors,
475 },
476
477 Xor => {
478         irn_flags    => [ "rematerializable" ],
479         mode         => $mode_gp,
480         emit         => '. xor %S1, %R2I, %D1',
481         constructors => \%binop_operand_constructors,
482 },
483
484 XNor => {
485         irn_flags => [ "rematerializable" ],
486         mode      => $mode_gp,
487         emit      => '. xnor %S1, %R2I, %D1',
488         constructors => \%binop_operand_constructors,
489 },
490
491 Mul => {
492         irn_flags    => [ "rematerializable" ],
493         mode         => $mode_gp,
494         emit         => '. smul %S1, %R2I, %D1',
495         constructors => \%binop_operand_constructors,
496 },
497
498 Mulh => {
499         irn_flags    => [ "rematerializable" ],
500         outs         => [ "low", "high" ],
501         constructors => \%binop_operand_constructors,
502 },
503
504 # The div instructions are kinda hacky. Things to improve:
505 # * Make high-value input explicitely. Either as a gp at first or ideally
506 #   as an explicit y-register
507
508 SDiv => {
509         irn_flags    => [ "rematerializable" ],
510         state        => "exc_pinned",
511         ins          => [ "dividend_low", "divisor" ],
512         outs         => [ "res", "M" ],
513         constructors => \%binop_operand_constructors,
514 },
515
516 UDiv => {
517         irn_flags    => [ "rematerializable" ],
518         state        => "exc_pinned",
519         ins          => [ "dividend_low", "divisor" ],
520         outs         => [ "res", "M" ],
521         constructors => \%binop_operand_constructors,
522 },
523
524 fcmp => {
525         irn_flags => [ "rematerializable", "modifies_fp_flags" ],
526         emit      => '. fcmp%FPM %S1, %S2',
527         attr_type => "sparc_fp_attr_t",
528         attr      => "ir_mode *fp_mode",
529         mode      => $mode_fpflags,
530         constructors => {
531                 s => {
532                         reg_req => { in => [ "fp", "fp" ], out => [ "fpflags" ] },
533                 },
534                 d => {
535                         reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fpflags" ] },
536                 },
537                 q => {
538                         reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fpflags" ] },
539                 },
540         },
541 },
542
543 fadd => {
544         op_flags     => [ "commutative" ],
545         irn_flags    => [ "rematerializable" ],
546         emit         => '. fadd%FPM %S1, %S2, %D1',
547         attr_type    => "sparc_fp_attr_t",
548         attr         => "ir_mode *fp_mode",
549         constructors => \%float_binop_constructors,
550 },
551
552 fsub => {
553         irn_flags    => [ "rematerializable" ],
554         emit         => '. fsub%FPM %S1, %S2, %D1',
555         attr_type    => "sparc_fp_attr_t",
556         attr         => "ir_mode *fp_mode",
557         constructors => \%float_binop_constructors,
558 },
559
560 fmul => {
561         irn_flags    => [ "rematerializable" ],
562         op_flags     => [ "commutative" ],
563         emit         =>'. fmul%FPM %S1, %S2, %D1',
564         attr_type    => "sparc_fp_attr_t",
565         attr         => "ir_mode *fp_mode",
566         constructors => \%float_binop_constructors,
567 },
568
569 fdiv => {
570         irn_flags    => [ "rematerializable" ],
571         emit         => '. fdiv%FPM %S1, %S2, %D1',
572         attr_type    => "sparc_fp_attr_t",
573         attr         => "ir_mode *fp_mode",
574         outs         => [ "res", "M" ],
575         constructors => \%float_binop_constructors,
576 },
577
578 fneg => {
579         irn_flags => [ "rematerializable" ],
580         reg_req   => { in => [ "fp" ], out => [ "fp" ] },
581         # note that we only need the first register even for wide-values
582         emit      => '. fneg %S1, %D1',
583         attr_type => "sparc_fp_attr_t",
584         attr      => "ir_mode *fp_mode",
585         constructors => \%float_unop_constructors,
586 },
587
588 "fabs" => {
589         irn_flags    => [ "rematerializable" ],
590         # note that we only need the first register even for wide-values
591         emit         => '. fabs %S1, %D1',
592         attr_type    => "sparc_fp_attr_t",
593         attr         => "ir_mode *fp_mode",
594         constructors => \%float_unop_constructors,
595 },
596
597 fftof => {
598         irn_flags => [ "rematerializable" ],
599         emit      => '. f%FCONVS%.to%FCONVD %S1, %D1',
600         attr_type => "sparc_fp_conv_attr_t",
601         attr      => "ir_mode *src_mode, ir_mode *dest_mode",
602         constructors => {
603                 s_d => {
604                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
605                         mode    => $mode_fp2,
606                 },
607                 s_q => {
608                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
609                         mode    => $mode_fp4,
610                 },
611                 d_s => {
612                         reg_req => { in => [ "fp:a|2" ], out => [ "fp" ] },
613                         mode    => $mode_fp,
614                 },
615                 d_q => {
616                         reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|4" ] },
617                         mode    => $mode_fp4,
618                 },
619                 q_s => {
620                         reg_req => { in => [ "fp:a|4" ], out => [ "fp" ] },
621                         mode    => $mode_fp,
622                 },
623                 q_d => {
624                         reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|2" ] },
625                         mode    => $mode_fp2,
626                 },
627         },
628 },
629
630 fitof => {
631         irn_flags => [ "rematerializable" ],
632         reg_req   => { in => [ "gp" ], out => [ "fp" ] },
633         emit      => '. fito%FPM %S1, %D1',
634         attr_type => "sparc_fp_attr_t",
635         attr      => "ir_mode *fp_mode",
636         constructors => {
637                 s => {
638                         reg_req => { in => [ "gp" ], out => [ "fp" ] },
639                         mode    => $mode_fp,
640                 },
641                 d => {
642                         reg_req => { in => [ "gp" ], out => [ "fp:a|2" ] },
643                         mode    => $mode_fp2,
644                 },
645                 q => {
646                         reg_req => { in => [ "gp" ], out => [ "fp:a|4" ] },
647                         mode    => $mode_fp4,
648                 },
649         },
650 },
651
652 fftoi => {
653         irn_flags => [ "rematerializable" ],
654         reg_req   => { in => [ "fp" ], out => [ "gp" ] },
655         emit      => '. f%FPM.toi %S1, %D1',
656         attr_type => "sparc_fp_attr_t",
657         attr      => "ir_mode *fp_mode",
658         mode      => $mode_gp,
659         constructors => {
660                 s => {
661                         reg_req => { in => [ "gp" ], out => [ "gp" ] },
662                 },
663                 d => {
664                         reg_req => { in => [ "fp:a|2" ], out => [ "gp" ] },
665                 },
666                 q => {
667                         reg_req => { in => [ "fp:a|4" ], out => [ "gp" ] },
668                 },
669         },
670 },
671
672 Ldf => {
673         op_flags  => [ "labeled", "fragile" ],
674         state     => "exc_pinned",
675         constructors => {
676                 s => {
677                         reg_req => { in => [ "gp", "none" ], out => [ "fp", "none" ] },
678                 },
679                 d => {
680                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|2", "none" ] },
681                 },
682                 q => {
683                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|4", "none" ] },
684                 },
685         },
686         ins       => [ "ptr", "mem" ],
687         outs      => [ "res", "M" ],
688         attr_type => "sparc_load_store_attr_t",
689         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
690         emit      => '. ld%FLSM [%S1%O], %D1'
691 },
692
693 Stf => {
694         op_flags  => [ "labeled", "fragile" ],
695         state     => "exc_pinned",
696         constructors => {
697                 s => {
698                         reg_req => { in => [ "gp", "fp", "none" ], out => [ "none" ] },
699                 },
700                 d => {
701                         reg_req => { in => [ "gp", "fp:a|2", "none" ], out => [ "none" ] },
702                 },
703                 q => {
704                         reg_req => { in => [ "gp", "fp:a|4", "none" ], out => [ "none" ] },
705                 },
706         },
707         ins       => [ "ptr", "val", "mem" ],
708         outs      => [ "M" ],
709         attr_type => "sparc_load_store_attr_t",
710         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
711         emit      => '. st%FLSM %S2, [%S1%O]',
712         mode      => 'mode_M',
713 },
714
715 ); # end of %nodes