first implementation of floatingpoint arithmetic operations
[libfirm] / ir / be / sparc / sparc_spec.pl
index 63109fd..4e2da4d 100644 (file)
@@ -54,7 +54,7 @@ $state       = 32; # register represents a state
                { name => "i3", realname => "i3", type => 0 }, # param 4
                { name => "i4", realname => "i4", type => 0 }, # param 5
                { name => "i5", realname => "i5", type => 0 }, # param 6
-               { name => "fp", realname => "fp", type => $ignore }, # our framepointer
+               { name => "frame_pointer", realname => "fp", type => $ignore }, # our framepointer
                { name => "i7", realname => "i7", type => $ignore }, # return address - 8
                { mode => $mode_gp }
        ],
@@ -63,7 +63,7 @@ $state       = 32; # register represents a state
                { mode => $mode_flags, flags => "manual_ra" }
        ],
        # fp registers can be accessed any time
-       fp  => [
+       fp => [
                { name => "f0",  type => $caller_save },
                { name => "f1",  type => $caller_save },
                { name => "f2",  type => $caller_save },
@@ -102,32 +102,29 @@ $state       = 32; # register represents a state
 
 %emit_templates = (
 # emit source reg or imm dep. on node's arity
-       RI => "${arch}_emit_reg_or_imm(node, -1);",
+       RI  => "${arch}_emit_reg_or_imm(node, -1);",
        R1I => "${arch}_emit_reg_or_imm(node, 0);",
        R2I => "${arch}_emit_reg_or_imm(node, 1);",
        R3I => "${arch}_emit_reg_or_imm(node, 2);",
-# simple reg emitters
-       S1 => "${arch}_emit_source_register(node, 0);",
-       S2 => "${arch}_emit_source_register(node, 1);",
-       S3 => "${arch}_emit_source_register(node, 2);",
-       S4 => "${arch}_emit_source_register(node, 3);",
-       S5 => "${arch}_emit_source_register(node, 4);",
-       S6 => "${arch}_emit_source_register(node, 5);",
-       D1 => "${arch}_emit_dest_register(node, 0);",
-       D2 => "${arch}_emit_dest_register(node, 1);",
-       D3 => "${arch}_emit_dest_register(node, 2);",
-       D4 => "${arch}_emit_dest_register(node, 3);",
-       D5 => "${arch}_emit_dest_register(node, 4);",
-       D6 => "${arch}_emit_dest_register(node, 5);",
-# more custom emitters
-       C  => "${arch}_emit_immediate(node);",
+       S1  => "${arch}_emit_source_register(node, 0);",
+       S2  => "${arch}_emit_source_register(node, 1);",
+       S3  => "${arch}_emit_source_register(node, 2);",
+       S4  => "${arch}_emit_source_register(node, 3);",
+       S5  => "${arch}_emit_source_register(node, 4);",
+       S6  => "${arch}_emit_source_register(node, 5);",
+       D1  => "${arch}_emit_dest_register(node, 0);",
+       D2  => "${arch}_emit_dest_register(node, 1);",
+       D3  => "${arch}_emit_dest_register(node, 2);",
+       D4  => "${arch}_emit_dest_register(node, 3);",
+       D5  => "${arch}_emit_dest_register(node, 4);",
+       D6  => "${arch}_emit_dest_register(node, 5);",
+       IM  => "${arch}_emit_immediate(node);",
        LM  => "${arch}_emit_load_mode(node);",
        SM  => "${arch}_emit_store_mode(node);",
-       EXTPREF  => "${arch}_emit_mode_sign_prefix(node);",
        FPM  => "${arch}_emit_fp_mode_suffix(node);",
-       FPLM  => "${arch}_emit_fp_load_mode(node);",
-       FPSM  => "${arch}_emit_fp_store_mode(node);",
-       O  => "${arch}_emit_offset(node);",
+       FCONVS => "${arch}_emit_fp_conv_source(node);",
+       FCONVD => "${arch}_emit_fp_conv_destination(node);",
+       O      => "${arch}_emit_offset(node);",
 );
 
 $default_attr_type = "sparc_attr_t";
@@ -140,11 +137,13 @@ $default_copy_attr = "sparc_copy_attr";
                                    "\tinit_sparc_load_store_attributes(res, ls_mode, entity, entity_sign, offset, is_frame_entity);",
        sparc_symconst_attr_t    => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
                                    "\tinit_sparc_symconst_attributes(res, entity);",
-       sparc_cmp_attr_t         => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n",
        sparc_jmp_cond_attr_t    => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
        sparc_jmp_switch_attr_t  => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
        sparc_save_attr_t        => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
-
+       sparc_fp_attr_t          => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
+                                   "\tinit_sparc_fp_attributes(res, fp_mode);\n",
+       sparc_fp_conv_attr_t     => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);".
+                                   "\tinit_sparc_fp_conv_attributes(res, src_mode, dest_mode);\n",
 );
 
 %compare_attr = (
@@ -153,8 +152,9 @@ $default_copy_attr = "sparc_copy_attr";
        sparc_symconst_attr_t   => "cmp_attr_sparc_symconst",
        sparc_jmp_cond_attr_t   => "cmp_attr_sparc_jmp_cond",
        sparc_jmp_switch_attr_t => "cmp_attr_sparc_jmp_switch",
-       sparc_cmp_attr_t        => "cmp_attr_sparc_cmp",
        sparc_save_attr_t       => "cmp_attr_sparc_save",
+       sparc_fp_attr_t         => "cmp_attr_sparc_fp",
+       sparc_fp_conv_attr_t    => "cmp_attr_sparc_fp_conv",
 );
 
 # addressing modes: imm, reg, reg +/- imm, reg + reg
