sparc: document authors
[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         constructors => {
309                 imm => {
310                         attr       => "ir_entity *immediate_entity, int32_t immediate_value",
311                         custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
312                         reg_req    => { in => [ "sp" ], out => [ "sp:I|S" ] },
313                         ins        => [ "stack" ],
314                 },
315                 reg => {
316                         reg_req    => { in => [ "sp", "gp" ], out => [ "sp:I|S" ] },
317                         ins        => [ "stack", "increment" ],
318                 }
319         },
320 },
321
322 Restore => {
323         emit => '. restore %S0, %R1I, %D0',
324         outs => [ "stack" ],
325         constructors => {
326                 imm => {
327                         attr       => "ir_entity *immediate_entity, int32_t immediate_value",
328                         custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
329                         reg_req    => { in => [ "sp" ], out => [ "sp:I|S" ] },
330                         ins        => [ "stack" ],
331                 },
332                 reg => {
333                         reg_req    => { in => [ "sp", "gp" ], out => [ "sp:I|S" ] },
334                         ins        => [ "stack", "increment" ],
335                 }
336         },
337 },
338
339 RestoreZero => {
340         emit => '. restore',
341         outs => [ ],
342         ins  => [ ],
343         mode => "mode_T",
344 },
345
346 SubSP => {
347         reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "gp", "none" ] },
348         ins       => [ "stack", "size", "mem" ],
349         outs      => [ "stack", "addr", "M" ],
350         emit      => ". sub %S0, %S1, %D0\n",
351 },
352
353 AddSP => {
354         reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "none" ] },
355         ins       => [ "stack", "size", "mem" ],
356         outs      => [ "stack", "M" ],
357         emit      => ". add %S0, %S1, %D0\n",
358 },
359
360 FrameAddr => {
361         op_flags   => [ "constlike" ],
362         irn_flags  => [ "rematerializable" ],
363         attr       => "ir_entity *entity, int32_t offset",
364         reg_req    => { in => [ "gp" ], out => [ "gp" ] },
365         ins        => [ "base" ],
366         attr_type  => "sparc_attr_t",
367         custominit => "sparc_set_attr_imm(res, entity, offset);",
368         mode       => $mode_gp,
369 },
370
371 Bicc => {
372         op_flags  => [ "labeled", "cfopcode", "forking" ],
373         state     => "pinned",
374         mode      => "mode_T",
375         attr_type => "sparc_jmp_cond_attr_t",
376         attr      => "ir_relation relation, bool is_unsigned",
377         init_attr => "\tinit_sparc_jmp_cond_attr(res, relation, is_unsigned);",
378         reg_req   => { in => [ "flags" ], out => [ "none", "none" ] },
379 },
380
381 fbfcc => {
382         op_flags  => [ "labeled", "cfopcode", "forking" ],
383         state     => "pinned",
384         mode      => "mode_T",
385         attr_type => "sparc_jmp_cond_attr_t",
386         attr      => "ir_relation relation",
387         init_attr => "\tinit_sparc_jmp_cond_attr(res, relation, false);",
388         reg_req   => { in => [ "fpflags" ], out => [ "none", "none" ] },
389 },
390
391 Ba => {
392         state     => "pinned",
393         op_flags  => [ "cfopcode" ],
394         irn_flags => [ "simple_jump" ],
395         reg_req   => { out => [ "none" ] },
396         mode      => "mode_X",
397 },
398
399 # This is a JumpLink instruction, but with the addition that you can add custom
400 # register constraints to model your calling conventions
401 Return => {
402         arity     => "variable",
403         out_arity => "variable",
404         constructors => {
405                 imm => {
406                         attr       => "ir_entity *entity, int32_t offset",
407                         custominit => "\tsparc_set_attr_imm(res, entity, offset);",
408                         arity     => "variable",
409                         out_arity => "variable",
410                 },
411                 reg => {
412                         arity     => "variable",
413                         out_arity => "variable",
414                 }
415         },
416 },
417
418 Call => {
419         irn_flags => [ "modifies_flags", "modifies_fp_flags" ],
420         state     => "exc_pinned",
421         arity     => "variable",
422         out_arity => "variable",
423         constructors => {
424                 imm => {
425                         attr       => "ir_entity *entity, int32_t offset",
426                         custominit => "\tsparc_set_attr_imm(res, entity, offset);",
427                         arity     => "variable",
428                         out_arity => "variable",
429                 },
430                 reg => {
431                         arity     => "variable",
432                         out_arity => "variable",
433                 }
434         },
435 },
436
437 Cmp => {  # aka SubccZero
438         irn_flags    => [ "rematerializable", "modifies_flags" ],
439         emit         => '. cmp %S0, %R1I',
440         mode         => $mode_flags,
441         constructors => \%binopcczero_operand_constructors,
442 },
443
444 SwitchJmp => {
445         op_flags     => [ "labeled", "cfopcode", "forking" ],
446         state        => "pinned",
447         mode         => "mode_T",
448         reg_req      => { in => [ "gp" ], out => [ ] },
449         attr_type    => "sparc_switch_jmp_attr_t",
450         attr         => "long default_pn, ir_entity *jump_table",
451         init_attr => "info->out_infos = NULL;", # XXX ugly hack for out requirements
452 },
453
454 Sll => {
455         irn_flags    => [ "rematerializable" ],
456         mode         => $mode_gp,
457         emit         => '. sll %S0, %R1I, %D0',
458         constructors => \%binop_operand_constructors,
459 },
460
461 Srl => {
462         irn_flags    => [ "rematerializable" ],
463         mode         => $mode_gp,
464         emit         => '. srl %S0, %R1I, %D0',
465         constructors => \%binop_operand_constructors,
466 },
467
468 Sra => {
469         irn_flags    => [ "rematerializable" ],
470         mode         => $mode_gp,
471         emit         => '. sra %S0, %R1I, %D0',
472         constructors => \%binop_operand_constructors,
473 },
474
475 And => {
476         irn_flags    => [ "rematerializable" ],
477         mode         => $mode_gp,
478         emit         => '. and %S0, %R1I, %D0',
479         constructors => \%binop_operand_constructors,
480 },
481
482 AndCCZero => {
483         irn_flags    => [ "rematerializable", "modifies_flags" ],
484         emit         => '. andcc %S0, %R1I, %%g0',
485         mode         => $mode_flags,
486         constructors => \%binopcczero_operand_constructors,
487 },
488
489 AndN => {
490         irn_flags => [ "rematerializable" ],
491         mode      => $mode_gp,
492         emit      => '. andn %S0, %R1I, %D0',
493         constructors => \%binop_operand_constructors,
494 },
495
496 AndNCCZero => {
497         irn_flags    => [ "rematerializable", "modifies_flags" ],
498         emit         => '. andncc %S0, %R1I, %%g0',
499         mode         => $mode_flags,
500         constructors => \%binopcczero_operand_constructors,
501 },
502
503 Or => {
504         irn_flags    => [ "rematerializable" ],
505         mode         => $mode_gp,
506         emit         => '. or %S0, %R1I, %D0',
507         constructors => \%binop_operand_constructors,
508 },
509
510 OrCCZero => {
511         irn_flags    => [ "rematerializable", "modifies_flags" ],
512         emit         => '. orcc %S0, %R1I, %%g0',
513         mode         => $mode_flags,
514         constructors => \%binopcczero_operand_constructors,
515 },
516
517 OrN => {
518         irn_flags => [ "rematerializable" ],
519         mode      => $mode_gp,
520         emit      => '. orn %S0, %R1I, %D0',
521         constructors => \%binop_operand_constructors,
522 },
523
524 OrNCCZero => {
525         irn_flags    => [ "rematerializable", "modifies_flags" ],
526         emit         => '. orncc %S0, %R1I, %%g0',
527         mode         => $mode_flags,
528         constructors => \%binopcczero_operand_constructors,
529 },
530
531 Xor => {
532         irn_flags    => [ "rematerializable" ],
533         mode         => $mode_gp,
534         emit         => '. xor %S0, %R1I, %D0',
535         constructors => \%binop_operand_constructors,
536 },
537
538 XorCCZero => {
539         irn_flags    => [ "rematerializable", "modifies_flags" ],
540         emit         => '. xorcc %S0, %R1I, %%g0',
541         mode         => $mode_flags,
542         constructors => \%binopcczero_operand_constructors,
543 },
544
545 XNor => {
546         irn_flags => [ "rematerializable" ],
547         mode      => $mode_gp,
548         emit      => '. xnor %S0, %R1I, %D0',
549         constructors => \%binop_operand_constructors,
550 },
551
552 XNorCCZero => {
553         irn_flags    => [ "rematerializable", "modifies_flags" ],
554         emit         => '. xnorcc %S0, %R1I, %%g0',
555         mode         => $mode_flags,
556         constructors => \%binopcczero_operand_constructors,
557 },
558
559 Mul => {
560         irn_flags    => [ "rematerializable" ],
561         mode         => $mode_gp,
562         emit         => '. smul %S0, %R1I, %D0',
563         constructors => \%binop_operand_constructors,
564 },
565
566 Mulh => {
567         irn_flags    => [ "rematerializable" ],
568         outs         => [ "low", "high" ],
569         constructors => \%binop_operand_constructors,
570 },
571
572 SDiv => {
573         irn_flags    => [ "rematerializable" ],
574         state        => "exc_pinned",
575         ins          => [ "dividend_high", "dividend_low", "divisor" ],
576         outs         => [ "res", "M" ],
577         constructors => \%div_operand_constructors,
578 },
579
580 UDiv => {
581         irn_flags    => [ "rematerializable" ],
582         state        => "exc_pinned",
583         ins          => [ "dividend_high", "dividend_low", "divisor" ],
584         outs         => [ "res", "M" ],
585         constructors => \%div_operand_constructors,
586 },
587
588 fcmp => {
589         irn_flags => [ "rematerializable", "modifies_fp_flags" ],
590         emit      => '. fcmp%FPM %S0, %S1',
591         attr_type => "sparc_fp_attr_t",
592         attr      => "ir_mode *fp_mode",
593         mode      => $mode_fpflags,
594         constructors => {
595                 s => {
596                         reg_req => { in => [ "fp", "fp" ], out => [ "fpflags" ] },
597                 },
598                 d => {
599                         reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fpflags" ] },
600                 },
601                 q => {
602                         reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fpflags" ] },
603                 },
604         },
605 },
606
607 fadd => {
608         op_flags     => [ "commutative" ],
609         irn_flags    => [ "rematerializable" ],
610         emit         => '. fadd%FPM %S0, %S1, %D0',
611         attr_type    => "sparc_fp_attr_t",
612         attr         => "ir_mode *fp_mode",
613         ins          => [ "left", "right" ],
614         constructors => \%float_binop_constructors,
615 },
616
617 fsub => {
618         irn_flags    => [ "rematerializable" ],
619         emit         => '. fsub%FPM %S0, %S1, %D0',
620         attr_type    => "sparc_fp_attr_t",
621         attr         => "ir_mode *fp_mode",
622         ins          => [ "left", "right" ],
623         constructors => \%float_binop_constructors,
624 },
625
626 fmul => {
627         irn_flags    => [ "rematerializable" ],
628         op_flags     => [ "commutative" ],
629         emit         =>'. fmul%FPM %S0, %S1, %D0',
630         attr_type    => "sparc_fp_attr_t",
631         attr         => "ir_mode *fp_mode",
632         ins          => [ "left", "right" ],
633         constructors => \%float_binop_constructors,
634 },
635
636 fdiv => {
637         irn_flags    => [ "rematerializable" ],
638         emit         => '. fdiv%FPM %S0, %S1, %D0',
639         attr_type    => "sparc_fp_attr_t",
640         attr         => "ir_mode *fp_mode",
641         ins          => [ "left", "right" ],
642         outs         => [ "res", "M" ],
643         constructors => {
644                 s => {
645                         reg_req => { in => [ "fp", "fp" ], out => [ "fp", "none" ] },
646                 },
647                 d => {
648                         reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fp:a|2", "none" ] },
649                 },
650                 q => {
651                         reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fp:a|4", "none" ] },
652                 }
653         },
654 },
655
656 fneg => {
657         irn_flags => [ "rematerializable" ],
658         reg_req   => { in => [ "fp" ], out => [ "fp" ] },
659         # note that we only need the first register even for wide-values
660         emit      => '. fneg %S0, %D0',
661         attr_type => "sparc_fp_attr_t",
662         attr      => "ir_mode *fp_mode",
663         ins          => [ "val" ],
664         constructors => \%float_unop_constructors,
665 },
666
667 "fabs" => {
668         irn_flags    => [ "rematerializable" ],
669         # note that we only need the first register even for wide-values
670         emit         => '. fabs %S0, %D0',
671         attr_type    => "sparc_fp_attr_t",
672         attr         => "ir_mode *fp_mode",
673         ins          => [ "val" ],
674         constructors => \%float_unop_constructors,
675 },
676
677 fftof => {
678         irn_flags => [ "rematerializable" ],
679         emit      => '. f%FCONVS%.to%FCONVD %S0, %D0',
680         attr_type => "sparc_fp_conv_attr_t",
681         attr      => "ir_mode *src_mode, ir_mode *dest_mode",
682         constructors => {
683                 s_d => {
684                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
685                         mode    => $mode_fp2,
686                 },
687                 s_q => {
688                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
689                         mode    => $mode_fp4,
690                 },
691                 d_s => {
692                         reg_req => { in => [ "fp:a|2" ], out => [ "fp" ] },
693                         mode    => $mode_fp,
694                 },
695                 d_q => {
696                         reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|4" ] },
697                         mode    => $mode_fp4,
698                 },
699                 q_s => {
700                         reg_req => { in => [ "fp:a|4" ], out => [ "fp" ] },
701                         mode    => $mode_fp,
702                 },
703                 q_d => {
704                         reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|2" ] },
705                         mode    => $mode_fp2,
706                 },
707         },
708 },
709
710 fitof => {
711         irn_flags => [ "rematerializable" ],
712         emit      => '. fito%FPM %S0, %D0',
713         attr_type => "sparc_fp_attr_t",
714         attr      => "ir_mode *fp_mode",
715         constructors => {
716                 s => {
717                         reg_req => { in => [ "fp" ], out => [ "fp" ] },
718                         mode    => $mode_fp,
719                 },
720                 d => {
721                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
722                         mode    => $mode_fp2,
723                 },
724                 q => {
725                         reg_req => { in => [ "fp" ], out => [ "fp:a|4" ] },
726                         mode    => $mode_fp4,
727                 },
728         },
729 },
730
731 fftoi => {
732         irn_flags => [ "rematerializable" ],
733         emit      => '. f%FPM%.toi %S0, %D0',
734         attr_type => "sparc_fp_attr_t",
735         attr      => "ir_mode *fp_mode",
736         mode      => $mode_gp,
737         constructors => {
738                 s => {
739                         reg_req => { in => [ "fp" ], out => [ "fp" ] },
740                 },
741                 d => {
742                         reg_req => { in => [ "fp:a|2" ], out => [ "fp" ] },
743                 },
744                 q => {
745                         reg_req => { in => [ "fp:a|4" ], out => [ "fp" ] },
746                 },
747         },
748 },
749
750 Ldf => {
751         op_flags  => [ "labeled", "fragile" ],
752         state     => "exc_pinned",
753         constructors => {
754                 s => {
755                         reg_req => { in => [ "gp", "none" ], out => [ "fp", "none" ] },
756                 },
757                 d => {
758                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|2", "none" ] },
759                 },
760                 q => {
761                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|4", "none" ] },
762                 },
763         },
764         ins       => [ "ptr", "mem" ],
765         outs      => [ "res", "M" ],
766         attr_type => "sparc_load_store_attr_t",
767         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
768         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
769         emit      => '. ld%FLSM [%S0%O1], %D0'
770 },
771
772 Stf => {
773         op_flags  => [ "labeled", "fragile" ],
774         state     => "exc_pinned",
775         constructors => {
776                 s => {
777                         reg_req => { in => [ "fp",     "gp", "none" ], out => [ "none" ] },
778                 },
779                 d => {
780                         reg_req => { in => [ "fp:a|2", "gp", "none" ], out => [ "none" ] },
781                 },
782                 q => {
783                         reg_req => { in => [ "fp:a|4", "gp", "none" ], out => [ "none" ] },
784                 },
785         },
786         ins       => [ "val", "ptr", "mem" ],
787         outs      => [ "M" ],
788         attr_type => "sparc_load_store_attr_t",
789         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
790         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
791         emit      => '. st%FLSM %S0, [%S1%O2]',
792         mode      => 'mode_M',
793 },
794
795 ); # end of %nodes