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