@@ -162,15 +162,12 @@ $default_copy_attr = "sparc_copy_attr";
 
 my %cmp_operand_constructors = (
        imm => {
-               attr       => "int immediate_value, bool ins_permuted, bool is_unsigned",
-               custominit => "sparc_set_attr_imm(res, immediate_value);" .
-                                               "\tinit_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
+               attr       => "int immediate_value",
+               custominit => "sparc_set_attr_imm(res, immediate_value);",
                reg_req    => { in => [ "gp" ], out => [ "flags" ] },
-       ins        => [ "left" ],
+               ins        => [ "left" ],
        },
        reg => {
-       attr       => "bool ins_permuted, bool is_unsigned",
-               custominit => "init_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
                reg_req    => { in => [ "gp", "gp" ], out => [ "flags" ] },
                ins        => [ "left", "right" ],
        },
@@ -204,7 +201,6 @@ my %binop_operand_constructors = (
 
 Add => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct Add: Add(a, b) = Add(b, a) = a + b",
        mode            => $mode_gp,
        emit      => '. add %S1, %R2I, %D1',
        constructors => \%binop_operand_constructors,
@@ -212,7 +208,6 @@ Add => {
 
 Sub => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct Sub: Sub(a, b) = a - b",
        mode            => $mode_gp,
        reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
        emit      => '. sub %S1, %R2I, %D1',
@@ -221,9 +216,8 @@ Sub => {
 
 
 # Load / Store
-Load => {
+Ld => {
        op_flags  => [ "labeled", "fragile" ],
-       comment   => "construct Load: Load(ptr, mem) = LD ptr -> reg",
        state     => "exc_pinned",
        ins       => [ "ptr", "mem" ],
        outs      => [ "res", "M" ],
@@ -233,62 +227,33 @@ Load => {
        emit      => '. ld%LM [%S1%O], %D1'
 },
 
-LoadHi => {
-       op_flags  => [ "labeled", "fragile" ],
-       comment   => "construct LoadHi: Load(ptr, mem) = sethi hi(ptr) -> reg",
-       state     => "exc_pinned",
-       ins       => [ "ptr", "mem" ],
-       outs      => [ "res", "M" ],
-       reg_req   => { in => [ "gp", "none" ], out => [ "gp", "none" ] },
-       attr_type => "sparc_load_store_attr_t",
-       attr      => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
-       emit      => '. sethi %%hi(%S1), %D1',
-},
-
 HiImm => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct LoadHi: Load(imm, mem) = sethi hi(imm) -> reg",
        state     => "exc_pinned",
        outs      => [ "res" ],
        mode      => $mode_gp,
        reg_req   => { in => [], out => [ "gp" ] },
-       #attr_type => "sparc_load_store_attr_t",
        attr       => "int immediate_value",
        custominit => "sparc_set_attr_imm(res, immediate_value);",
 },
 
 LoImm => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct LoadHi: Load(imm, mem) = sethi hi(imm) -> reg",
        state     => "exc_pinned",
        ins       => [ "hireg" ],
        outs      => [ "res" ],
        mode      => $mode_gp,
        reg_req   => { in => [ "gp" ], out => [ "gp" ] },
-       #attr_type => "sparc_load_store_attr_t",
        attr       => "int immediate_value",
        custominit => "sparc_set_attr_imm(res, immediate_value);",
 },
 
-LoadLo => {
-       op_flags  => [ "labeled", "fragile" ],
-       comment   => "construct LoadLo: Or(in, ptr, mem) = or in lo(ptr) -> reg",
-       state     => "exc_pinned",
-       ins       => [ "hireg", "ptr", "mem" ],
-       outs      => [ "res", "M" ],
-       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
-       attr_type => "sparc_load_store_attr_t",
-       attr      => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
-       emit      => '. or %S1, %%lo(%S2), %D1'
-},
-
-Store => {
+St => {
        op_flags  => [ "labeled", "fragile" ],
-       comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
        mode            => "mode_M",
        state     => "exc_pinned",
        ins       => [ "ptr", "val", "mem" ],
-       outs      => [ "mem" ],
+       outs      => [ "M" ],
        reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
        attr_type => "sparc_load_store_attr_t",
        attr      => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
@@ -297,7 +262,6 @@ Store => {
 
 Mov => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct Mov: Mov(src, dest) = MV src,dest",
        arity     => "variable",
        emit      => '. mov %R1I, %D1',
        mode      => $mode_gp,
@@ -305,28 +269,25 @@ Mov => {
 },
 
 Save => {
-       comment => "function prolog instruction. autom. saves sp & shifts the register window. previous out regs become the new in regs",
        reg_req   => {
                in => [ "sp", "none"],
-               out => [ "sp:I|S","none" ]
+               out => [ "sp:I|S", "frame_pointer:I", "none" ]
        },
        ins       => [ "stack", "mem" ],
-       outs      => [ "stack", "mem" ],
+       outs      => [ "stack", "frame", "mem" ],
        attr      => "int initial_stacksize",
        attr_type => "sparc_save_attr_t",
-       init_attr => "\tinit_sparc_save_attr(res, initial_stacksize);",
+       init_attr => "\tinit_sparc_save_attributes(res, initial_stacksize);",
 },
 
-AddSP => {
-       comment => "alloc stack space",
+SubSP => {
        reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "gp", "none" ] },
        ins       => [ "stack", "size", "mem" ],
        outs      => [ "stack", "addr", "M" ],
        emit      => ". sub %S1, %S2, %D1\n",
 },
 
-SubSP => {
-       comment => "free stack space",
+AddSP => {
        reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "none" ] },
        ins       => [ "stack", "size", "mem" ],
        outs      => [ "stack", "M" ],
@@ -352,17 +313,17 @@ FrameAddr => {
        mode      => $mode_gp,
 },
 
-Branch => {
+BXX => {
        op_flags  => [ "labeled", "cfopcode", "forking" ],
        state     => "pinned",
        mode      => "mode_T",
        reg_req   => { in => [ "flags" ], out => [ "none", "none" ] },
-       attr      => "int proj_num",
+       attr      => "int proj_num, bool is_unsigned",
        attr_type => "sparc_jmp_cond_attr_t",
-       init_attr => "\tset_sparc_jmp_cond_proj_num(res, proj_num);",
+       init_attr => "\tinit_sparc_jmp_cond_attr(res, proj_num, is_unsigned);",
 },
 
-Jmp => {
+Ba => {
        state     => "pinned",
        op_flags  => [ "cfopcode" ],
        irn_flags => [ "simple_jump" ],
@@ -370,11 +331,29 @@ Jmp => {
        mode      => "mode_X",
 },
 
+Call => {
+       irn_flags => [ "modify_flags" ],
+       state     => "exc_pinned",
+       arity     => "variable",
+       out_arity => "variable",
+       constructors => {
+               imm => {
+                       attr       => "ir_entity *entity, long offset",
+                       custominit => "get_sparc_attr(res)->immediate_value_entity = entity;",
+                       arity     => "variable",
+                       out_arity => "variable",
+               },
+               reg => {
+                       arity     => "variable",
+                       out_arity => "variable",
+               }
+       },
+},
+
 Cmp => {
        irn_flags    => [ "rematerializable", "modify_flags" ],
        emit         => '. cmp %S1, %R2I',
        mode         => $mode_flags,
-       attr_type    => "sparc_cmp_attr_t",
        constructors => \%cmp_operand_constructors,
 },
 
@@ -382,11 +361,8 @@ Tst => {
        irn_flags    => [ "rematerializable", "modify_flags" ],
        emit         => '. tst %S1',
        mode         => $mode_flags,
-       attr_type    => "sparc_cmp_attr_t",
-       attr         => "bool ins_permuted, bool is_unsigned",
-       custominit   => "init_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
        reg_req      => { in => [ "gp" ], out => [ "flags" ] },
-       ins          => [ "left" ],
+       ins          => [ "val" ],
 },
 
 SwitchJmp => {
@@ -400,28 +376,25 @@ SwitchJmp => {
        attr_type => "sparc_jmp_switch_attr_t",
 },
 
-ShiftLL => {
+Sll => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct shift logical left",
-       mode            => $mode_gp,
+       mode      => $mode_gp,
        reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
        emit      => '. sll %S1, %R2I, %D1',
        constructors => \%binop_operand_constructors,
 },
 
-ShiftLR => {
+Slr => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct shift logical right",
-       mode            => $mode_gp,
+       mode      => $mode_gp,
        reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
        emit      => '. srl %S1, %R2I, %D1',
        constructors => \%binop_operand_constructors,
 },
 
-ShiftRA => {
+Sra => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct shift right arithmetical",
-       mode            => $mode_gp,
+       mode      => $mode_gp,
        reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
        emit      => '. sra %S1, %R2I, %D1',
        constructors => \%binop_operand_constructors,
@@ -429,8 +402,7 @@ ShiftRA => {
 
 And => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct logical and",
-       mode            => $mode_gp,
+       mode      => $mode_gp,
        reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
        emit      => '. and %S1, %R2I, %D1',
        constructors => \%binop_operand_constructors,
@@ -438,8 +410,7 @@ And => {
 
 Or => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct logical or",
-       mode            => $mode_gp,
+       mode      => $mode_gp,
        reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
        emit      => '. or %S1, %R2I, %D1',
        constructors => \%binop_operand_constructors,
@@ -447,25 +418,20 @@ Or => {
 
 Xor => {
        irn_flags => [ "rematerializable" ],
-       comment   => "construct logical xor",
-       mode            => $mode_gp,
+       mode      => $mode_gp,
        reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
        emit      => '. xor %S1, %R2I, %D1',
        constructors => \%binop_operand_constructors,
 },
 
 Mul => {
-       state     => "exc_pinned",
-       comment   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
-       reg_req   => { in => [ "gp", "gp" ], out => [ "gp", "flags" ] },
-       outs      => [ "low", "high" ],
+       reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
        constructors => \%binop_operand_constructors,
-       #emit      =>'. mul %S1, %R2I, %D1'
+       emit      => '. mul %S1, %R2I, %D1',
+       mode      => $mode_gp,
 },
 
 Mulh => {
-       state     => "exc_pinned",
-       comment   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
        reg_req   => { in => [ "gp", "gp" ], out => [ "gp", "gp" ] },
        outs      => [ "low", "high" ],
        constructors => \%binop_operand_constructors,
@@ -474,29 +440,24 @@ Mulh => {
 Div => {
        irn_flags => [ "rematerializable" ],
        state     => "exc_pinned",
-       comment   => "construct Div: Div(a, b) = a / b",
-       reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
-       outs      => [ "res" ],
+       reg_req   => { in => [ "gp", "gp" ], out => [ "gp", "none" ] },
+       outs      => [ "res", "M" ],
        constructors => \%binop_operand_constructors,
-       #mode      => $mode_gp,
-       #emit      =>'. div %S1, %R2I, %D1'
+       emit      => '. div %S1, %R2I, %D1',
 },
 
 Minus => {
        irn_flags => [ "rematerializable" ],
-       mode        => $mode_gp,
-       comment   => "construct Minus: Minus(a) = -a",
-       #reg_req   => { in => [ "gp" ], out => [ "in_r1" ] },
+       mode      => $mode_gp,
        reg_req   => { in => [ "gp" ], out => [ "gp" ] },
        emit      => ". sub %%g0, %S1, %D1"
 },
 
 Not => {
-       irn_flags   => [ "rematerializable" ],
-       mode          => $mode_gp,
-       comment     => "construct Not: Not(a) = !a",
-       reg_req     => { in => [ "gp" ], out => [ "gp" ] },
-       emit        => '. xnor %S1, %%g0, %D1'
+       irn_flags => [ "rematerializable" ],
+       mode      => $mode_gp,
+       reg_req   => { in => [ "gp" ], out => [ "gp" ] },
+       emit      => '. xnor %S1, %%g0, %D1'
 },
 
 Nop => {
@@ -505,68 +466,110 @@ Nop => {
        emit     => '. nop',
 },
 
-fAdd => {
+fadd => {
        op_flags  => [ "commutative" ],
        irn_flags => [ "rematerializable" ],
-       comment   => "construct FP Add: Add(a, b) = Add(b, a) = a + b",
        reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
-       emit      => '. fadd%FPM %S1, %S2, %D1'
+       emit      => '. fadd%FPM %S1, %S2, %D1',
+       attr_type => "sparc_fp_attr_t",
+       attr      => "ir_mode *fp_mode",
+       mode      => $mode_fp,
 },
 
-fMul => {
-       op_flags  => [ "commutative" ],
-       comment   => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
+fsub => {
+       irn_flags => [ "rematerializable" ],
        reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
-       emit      =>'. fmul%FPM %S1, %S2, %D1'
+       emit      => '. fsub%FPM %S1, %S2, %D1',
+       attr_type => "sparc_fp_attr_t",
+       attr      => "ir_mode *fp_mode",
+       mode      => $mode_fp,
 },
 
-fsMuld => {
+fmul => {
+       irn_flags => [ "rematerializable" ],
        op_flags  => [ "commutative" ],
-       comment   => "construct FP single to double precision Mul: Mul(a, b) = Mul(b, a) = a * b",
        reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
-       emit      =>'. fsmuld %S1, %S2, %D1'
+       emit      =>'. fmul%FPM %S1, %S2, %D1',
+       attr_type => "sparc_fp_attr_t",
+       attr      => "ir_mode *fp_mode",
+       mode      => $mode_fp,
 },
 
-FpSToFpD => {
+fdiv => {
        irn_flags => [ "rematerializable" ],
-       comment   => "convert FP (single) to FP (double)",
-       reg_req   => { in => [ "fp" ], out => [ "fp" ] },
-       emit      =>'. FsTOd %S1, %D1'
+       reg_req   => { in => [ "fp", "fp" ], out => [ "fp", "none" ] },
+       emit      => '. fdiv%FPM %S1, %S2, %D1',
+       attr_type => "sparc_fp_attr_t",
+       attr      => "ir_mode *fp_mode",
+       outs      => [ "res", "M" ],
 },
 
-FpDToFpS => {
+fneg => {
        irn_flags => [ "rematerializable" ],
-       comment   => "convert FP (double) to FP (single)",
        reg_req   => { in => [ "fp" ], out => [ "fp" ] },
-       emit      =>'. FdTOs %S1, %D1'
+       emit      => '. fneg%FPM %S1, %D1',
+       attr_type => "sparc_fp_attr_t",
+       attr      => "ir_mode *fp_mode",
+       mode      => $mode_fp,
 },
 
-FpSToInt => {
+"fabs" => {
        irn_flags => [ "rematerializable" ],
-       comment   => "convert integer to FP",
-       reg_req   => { in => [ "fp" ], out => [ "gp" ] },
-       emit      =>'. FiTOs %S1, %D1'
+       reg_req   => { in => [ "fp" ], out => [ "fp" ] },
+       emit      => '. fabs%FPM %S1, %D1',
+       attr_type => "sparc_fp_attr_t",
+       attr      => "ir_mode *fp_mode",
+       mode      => $mode_fp,
 },
 
-FpDToInt => {
+fftof => {
        irn_flags => [ "rematerializable" ],
-       comment   => "convert integer to FP",
-       reg_req   => { in => [ "fp" ], out => [ "gp" ] },
-       emit      =>'. FiTOd %S1, %D1'
+       reg_req   => { in => [ "fp" ], out => [ "fp" ] },
+       emit      => '. f%FCONVS.to%FCONVD %S1, %D1',
+       attr_type => "sparc_fp_conv_attr_t",
+       attr      => "ir_mode *src_mode, ir_mode *dest_mode",
+       mode      => $mode_fp,
 },
 
-IntToFpS => {
+fitof => {
        irn_flags => [ "rematerializable" ],
-       comment   => "convert FP (single) to integer",
        reg_req   => { in => [ "gp" ], out => [ "fp" ] },
-       emit      =>'. FsTOi %S1, %D1'
+       emit      => '. fito%FPM %S1, %D1',
+       attr_type => "sparc_fp_attr_t",
+       attr      => "ir_mode *fp_mode",
+       mode      => $mode_fp,
 },
 
-IntToFpD => {
+fftoi => {
        irn_flags => [ "rematerializable" ],
-       comment   => "convert FP (double) to integer",
-       reg_req   => { in => [ "gp" ], out => [ "fp" ] },
-       emit      =>'. FdTOi %S1, %D1'
+       reg_req   => { in => [ "fp" ], out => [ "gp" ] },
+       emit      => '. f%FPM.toi %S1, %D1',
+       attr_type => "sparc_fp_attr_t",
+       attr      => "ir_mode *fp_mode",
+       mode      => $mode_gp,
+},
+
+Ldf => {
+       op_flags  => [ "labeled", "fragile" ],
+       state     => "exc_pinned",
+       ins       => [ "ptr", "mem" ],
+       outs      => [ "res", "M" ],
+       reg_req   => { in => [ "gp", "none" ], out => [ "fp", "none" ] },
+       attr_type => "sparc_load_store_attr_t",
+       attr      => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
+       emit      => '. ld [%S1%O], %D1'
+},
+
+Stf => {
+       op_flags  => [ "labeled", "fragile" ],
+       state     => "exc_pinned",
+       ins       => [ "ptr", "val", "mem" ],
+       outs      => [ "M" ],
+       reg_req   => { in => [ "gp", "fp", "none" ], out => [ "none" ] },
+       attr_type => "sparc_load_store_attr_t",
+       attr      => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
+       emit      => '. st %S2, [%S1%O]',
+       mode      => 'mode_M',
 },
 
 ); # end of %nodes