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