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