ia32_IJmp needs the no-out-requirements hack, too.
[libfirm] / ir / be / ia32 / ia32_spec.pl
index 8307d45..ff82198 100644 (file)
@@ -103,7 +103,7 @@ $arch = "ia32";
 #   0 - no special type
 #   1 - caller save (register must be saved by the caller of a function)
 #   2 - callee save (register must be saved by the called function)
-#   4 - ignore (do not assign this register)
+#   4 - ignore (do not automatically assign this register)
 #   8 - emitter can choose an arbitrary register of this class
 #  16 - the register is a virtual one
 #  32 - register represents a state
@@ -197,19 +197,22 @@ $arch = "ia32";
        S1 => "${arch}_emit_source_register(node, 1);",
        S2 => "${arch}_emit_source_register(node, 2);",
        S3 => "${arch}_emit_source_register(node, 3);",
+       SB0 => "${arch}_emit_8bit_source_register_or_immediate(node, 0);",
        SB1 => "${arch}_emit_8bit_source_register_or_immediate(node, 1);",
        SB2 => "${arch}_emit_8bit_source_register_or_immediate(node, 2);",
        SB3 => "${arch}_emit_8bit_source_register_or_immediate(node, 3);",
+       SH0 => "${arch}_emit_8bit_high_source_register(node, 0);",
+       SS0 => "${arch}_emit_16bit_source_register_or_immediate(node, 0);",
+       SI0 => "${arch}_emit_source_register_or_immediate(node, 0);",
        SI1 => "${arch}_emit_source_register_or_immediate(node, 1);",
        SI3 => "${arch}_emit_source_register_or_immediate(node, 3);",
        D0 => "${arch}_emit_dest_register(node, 0);",
        D1 => "${arch}_emit_dest_register(node, 1);",
+       DS0 => "${arch}_emit_dest_register_size(node, 0);",
        DB0 => "${arch}_emit_8bit_dest_register(node, 0);",
        X0 => "${arch}_emit_x87_register(node, 0);",
        X1 => "${arch}_emit_x87_register(node, 1);",
-       SE => "${arch}_emit_extend_suffix(get_ia32_ls_mode(node));",
-       ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
-                  ia32_emit_mode_suffix(node);",
+       EX => "${arch}_emit_extend_suffix(node);",
        M  => "${arch}_emit_mode_suffix(node);",
        XM => "${arch}_emit_x87_mode_suffix(node);",
        XXM => "${arch}_emit_xmm_mode_suffix(node);",
