sparc: preliminary SwitchJmp implementation
[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         O2     => "${arch}_emit_offset(node, 1);",
141         O3     => "${arch}_emit_offset(node, 2);",
142 );
143
144 $default_attr_type = "sparc_attr_t";
145 $default_copy_attr = "sparc_copy_attr";
146
147
148 %init_attr = (
149         sparc_attr_t             => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
150         sparc_load_store_attr_t  => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
151         sparc_jmp_cond_attr_t    => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
152         sparc_switch_jmp_attr_t  => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
153                                     "\tinit_sparc_switch_jmp_attributes(res, default_pn, jump_table);\n",
154         sparc_save_attr_t        => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
155         sparc_fp_attr_t          => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
156                                     "\tinit_sparc_fp_attributes(res, fp_mode);\n",
157         sparc_fp_conv_attr_t     => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);".
158                                     "\tinit_sparc_fp_conv_attributes(res, src_mode, dest_mode);\n",
159 );
160
161 %compare_attr = (
162         sparc_attr_t            => "cmp_attr_sparc",
163         sparc_load_store_attr_t => "cmp_attr_sparc_load_store",
164         sparc_jmp_cond_attr_t   => "cmp_attr_sparc_jmp_cond",
165         sparc_switch_jmp_attr_t => "cmp_attr_sparc_switch_jmp",
166         sparc_save_attr_t       => "cmp_attr_sparc_save",
167         sparc_fp_attr_t         => "cmp_attr_sparc_fp",
168         sparc_fp_conv_attr_t    => "cmp_attr_sparc_fp_conv",
169 );
170
171 %custom_irn_flags = (
172         modifies_flags    => "sparc_arch_irn_flag_modifies_flags",
173         modifies_fp_flags => "sparc_arch_irn_flag_modifies_fp_flags",
174 );
175
176 # addressing modes: imm, reg, reg +/- imm, reg + reg
177 # max. imm = 13 bits signed (-4096 ... 4096)
178
179 my %cmp_operand_constructors = (
180         imm => {
181                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
182                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
183                 reg_req    => { in => [ "gp" ], out => [ "flags" ] },
184                 ins        => [ "left" ],
185         },
186         reg => {
187                 reg_req    => { in => [ "gp", "gp" ], out => [ "flags" ] },
188                 ins        => [ "left", "right" ],
189         },
190 );
191
192 my %binop_operand_constructors = (
193         imm => {
194                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
195                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
196                 reg_req    => { in => [ "gp" ], out => [ "gp" ] },
197                 ins        => [ "left" ],
198         },
199         reg => {
200                 reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
201                 ins        => [ "left", "right" ],
202         },
203 );
204
205 my %div_operand_constructors = (
206         imm => {
207                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
208                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
209                 reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
210         },
211         reg => {
212                 reg_req    => { in => [ "gp", "gp", "gp" ], out => [ "gp" ] },
213         },
214 );
215
216 my %float_binop_constructors = (
217         s => {
218                 reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
219                 mode    => $mode_fp,
220         },
221         d => {
222                 reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fp:a|2" ] },
223                 mode    => $mode_fp2,
224         },
225         q => {
226                 reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fp:a|4" ] },
227                 mode    => $mode_fp4,
228         }
229 );
230
231 my %float_unop_constructors = (
232         s => {
233                 reg_req => { in => [ "fp" ], out => [ "fp" ] },
234                 mode    => $mode_fp,
235         },
236         d => {
237                 reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|2" ] },
238                 mode    => $mode_fp2,
239         },
240         q => {
241                 reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|4" ] },
242                 mode    => $mode_fp4,
243         }
244 );
245
246 %nodes = (
247
248 Add => {
249         irn_flags    => [ "rematerializable" ],
250         mode         => $mode_gp,
251         emit         => '. add %S1, %R2I, %D1',
252         constructors => \%binop_operand_constructors,
253 },
254
255 Sub => {
256         irn_flags    => [ "rematerializable" ],
257         mode         => $mode_gp,
258         emit         => '. sub %S1, %R2I, %D1',
259         constructors => \%binop_operand_constructors,
260 },
261
262
263 # Load / Store
264 Ld => {
265         op_flags  => [ "labeled", "fragile" ],
266         state     => "exc_pinned",
267         constructors => {
268                 imm => {
269                         reg_req    => { in => [ "gp", "none" ], out => [ "gp", "none" ] },
270                         ins        => [ "ptr", "mem" ],
271                         attr       => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
272                         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
273                 },
274                 reg => {
275                         reg_req    => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
276                         ins        => [ "ptr", "ptr2", "mem" ],
277                         attr       => "ir_mode *ls_mode",
278                         custominit => "init_sparc_load_store_attributes(res, ls_mode, NULL, 0, false, true);",
279                 },
280         },
281         ins       => [ "ptr", "mem" ],
282         outs      => [ "res", "M" ],
283         attr_type => "sparc_load_store_attr_t",
284         emit      => '. ld%LM [%S1%O2], %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                 imm => {
303                         reg_req    => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
304                         ins        => [ "val", "ptr", "mem" ],
305                         attr       => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
306                         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
307                 },
308                 reg => {
309                         reg_req    => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
310                         ins        => [ "val", "ptr", "ptr2", "mem" ],
311                         attr       => "ir_mode *ls_mode",
312                         custominit => "init_sparc_load_store_attributes(res, ls_mode, NULL, 0, false, true);",
313                 },
314         },
315         ins       => [ "val", "ptr", "mem" ],
316         outs      => [ "M" ],
317         attr_type => "sparc_load_store_attr_t",
318         emit      => '. st%SM %S1, [%S2%O3]'
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         state        => "pinned",
424         mode         => "mode_T",
425         reg_req      => { in => [ "gp" ], out => [ ] },
426         attr_type    => "sparc_switch_jmp_attr_t",
427         attr         => "long default_pn, ir_entity *jump_table",
428         init_attr => "info->out_infos = NULL;", # XXX ugly hack for out requirements
429 },
430
431 Sll => {
432         irn_flags    => [ "rematerializable" ],
433         mode         => $mode_gp,
434         emit         => '. sll %S1, %R2I, %D1',
435         constructors => \%binop_operand_constructors,
436 },
437
438 Slr => {
439         irn_flags    => [ "rematerializable" ],
440         mode         => $mode_gp,
441         emit         => '. srl %S1, %R2I, %D1',
442         constructors => \%binop_operand_constructors,
443 },
444
445 Sra => {
446         irn_flags    => [ "rematerializable" ],
447         mode         => $mode_gp,
448         emit         => '. sra %S1, %R2I, %D1',
449         constructors => \%binop_operand_constructors,
450 },
451
452 And => {
453         irn_flags    => [ "rematerializable" ],
454         mode         => $mode_gp,
455         emit         => '. and %S1, %R2I, %D1',
456         constructors => \%binop_operand_constructors,
457 },
458
459 AndN => {
460         irn_flags => [ "rematerializable" ],
461         mode      => $mode_gp,
462         emit      => '. andn %S1, %R2I, %D1',
463         constructors => \%binop_operand_constructors,
464 },
465
466 Or => {
467         irn_flags    => [ "rematerializable" ],
468         mode         => $mode_gp,
469         emit         => '. or %S1, %R2I, %D1',
470         constructors => \%binop_operand_constructors,
471 },
472
473 OrN => {
474         irn_flags => [ "rematerializable" ],
475         mode      => $mode_gp,
476         emit      => '. orn %S1, %R2I, %D1',
477         constructors => \%binop_operand_constructors,
478 },
479
480 Xor => {
481         irn_flags    => [ "rematerializable" ],
482         mode         => $mode_gp,
483         emit         => '. xor %S1, %R2I, %D1',
484         constructors => \%binop_operand_constructors,
485 },
486
487 XNor => {
488         irn_flags => [ "rematerializable" ],
489         mode      => $mode_gp,
490         emit      => '. xnor %S1, %R2I, %D1',
491         constructors => \%binop_operand_constructors,
492 },
493
494 Mul => {
495         irn_flags    => [ "rematerializable" ],
496         mode         => $mode_gp,
497         emit         => '. smul %S1, %R2I, %D1',
498         constructors => \%binop_operand_constructors,
499 },
500
501 Mulh => {
502         irn_flags    => [ "rematerializable" ],
503         outs         => [ "low", "high" ],
504         constructors => \%binop_operand_constructors,
505 },
506
507 SDiv => {
508         irn_flags    => [ "rematerializable" ],
509         state        => "exc_pinned",
510         ins          => [ "dividend_high", "dividend_low", "divisor" ],
511         outs         => [ "res", "M" ],
512         constructors => \%div_operand_constructors,
513 },
514
515 UDiv => {
516         irn_flags    => [ "rematerializable" ],
517         state        => "exc_pinned",
518         ins          => [ "dividend_high", "dividend_low", "divisor" ],
519         outs         => [ "res", "M" ],
520         constructors => \%div_operand_constructors,
521 },
522
523 fcmp => {
524         irn_flags => [ "rematerializable", "modifies_fp_flags" ],
525         emit      => '. fcmp%FPM %S1, %S2',
526         attr_type => "sparc_fp_attr_t",
527         attr      => "ir_mode *fp_mode",
528         mode      => $mode_fpflags,
529         constructors => {
530                 s => {
531                         reg_req => { in => [ "fp", "fp" ], out => [ "fpflags" ] },
532                 },
533                 d => {
534                         reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fpflags" ] },
535                 },
536                 q => {
537                         reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fpflags" ] },
538                 },
539         },
540 },
541
542 fadd => {
543         op_flags     => [ "commutative" ],
544         irn_flags    => [ "rematerializable" ],
545         emit         => '. fadd%FPM %S1, %S2, %D1',
546         attr_type    => "sparc_fp_attr_t",
547         attr         => "ir_mode *fp_mode",
548         ins          => [ "left", "right" ],
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         ins          => [ "left", "right" ],
558         constructors => \%float_binop_constructors,
559 },
560
561 fmul => {
562         irn_flags    => [ "rematerializable" ],
563         op_flags     => [ "commutative" ],
564         emit         =>'. fmul%FPM %S1, %S2, %D1',
565         attr_type    => "sparc_fp_attr_t",
566         attr         => "ir_mode *fp_mode",
567         ins          => [ "left", "right" ],
568         constructors => \%float_binop_constructors,
569 },
570
571 fdiv => {
572         irn_flags    => [ "rematerializable" ],
573         emit         => '. fdiv%FPM %S1, %S2, %D1',
574         attr_type    => "sparc_fp_attr_t",
575         attr         => "ir_mode *fp_mode",
576         ins          => [ "left", "right" ],
577         outs         => [ "res", "M" ],
578         constructors => \%float_binop_constructors,
579 },
580
581 fneg => {
582         irn_flags => [ "rematerializable" ],
583         reg_req   => { in => [ "fp" ], out => [ "fp" ] },
584         # note that we only need the first register even for wide-values
585         emit      => '. fneg %S1, %D1',
586         attr_type => "sparc_fp_attr_t",
587         attr      => "ir_mode *fp_mode",
588         ins          => [ "val" ],
589         constructors => \%float_unop_constructors,
590 },
591
592 "fabs" => {
593         irn_flags    => [ "rematerializable" ],
594         # note that we only need the first register even for wide-values
595         emit         => '. fabs %S1, %D1',
596         attr_type    => "sparc_fp_attr_t",
597         attr         => "ir_mode *fp_mode",
598         ins          => [ "val" ],
599         constructors => \%float_unop_constructors,
600 },
601
602 fftof => {
603         irn_flags => [ "rematerializable" ],
604         emit      => '. f%FCONVS%.to%FCONVD %S1, %D1',
605         attr_type => "sparc_fp_conv_attr_t",
606         attr      => "ir_mode *src_mode, ir_mode *dest_mode",
607         constructors => {
608                 s_d => {
609                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
610                         mode    => $mode_fp2,
611                 },
612                 s_q => {
613                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
614                         mode    => $mode_fp4,
615                 },
616                 d_s => {
617                         reg_req => { in => [ "fp:a|2" ], out => [ "fp" ] },
618                         mode    => $mode_fp,
619                 },
620                 d_q => {
621                         reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|4" ] },
622                         mode    => $mode_fp4,
623                 },
624                 q_s => {
625                         reg_req => { in => [ "fp:a|4" ], out => [ "fp" ] },
626                         mode    => $mode_fp,
627                 },
628                 q_d => {
629                         reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|2" ] },
630                         mode    => $mode_fp2,
631                 },
632         },
633 },
634
635 fitof => {
636         irn_flags => [ "rematerializable" ],
637         reg_req   => { in => [ "gp" ], out => [ "fp" ] },
638         emit      => '. fito%FPM %S1, %D1',
639         attr_type => "sparc_fp_attr_t",
640         attr      => "ir_mode *fp_mode",
641         constructors => {
642                 s => {
643                         reg_req => { in => [ "gp" ], out => [ "fp" ] },
644                         mode    => $mode_fp,
645                 },
646                 d => {
647                         reg_req => { in => [ "gp" ], out => [ "fp:a|2" ] },
648                         mode    => $mode_fp2,
649                 },
650                 q => {
651                         reg_req => { in => [ "gp" ], out => [ "fp:a|4" ] },
652                         mode    => $mode_fp4,
653                 },
654         },
655 },
656
657 fftoi => {
658         irn_flags => [ "rematerializable" ],
659         reg_req   => { in => [ "fp" ], out => [ "gp" ] },
660         emit      => '. f%FPM.toi %S1, %D1',
661         attr_type => "sparc_fp_attr_t",
662         attr      => "ir_mode *fp_mode",
663         mode      => $mode_gp,
664         constructors => {
665                 s => {
666                         reg_req => { in => [ "gp" ], out => [ "gp" ] },
667                 },
668                 d => {
669                         reg_req => { in => [ "fp:a|2" ], out => [ "gp" ] },
670                 },
671                 q => {
672                         reg_req => { in => [ "fp:a|4" ], out => [ "gp" ] },
673                 },
674         },
675 },
676
677 Ldf => {
678         op_flags  => [ "labeled", "fragile" ],
679         state     => "exc_pinned",
680         constructors => {
681                 s => {
682                         reg_req => { in => [ "gp", "none" ], out => [ "fp", "none" ] },
683                 },
684                 d => {
685                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|2", "none" ] },
686                 },
687                 q => {
688                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|4", "none" ] },
689                 },
690         },
691         ins       => [ "ptr", "mem" ],
692         outs      => [ "res", "M" ],
693         attr_type => "sparc_load_store_attr_t",
694         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
695         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
696         emit      => '. ld%FLSM [%S1%O2], %D1'
697 },
698
699 Stf => {
700         op_flags  => [ "labeled", "fragile" ],
701         state     => "exc_pinned",
702         constructors => {
703                 s => {
704                         reg_req => { in => [ "fp",     "gp", "none" ], out => [ "none" ] },
705                 },
706                 d => {
707                         reg_req => { in => [ "fp:a|2", "gp", "none" ], out => [ "none" ] },
708                 },
709                 q => {
710                         reg_req => { in => [ "fp:a|4", "gp", "none" ], out => [ "none" ] },
711                 },
712         },
713         ins       => [ "val", "ptr", "mem" ],
714         outs      => [ "M" ],
715         attr_type => "sparc_load_store_attr_t",
716         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
717         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
718         emit      => '. st%FLSM %S2, [%S1%O2]',
719         mode      => 'mode_M',
720 },
721
722 ); # end of %nodes