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