@@ -270,36 +273,40 @@ $custom_init_attr_func = \&ia32_custom_init_attr;
 
 %init_attr = (
        ia32_asm_attr_t =>
-               "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);\n".
+               "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
                "\tinit_ia32_x87_attributes(res);".
                "\tinit_ia32_asm_attributes(res);",
        ia32_attr_t     =>
-               "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);",
+               "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);",
        ia32_call_attr_t =>
-               "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);\n".
+               "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
                "\tinit_ia32_call_attributes(res, pop, call_tp);",
        ia32_condcode_attr_t =>
-               "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);\n".
+               "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
                "\tinit_ia32_condcode_attributes(res, pnc);",
        ia32_copyb_attr_t =>
-               "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);\n".
+               "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
                "\tinit_ia32_copyb_attributes(res, size);",
        ia32_immediate_attr_t =>
-               "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);\n".
-               "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);",
+               "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
+               "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, no_pic_adjust, offset);",
        ia32_x87_attr_t =>
-               "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res);\n".
+               "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
                "\tinit_ia32_x87_attributes(res);",
+       ia32_climbframe_attr_t =>
+               "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
+               "\tinit_ia32_climbframe_attributes(res, count);",
 );
 
 %compare_attr = (
        ia32_asm_attr_t       => "ia32_compare_asm_attr",
-       ia32_attr_t           => "ia32_compare_nodes_attr",
-       ia32_call_attr_t      => "ia32_compare_call_attr",
-       ia32_condcode_attr_t  => "ia32_compare_condcode_attr",
-       ia32_copyb_attr_t     => "ia32_compare_copyb_attr",
-       ia32_immediate_attr_t => "ia32_compare_immediate_attr",
-       ia32_x87_attr_t       => "ia32_compare_x87_attr",
+       ia32_attr_t            => "ia32_compare_nodes_attr",
+       ia32_call_attr_t       => "ia32_compare_call_attr",
+       ia32_condcode_attr_t   => "ia32_compare_condcode_attr",
+       ia32_copyb_attr_t      => "ia32_compare_copyb_attr",
+       ia32_immediate_attr_t  => "ia32_compare_immediate_attr",
+       ia32_x87_attr_t        => "ia32_compare_x87_attr",
+       ia32_climbframe_attr_t => "ia32_compare_climbframe_attr",
 );
 
 %operands = (
@@ -320,7 +327,7 @@ Immediate => {
        state     => "pinned",
        op_flags  => "c",
        reg_req   => { out => [ "gp_NOREG:I" ] },
-       attr      => "ir_entity *symconst, int symconst_sign, long offset",
+       attr      => "ir_entity *symconst, int symconst_sign, int no_pic_adjust, long offset",
        attr_type => "ia32_immediate_attr_t",
        hash_func => "ia32_hash_Immediate",
        latency   => 0,
@@ -433,10 +440,10 @@ Mul => {
        # very strict constraints
        state     => "exc_pinned",
        reg_req   => { in => [ "gp", "gp", "none", "eax", "gp" ],
-                      out => [ "eax", "flags", "edx", "none" ] },
+                      out => [ "eax", "flags", "none", "edx" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
        emit      => '. mul%M %unop4',
-       outs      => [ "res_low", "flags", "res_high", "M" ],
+       outs      => [ "res_low", "flags", "M", "res_high" ],
        am        => "source,binary",
        latency   => 10,
        units     => [ "GP" ],
@@ -448,8 +455,10 @@ l_Mul => {
        # very strict constraints
        op_flags  => "C",
        cmp_attr  => "return 1;",
-       outs      => [ "EAX", "flags", "EDX", "M" ],
-       arity     => 2
+       reg_req   => { in => [ "none", "none" ],
+                      out => [ "none", "none", "none", "none" ] },
+       ins       => [ "left", "right" ],
+       outs      => [ "res_low", "flags", "M", "res_high" ],
 },
 
 IMul => {
@@ -472,10 +481,10 @@ IMul1OP => {
        irn_flags => "R",
        state     => "exc_pinned",
        reg_req   => { in => [ "gp", "gp", "none", "eax", "gp" ],
-                      out => [ "eax", "flags", "edx", "none" ] },
+                      out => [ "eax", "flags", "none", "edx" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
        emit      => '. imul%M %unop4',
-       outs      => [ "res_low", "flags", "res_high", "M" ],
+       outs      => [ "res_low", "flags", "M", "res_high" ],
        am        => "source,binary",
        latency   => 5,
        units     => [ "GP" ],
@@ -485,8 +494,10 @@ IMul1OP => {
 l_IMul => {
        op_flags  => "C",
        cmp_attr  => "return 1;",
-       outs      => [ "res_low", "res_high", "M" ],
-       arity     => 2
+       reg_req   => { in => [ "none", "none" ],
+                      out => [ "none", "none", "none", "none" ] },
+       ins       => [ "left", "right" ],
+       outs      => [ "res_low", "flags", "M", "res_high" ],
 },
 
 And => {
@@ -750,8 +761,8 @@ ShlMem => {
 
 l_ShlDep => {
        cmp_attr => "return 1;",
+       reg_req  => { in => [ "none", "none", "none" ], out => [ "none" ] },
        ins      => [ "val", "count", "dep" ],
-       arity    => 3
 },
 
 ShlD => {
@@ -769,8 +780,8 @@ ShlD => {
 
 l_ShlD => {
        cmp_attr  => "return 1;",
+       reg_req  => { in => [ "none", "none", "none" ], out => [ "none" ] },
        ins       => [ "val_high", "val_low", "count" ],
-       arity     => 3,
 },
 
 Shr => {
@@ -800,8 +811,8 @@ ShrMem => {
 
 l_ShrDep => {
        cmp_attr  => "return 1;",
+       reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
        ins       => [ "val", "count", "dep" ],
-       arity     => 3
 },
 
 ShrD => {
@@ -819,7 +830,7 @@ ShrD => {
 
 l_ShrD => {
        cmp_attr  => "return 1;",
-       arity     => 3,
+       reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
        ins       => [ "val_high", "val_low", "count" ],
 },
 
@@ -851,7 +862,7 @@ SarMem => {
 l_SarDep => {
        cmp_attr  => "return 1;",
        ins       => [ "val", "count", "dep" ],
-       arity     => 3
+       reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
 },
 
 Ror => {
@@ -1057,9 +1068,10 @@ Cmp => {
 Cmp8Bit => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] ,
+                      out => [ "flags", "none", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
-       outs      => [ "eflags" ],
+       outs      => [ "eflags", "unused", "M" ],
        am        => "source,binary",
        emit      => '. cmpb %binop',
        attr      => "int ins_permuted, int cmp_unsigned",
@@ -1074,9 +1086,10 @@ Cmp8Bit => {
 Test => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "gp", "gp" ] ,
+                      out => [ "flags", "none", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
-       outs      => [ "eflags" ],
+       outs      => [ "eflags", "unused", "M" ],
        am        => "source,binary",
        emit      => '. test%M %binop',
        attr      => "int ins_permuted, int cmp_unsigned",
@@ -1091,9 +1104,10 @@ Test => {
 Test8Bit => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] ,
+                      out => [ "flags", "none", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
-       outs      => [ "eflags" ],
+       outs      => [ "eflags", "unused", "M" ],
        am        => "source,binary",
        emit      => '. testb %binop',
        attr      => "int ins_permuted, int cmp_unsigned",
@@ -1139,8 +1153,10 @@ CMov => {
        # (note: leave the false,true order intact to make it compatible with other
        #  ia32_binary ops)
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ],
+                      out => [ "in_r4 in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        attr_type => "ia32_condcode_attr_t",
        attr      => "int ins_permuted, pn_Cmp pnc",
@@ -1165,13 +1181,23 @@ Jcc => {
 SwitchJmp => {
        state     => "pinned",
        op_flags  => "L|X|Y",
-       reg_req   => { in => [ "gp" ], out => [ "none" ] },
+       reg_req   => { in => [ "gp" ] },
        mode      => "mode_T",
        attr_type => "ia32_condcode_attr_t",
        attr      => "long pnc",
        latency   => 3,
        units     => [ "BRANCH" ],
        modified_flags => $status_flags,
+       init_attr => "info->out_infos = NULL;", # XXX ugly hack for out requirements
+},
+
+Jmp => {
+       state    => "pinned",
+       op_flags => "X",
+       reg_req  => { out => [ "none" ] },
+       latency  => 1,
+       units    => [ "BRANCH" ],
+       mode     => "mode_X",
 },
 
 IJmp => {
@@ -1184,6 +1210,7 @@ IJmp => {
        latency   => 1,
        units     => [ "BRANCH" ],
        mode      => "mode_X",
+       init_attr => "info->out_infos = NULL;", # XXX ugly hack for out requirements
 },
 
 Const => {
@@ -1191,7 +1218,7 @@ Const => {
        irn_flags => "R",
        reg_req   => { out => [ "gp" ] },
        units     => [ "GP" ],
-       attr      => "ir_entity *symconst, int symconst_sign, long offset",
+       attr      => "ir_entity *symconst, int symconst_sign, int no_pic_adjust, long offset",
        attr_type => "ia32_immediate_attr_t",
        latency   => 1,
        mode      => $mode_gp,
@@ -1329,11 +1356,12 @@ Cltd => {
 Load => {
        op_flags  => "L|F",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none", "none" ] },
+       reg_req   => { in => [ "gp", "gp", "none" ],
+                      out => [ "gp", "none", "none", "none" ] },
        ins       => [ "base", "index", "mem" ],
-       outs      => [ "res", "M", "X_exc" ],
+       outs      => [ "res", "unused", "M", "X_exc" ],
        latency   => 0,
-       emit      => ". mov%SE%ME%.l %AM, %D0",
+       emit      => ". mov%EX%.l %AM, %D0",
        units     => [ "GP" ],
 },
 
@@ -1471,6 +1499,9 @@ LdTls => {
        latency   => 1,
 },
 
+#
+# BT supports source address mode, but this is unused yet
+#
 Bt => {
        irn_flags => "R",
        state     => "exc_pinned",
@@ -1483,6 +1514,54 @@ Bt => {
        modified_flags => $status_flags  # only CF is set, but the other flags are undefined
 },
 
+Bsf => {
+       irn_flags => "R",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none", "gp" ],
+                      out => [ "gp", "flags", "none" ] },
+       ins       => [ "base", "index", "mem", "operand" ],
+       outs      => [ "res", "flags", "M" ],
+       am        => "source,binary",
+       emit      => '. bsf%M %unop3, %D0',
+       units     => [ "GP" ],
+       latency   => 1,
+       mode      => $mode_gp,
+       modified_flags => $status_flags
+},
+
+Bsr => {
+       irn_flags => "R",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none", "gp" ],
+                      out => [ "gp", "flags", "none" ] },
+       ins       => [ "base", "index", "mem", "operand" ],
+       outs      => [ "res", "flags", "M" ],
+       am        => "source,binary",
+       emit      => '. bsr%M %unop3, %D0',
+       units     => [ "GP" ],
+       latency   => 1,
+       mode      => $mode_gp,
+       modified_flags => $status_flags
+},
+
+#
+# SSE4.2 or SSE4a popcnt instruction
+#
+Popcnt => {
+       irn_flags => "R",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none", "gp" ],
+                      out => [ "gp", "flags", "none" ] },
+       ins       => [ "base", "index", "mem", "operand" ],
+       outs      => [ "res", "flags", "M" ],
+       am        => "source,binary",
+       emit      => '. popcnt%M %unop3, %D0',
+       units     => [ "GP" ],
+       latency   => 1,
+       mode      => $mode_gp,
+       modified_flags => $status_flags
+},
+
 Call => {
        state     => "exc_pinned",
        reg_req   => {
@@ -1499,6 +1578,179 @@ Call => {
        modified_flags => $status_flags
 },
 
+#
+# a Helper node for frame-climbing, needed for __builtin_(frame|return)_address
+#
+# PS: try gcc __builtin_frame_address(100000) :-)
+#
+ClimbFrame => {
+       reg_req   => { in => [ "gp", "gp", "gp"], out => [ "in_r3" ] },
+       ins       => [ "frame", "cnt", "tmp" ],
+       outs      => [ "res" ],
+       latency   => 4, # random number
+       attr_type => "ia32_climbframe_attr_t",
+       attr      => "unsigned count",
+       units     => [ "GP" ],
+       mode      => $mode_gp
+},
+
+#
+# bswap
+#
+Bswap => {
+       irn_flags => "R",
+       reg_req   => { in => [ "gp" ],
+                      out => [ "in_r1" ] },
+       emit      => '. bswap%M %S0',
+       ins       => [ "val" ],
+       units     => [ "GP" ],
+       latency   => 1,
+       mode      => $mode_gp,
+},
+
+#
+# bswap16, use xchg here
+#
+Bswap16 => {
+       irn_flags => "R",
+       reg_req   => { in => [ "eax ebx ecx edx" ],
+                      out => [ "in_r1" ] },
+       emit      => '. xchg %SB0, %SH0',
+       ins       => [ "val" ],
+       units     => [ "GP" ],
+       latency   => 1,
+       mode      => $mode_gp,
+},
+
+#
+# BreakPoint
+#
+Breakpoint => {
+       state     => "pinned",
+       reg_req   => { in => [ "none" ], out => [ "none" ] },
+       ins       => [ "mem" ],
+       latency   => 0,
+       emit      => ". int3",
+       units     => [ "GP" ],
+       mode      => mode_M,
+},
+
+#
+# Undefined Instruction on ALL x86 CPU's
+#
+UD2 => {
+       state     => "pinned",
+       reg_req   => { in => [ "none" ], out => [ "none" ] },
+       ins       => [ "mem" ],
+       latency   => 0,
+       emit      => ". .value  0x0b0f",
+       units     => [ "GP" ],
+       mode      => mode_M,
+},
+
+#
+# outport
+#
+Outport => {
+       irn_flags => "R",
+       state     => "pinned",
+       reg_req   => { in => [ "edx", "eax", "none" ], out => [ "none" ] },
+       ins       => [ "port", "value", "mem" ],
+       emit      => '. out%M %SS0, %SI1',
+       units     => [ "GP" ],
+       latency   => 1,
+       mode      => mode_M,
+       modified_flags => $status_flags
+},
+
+#
+# inport
+#
+Inport => {
+       irn_flags => "R",
+       state     => "pinned",
+       reg_req   => { in => [ "edx", "none" ], out => [ "eax", "none" ] },
+       ins       => [ "port", "mem" ],
+       outs      => [ "res", "M" ],
+       emit      => '. in%M %DS0, %SS0',
+       units     => [ "GP" ],
+       latency   => 1,
+       mode      => mode_T,
+       modified_flags => $status_flags
+},
+
+#
+# Intel style prefetching
+#
+Prefetch0 => {
+       op_flags  => "L|F",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
+       ins       => [ "base", "index", "mem" ],
+       outs      => [ "M" ],
+       latency   => 0,
+       emit      => ". prefetcht0 %AM",
+       units     => [ "GP" ],
+},
+
+Prefetch1 => {
+       op_flags  => "L|F",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
+       ins       => [ "base", "index", "mem" ],
+       outs      => [ "M" ],
+       latency   => 0,
+       emit      => ". prefetcht1 %AM",
+       units     => [ "GP" ],
+},
+
+Prefetch2 => {
+       op_flags  => "L|F",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
+       ins       => [ "base", "index", "mem" ],
+       outs      => [ "M" ],
+       latency   => 0,
+       emit      => ". prefetcht2 %AM",
+       units     => [ "GP" ],
+},
+
+PrefetchNTA => {
+       op_flags  => "L|F",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
+       ins       => [ "base", "index", "mem" ],
+       outs      => [ "M" ],
+       latency   => 0,
+       emit      => ". prefetchnta %AM",
+       units     => [ "GP" ],
+},
+
+#
+# 3DNow! prefetch instructions
+#
+Prefetch => {
+       op_flags  => "L|F",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
+       ins       => [ "base", "index", "mem" ],
+       outs      => [ "M" ],
+       latency   => 0,
+       emit      => ". prefetch %AM",
+       units     => [ "GP" ],
+},
+
+PrefetchW => {
+       op_flags  => "L|F",
+       state     => "exc_pinned",
+       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
+       ins       => [ "base", "index", "mem" ],
+       outs      => [ "M" ],
+       latency   => 0,
+       emit      => ". prefetchw %AM",
+       units     => [ "GP" ],
+},
+
 #-----------------------------------------------------------------------------#
 #   _____ _____ ______    __ _             _                     _            #
 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
@@ -1582,8 +1834,10 @@ xMovd  => {
 xAdd => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. add%XXM %binop',
        latency   => 4,
@@ -1594,8 +1848,10 @@ xAdd => {
 xMul => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. mul%XXM %binop',
        latency   => 4,
@@ -1606,8 +1862,10 @@ xMul => {
 xMax => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. max%XXM %binop',
        latency   => 2,
@@ -1618,8 +1876,10 @@ xMax => {
 xMin => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. min%XXM %binop',
        latency   => 2,
@@ -1630,8 +1890,10 @@ xMin => {
 xAnd => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. andp%XSD %binop',
        latency   => 3,
@@ -1642,8 +1904,10 @@ xAnd => {
 xOr => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. orp%XSD %binop',
        latency   => 3,
@@ -1654,8 +1918,10 @@ xOr => {
 xXor => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. xorp%XSD %binop',
        latency   => 3,
@@ -1668,8 +1934,10 @@ xXor => {
 xAndNot => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 !in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. andnp%XSD %binop',
        latency   => 3,
@@ -1680,8 +1948,10 @@ xAndNot => {
 xSub => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "minuend", "subtrahend" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
        emit      => '. sub%XXM %binop',
        latency   => 4,
@@ -1692,10 +1962,11 @@ xSub => {
 xDiv => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "in_r4 !in_r5", "flags", "none" ] },
        ins       => [ "base", "index", "mem", "dividend", "divisor" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,binary",
-       outs      => [ "res", "M" ],
        emit      => '. div%XXM %binop',
        latency   => 16,
        units     => [ "SSE" ],
@@ -1706,7 +1977,8 @@ xDiv => {
 Ucomi => {
        irn_flags => "R",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
+                      out => [ "eflags" ] },
        ins       => [ "base", "index", "mem", "left", "right" ],
        outs      => [ "flags" ],
        am        => "source,binary",
@@ -1724,9 +1996,10 @@ Ucomi => {
 xLoad => {
        op_flags  => "L|F",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none", "none" ] },
+       reg_req   => { in => [ "gp", "gp", "none" ],
+                      out => [ "xmm", "none", "none", "none" ] },
        ins       => [ "base", "index", "mem" ],
-       outs      => [ "res", "M", "X_exc" ],
+       outs      => [ "res", "unused", "M", "X_exc" ],
        emit      => '. mov%XXM %AM, %D0',
        attr      => "ir_mode *load_mode",
        init_attr => "attr->ls_mode = load_mode;",
@@ -1749,8 +2022,9 @@ xStore => {
 xStoreSimple => {
        op_flags => "L|F",
        state    => "exc_pinned",
-       reg_req  => { in => [ "gp", "gp", "none", "xmm" ] },
+       reg_req  => { in => [ "gp", "gp", "none", "xmm" ], out => [ "none" ] },
        ins      => [ "base", "index", "mem", "val" ],
+       outs     => [ "M" ],
        emit     => '. mov%XXM %S3, %AM',
        latency  => 0,
        units    => [ "SSE" ],
@@ -1786,6 +2060,7 @@ l_LLtoFloat => {
        op_flags => "L|F",
        cmp_attr => "return 1;",
        ins      => [ "val_high", "val_low" ],
+       reg_req  => { in => [ "none", "none" ], out => [ "none" ] }
 },
 
 l_FloattoLL => {
@@ -1793,6 +2068,7 @@ l_FloattoLL => {
        cmp_attr => "return 1;",
        ins      => [ "val" ],
        outs     => [ "res_high", "res_low" ],
+       reg_req  => { in => [ "none" ], out => [ "none", "none" ] }
 },
 
 # CopyB
@@ -1838,9 +2114,10 @@ Cwtl => {
 
 Conv_I2I => {
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "gp" ],
+                      out => [ "gp", "none", "none" ] },
        ins       => [ "base", "index", "mem", "val" ],
-       outs      => [ "res", "M" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,unary",
        units     => [ "GP" ],
        latency   => 1,
@@ -1851,8 +2128,10 @@ Conv_I2I => {
 
 Conv_I2I8Bit => {
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ],
+                      out => [ "gp", "none", "none" ] },
        ins       => [ "base", "index", "mem", "val" ],
+       outs      => [ "res", "flags", "M" ],
        am        => "source,unary",
        units     => [ "GP" ],
        latency   => 1,
@@ -1990,9 +2269,10 @@ vfld => {
        irn_flags => "R",
        op_flags  => "L|F",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none", "none" ] },
+       reg_req   => { in => [ "gp", "gp", "none" ],
+                      out => [ "vfp", "none", "none", "none" ] },
        ins       => [ "base", "index", "mem" ],
-       outs      => [ "res", "M", "X_exc" ],
+       outs      => [ "res", "unused", "M", "X_exc" ],
        attr      => "ir_mode *load_mode",
        init_attr => "attr->attr.ls_mode = load_mode;",
        latency   => 2,
@@ -2004,7 +2284,8 @@ vfst => {
        irn_flags => "R",
        op_flags  => "L|F",
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "vfp" ], out => [ "none", "none" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "vfp" ],
+                      out => [ "none", "none" ] },
        ins       => [ "base", "index", "mem", "val" ],
        outs      => [ "M", "X_exc" ],
        attr      => "ir_mode *store_mode",
@@ -2019,8 +2300,9 @@ vfst => {
 
 vfild => {
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
-       outs      => [ "res", "M" ],
+       reg_req   => { in => [ "gp", "gp", "none" ],
+                      out => [ "vfp", "none", "none" ] },
+       outs      => [ "res", "unused", "M" ],
        ins       => [ "base", "index", "mem" ],
        latency   => 4,
        units     => [ "VFP" ],
@@ -2029,8 +2311,9 @@ vfild => {
 
 vfist => {
        state     => "exc_pinned",
-       reg_req   => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
+       reg_req   => { in => [ "gp", "gp", "none", "vfp", "fpcw" ], out => [ "none" ] },
        ins       => [ "base", "index", "mem", "val", "fpcw" ],
+       outs      => [ "M" ],
        latency   => 4,
        units     => [ "VFP" ],
        mode      => "mode_M",
@@ -2401,7 +2684,7 @@ fistp => {
        latency   => 2,
 },
 
-# SSE3 firsttp instruction
+# SSE3 fisttp instruction
 fisttp => {
        state     => "exc_pinned",
        rd_constructor => "NONE",
@@ -2483,7 +2766,7 @@ fldl2e => {
 
 fxch => {
        op_flags  => "R|K",
-       reg_req   => { },
+       reg_req   => { out => [ "none" ] },
        cmp_attr  => "return 1;",
        emit      => '. fxch %X0',
        attr_type => "ia32_x87_attr_t",
@@ -2493,7 +2776,7 @@ fxch => {
 
 fpush => {
        op_flags  => "R|K",
-       reg_req   => {},
+       reg_req   => { out => [ "none" ] },
        cmp_attr  => "return 1;",
        emit      => '. fld %X0',
        attr_type => "ia32_x87_attr_t",
@@ -2511,7 +2794,7 @@ fpushCopy => {
 
 fpop => {
        op_flags  => "K",
-       reg_req   => { },
+       reg_req   => { out => [ "none" ] },
        cmp_attr  => "return 1;",
        emit      => '. fstp %X0',
        attr_type => "ia32_x87_attr_t",
@@ -2521,7 +2804,7 @@ fpop => {
 
 ffreep => {
        op_flags  => "K",
-       reg_req   => { },
+       reg_req   => { out => [ "none" ] },
        cmp_attr  => "return 1;",
        emit      => '. ffreep %X0',
        attr_type => "ia32_x87_attr_t",
@@ -2531,7 +2814,7 @@ ffreep => {
 
 emms => {
        op_flags  => "K",
-       reg_req   => { },
+       reg_req   => { out => [ "none" ] },
        cmp_attr  => "return 1;",
        emit      => '. emms',
        attr_type => "ia32_x87_attr_t",
@@ -2541,7 +2824,7 @@ emms => {
 
 femms => {
        op_flags  => "K",
-       reg_req   => { },
+       reg_req   => { out => [ "none" ] },
        cmp_attr  => "return 1;",
        emit      => '. femms',
        attr_type => "ia32_x87_attr_t",