Add some Processor specific instruction selections
[libfirm] / ir / be / ia32 / ia32_spec.pl
index 9bb8eaa..e892c06 100644 (file)
@@ -9,7 +9,7 @@ $arch = "ia32";
 $comment_string = "/*";
 
 # the number of additional opcodes you want to register
-$additional_opcodes = 0;
+#$additional_opcodes = 0;
 
 # The node description is done as a perl hash initializer with the
 # following structure:
@@ -103,7 +103,8 @@ $additional_opcodes = 0;
             { "name" => "edi", "type" => 2 },
             { "name" => "ebp", "type" => 2 },
             { "name" => "esp", "type" => 4 },
-            { "name" => "gp_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
+            { "name" => "gp_NOREG", "type" => 6 },  # we need a dummy register for NoReg nodes
+            { "name" => "gp_UKNWN", "type" => 6 },  # we need a dummy register for Unknown nodes
                        { "mode" => "mode_P" }
           ],
   "xmm" => [
@@ -115,7 +116,8 @@ $additional_opcodes = 0;
             { "name" => "xmm5", "type" => 1 },
             { "name" => "xmm6", "type" => 1 },
             { "name" => "xmm7", "type" => 1 },
-            { "name" => "xmm_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
+            { "name" => "xmm_NOREG", "type" => 6 },  # we need a dummy register for NoReg nodes
+            { "name" => "xmm_UKNWN", "type" => 6 },  # we need a dummy register for Unknown nodes
                        { "mode" => "mode_D" }
           ],
   "vfp" => [
@@ -126,8 +128,9 @@ $additional_opcodes = 0;
             { "name" => "vf4", "type" => 1 },
             { "name" => "vf5", "type" => 1 },
             { "name" => "vf6", "type" => 1 },
-            { "name" => "vf7", "type" => 4 },
-            { "name" => "vfp_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
+            { "name" => "vf7", "type" => 1 },
+            { "name" => "vfp_NOREG", "type" => 6 },  # we need a dummy register for NoReg nodes
+            { "name" => "vfp_UKNWN", "type" => 6 },  # we need a dummy register for Unknown nodes
                        { "mode" => "mode_E" }
           ],
   "st" => [
@@ -139,7 +142,8 @@ $additional_opcodes = 0;
             { "name" => "st5", "type" => 1 },
             { "name" => "st6", "type" => 1 },
             { "name" => "st7", "type" => 1 },
-            { "name" => "st_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
+            { "name" => "st_NOREG", "type" => 6 },  # we need a dummy register for NoReg nodes
+            { "name" => "st_UKNWN", "type" => 6 },  # we need a dummy register for Unknown nodes
                        { "mode" => "mode_E" }
           ]
 ); # %reg_classes
@@ -199,7 +203,7 @@ $additional_opcodes = 0;
   "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "eax in_r3", "edx in_r4" ] },
-  "emit"      => '. imul %ia32_emit_unop /* Mulh(%A1, %A2) -> %D1 */'
+  "emit"      => '. imul %ia32_emit_binop /* Mulh(%A1, %A2) -> %D1 */'
 },
 
 "And" => {
@@ -277,10 +281,13 @@ $additional_opcodes = 0;
 },
 
 "DivMod" => {
-  "op_flags" => "F|L",
-  "state"    => "exc_pinned",
-  "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "eax in_r1", "edx in_r3" ] },
-  "emit"     =>
+  "op_flags"  => "F|L",
+  "state"     => "exc_pinned",
+  "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "eax in_r1", "edx in_r3" ] },
+  "attr"      => "ia32_op_flavour_t dm_flav",
+  "init_attr" => "  attr->data.op_flav = dm_flav;",
+  "cmp_attr"  => "  return attr_a->data.op_flav != attr_b->data.op_flav;\n",
+  "emit"      =>
 '  if (mode_is_signed(get_irn_mode(n))) {
 4.  idiv %S2 /* signed DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
   }
@@ -407,19 +414,6 @@ $additional_opcodes = 0;
   "comment"   => "represents an integer constant",
   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
   "reg_req"   => { "out" => [ "gp" ] },
-  "emit"      =>
-'  if (get_ia32_Immop_tarval(n) == get_tarval_null(get_irn_mode(n))) {
-4.   sub %D1, %D1 /* optimized mov 0 to register */
-  }
-  else {
-    if (get_ia32_op_type(n) == ia32_SymConst) {
-6.    mov %D1, OFFSET FLAT:%C /* Move address of SymConst into register */
-    }
-       else {
-6.    mov %D1, %C /* Mov Const into register */
-       }
-  }
-',
 },
 
 "Cdq" => {
@@ -462,25 +456,50 @@ $additional_opcodes = 0;
   "state"     => "exc_pinned",
   "comment"   => "construct 8Bit Store: Store(ptr, val, mem) = ST ptr,val",
   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
-  "reg_req"   => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ] }
+  "reg_req"   => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ] },
+  "emit"      => '. mov %ia32_emit_binop /* Store(%A3) -> (%A1) */'
 },
 
 "Lea" => {
   "irn_flags" => "R",
   "comment"   => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8",
   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
-  "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+  "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
   "emit"      => '. lea %D1, %ia32_emit_am /* LEA(%A1, %A2) */'
 },
 
-#--------------------------------------------------------#
-#    __ _             _                     _            #
-#   / _| |           | |                   | |           #
-#  | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
-#  |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
-#  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
-#  |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
-#--------------------------------------------------------#
+"Push" => {
+  "comment"   => "push a gp register on the stack",
+  "reg_req"   => { "in" => [ "esp", "gp", "none" ], "out" => [ "gp" ] },
+  "emit"      => '. push %S2 /* Push(%A2) */'
+},
+
+"Pop" => {
+  "comment"   => "pop a gp register from the stack",
+  "reg_req"   => { "in" => [ "esp", "none" ], "out" => [ "gp", "esp" ] },
+  "emit"      => '. pop %D1 /* Pop -> %D1 */'
+},
+
+"Enter" => {
+  "comment"   => "create stack frame",
+  "reg_req"   => { "in" => [ "esp" ], "out" => [ "ebp", "esp" ] },
+  "emit"      => '. enter /* Enter */'
+},
+
+"Leave" => {
+  "comment"   => "destroy stack frame",
+  "reg_req"   => { "in" => [ "esp", "ebp" ], "out" => [ "ebp", "esp" ] },
+  "emit"      => '. leave /* Leave */'
+},
+
+#-----------------------------------------------------------------------------#
+#   _____ _____ ______    __ _             _                     _            #
+#  / ____/ ____|  ____|  / _| |           | |                   | |           #
+# | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
+#  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
+#  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
+# |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
+#-----------------------------------------------------------------------------#
 
 # commutative operations
 
@@ -618,44 +637,47 @@ $additional_opcodes = 0;
 
 "Conv_I2I" => {
   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3", "none" ] },
-  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
+  "cmp_attr"  => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
   "comment"  => "construct Conv Int -> Int"
 },
 
 "Conv_I2I8Bit" => {
   "reg_req"  => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ], "out" => [ "in_r3", "none" ] },
-  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
+  "cmp_attr"  => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
   "comment"  => "construct Conv Int -> Int"
 },
 
 "Conv_I2FP" => {
   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "xmm", "none" ] },
-  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
+  "cmp_attr"  => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
   "comment"  => "construct Conv Int -> Floating Point"
 },
 
 "Conv_FP2I" => {
   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "gp", "none" ] },
-  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
+  "cmp_attr"  => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
   "comment"  => "construct Conv Floating Point -> Int"
 },
 
 "Conv_FP2FP" => {
   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "xmm", "none" ] },
-  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
+  "cmp_attr"  => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
   "comment"  => "construct Conv Floating Point -> Floating Point",
 },
 
-#--------------------------------------------------------#
-#    __ _             _                     _            #
-#   / _| |           | |                   | |           #
-#  | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
-#  |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
-#  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
-#  |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
-#--------------------------------------------------------#
-
-# virtual float nodes
+#----------------------------------------------------------#
+#        _      _               _    __ _             _    #
+#       (_)    | |             | |  / _| |           | |   #
+# __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
+# \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
+#  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
+#   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
+#                 | |                                      #
+#  _ __   ___   __| | ___  ___                             #
+# | '_ \ / _ \ / _` |/ _ \/ __|                            #
+# | | | | (_) | (_| |  __/\__ \                            #
+# |_| |_|\___/ \__,_|\___||___/                            #
+#----------------------------------------------------------#
 
 "vfadd" => {
   "irn_flags" => "R",
@@ -678,25 +700,12 @@ $additional_opcodes = 0;
   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
 },
 
-"vfsubr" => {
-  "irn_flags" => "R",
-  "comment"   => "virtual fp SubR: SubR(a, b) = b - a",
-  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
-  "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
-},
-
 "vfdiv" => {
   "comment"   => "virtual fp Div: Div(a, b) = a / b",
   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
 },
 
-"vfdivr" => {
-  "comment"   => "virtual fp DivR: DivR(a, b) = b / a",
-  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
-  "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
-},
-
 "vfabs" => {
   "irn_flags" => "R",
   "comment"   => "virtual fp Abs: Abs(a) = |a|",
@@ -813,273 +822,291 @@ $additional_opcodes = 0;
   "reg_req"   => { "out" => [ "vfp" ] },
 },
 
-#--------------------------------------------------------#
-#    __ _             _                     _            #
-#   / _| |           | |                   | |           #
-#  | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
-#  |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
-#  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
-#  |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
-#--------------------------------------------------------#
-
-# x87 float nodes
+#------------------------------------------------------------------------#
+#       ___ _____    __ _             _                     _            #
+# __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
+# \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
+#  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
+# /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
+#------------------------------------------------------------------------#
 
 "fadd" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
   "reg_req"   => { },
-#  "emit"      => '. fadd %ia32_emit_binop /* x87 fadd(%A1, %A2) -> %D1 */'
-  "emit"      => '. fadd %X1, %X2 /* x87 fadd(%X1, %X2) -> %X3 */'
+  "emit"      => '. fadd %ia32_emit_x87_binop /* x87 fadd(%A1, %A2) -> %D1 */'
 },
 
 "faddp" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
   "reg_req"   => { },
-#  "emit"      => '. faddp %ia32_emit_binop /* x87 fadd(%A1, %A2) -> %D1 */'
-  "emit"      => '. faddp %X1, %X2 /* x87 fadd(%X1, %X2) -> %X3 and pop */'
+  "emit"      => '. faddp %ia32_emit_x87_binop /* x87 fadd(%A1, %A2) -> %D1 */'
 },
 
 "fmul" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
   "reg_req"   => { },
-#  "emit"      => '. fmul %ia32_emit_binop /* x87 fmul(%A1, %A2) -> %D1 */'
-  "emit"      => '. fmul %X1, %X2 /* x87 fmul(%X1, %X2) -> %X3 */'
+  "emit"      => '. fmul %ia32_emit_x87_binop /* x87 fmul(%A1, %A2) -> %D1 */'
 },
 
 "fmulp" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
   "reg_req"   => { },
-#  "emit"      => '. fmulp %ia32_emit_binop /* x87 fmul(%A1, %A2) -> %D1 */'
-  "emit"      => '. fmulp %X1, %X2 /* x87 fmul(%X1, %X2) -> %X3 and pop */'
+  "emit"      => '. fmulp %ia32_emit_x87_binop /* x87 fmul(%A1, %A2) -> %D1 */'
 },
 
 "fsub" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
   "reg_req"   => { },
-#  "emit"      => '. fsub %ia32_emit_binop /* x87 fsub(%A1, %A2) -> %D1 */'
-  "emit"      => '. fsub %X1, %X2 /* x87 fsub(%X1, %X2) -> %X3 */'
+  "emit"      => '. fsub %ia32_emit_x87_binop /* x87 fsub(%A1, %A2) -> %D1 */'
 },
 
 "fsubp" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
   "reg_req"   => { },
-#  "emit"      => '. fsubp %ia32_emit_binop /* x87 fsub(%A1, %A2) -> %D1 */'
-  "emit"      => '. fsubp %X1, %X2 /* x87 fsub(%X1, %X2) -> %X3 and pop */'
+  "emit"      => '. fsubp %ia32_emit_x87_binop /* x87 fsub(%A1, %A2) -> %D1 */'
 },
 
 "fsubr" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "irn_flags" => "R",
   "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
   "reg_req"   => { },
-#  "emit"      => '. fsubr %ia32_emit_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
-  "emit"      => '. fsubr %X1, %X2 /* x87 fsubr(%X1, %X2) -> %X3 */'
+  "emit"      => '. fsubr %ia32_emit_x87_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
 },
 
 "fsubrp" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "irn_flags" => "R",
   "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
   "reg_req"   => { },
-#  "emit"      => '. fsubrp %ia32_emit_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
-  "emit"      => '. fsubrp %X1, %X2 /* x87 fsubr(%X1, %X2) -> %X3 and pop */'
+  "emit"      => '. fsubrp %ia32_emit_x87_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
 },
 
 "fdiv" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Div: Div(a, b) = a / b",
   "reg_req"   => { },
-#  "emit"      => '. fdiv %ia32_emit_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
-  "emit"      => '. fdiv %X1, %X2 /* x87 fdiv(%X1, %X2) -> %X3 */'
+  "emit"      => '. fdiv %ia32_emit_x87_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
 },
 
 "fdivp" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Div: Div(a, b) = a / b",
   "reg_req"   => { },
-#  "emit"      => '. fdivp %ia32_emit_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
-  "emit"      => '. fdivp %X1, %X2 /* x87 fdiv(%X1, %X2) -> %X3 and pop */'
+  "emit"      => '. fdivp %ia32_emit_x87_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
 },
 
 "fdivr" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
   "reg_req"   => { },
-#  "emit"      => '. fdivr %ia32_emit_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
-  "emit"      => '. fdivr %X1, %X2 /* x87 fdivr(%X1, %X2) -> %X3 */'
+  "emit"      => '. fdivr %ia32_emit_x87_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
 },
 
 "fdivrp" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
   "reg_req"   => { },
-#  "emit"      => '. fdivrp %ia32_emit_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
-  "emit"      => '. fdivrp %X1, %X2 /* x87 fdivr(%X1, %X2) -> %X3 and pop */'
+  "emit"      => '. fdivrp %ia32_emit_x87_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
 },
 
 "fabs" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Abs: Abs(a) = |a|",
   "reg_req"   => { },
-  "emit"      => '. fabs %X1 /* x87 fabs(%X1) -> %X3 */'
+  "emit"      => '. fabs /* x87 fabs(%S1) -> %D1 */'
 },
 
 "fchs" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Chs: Chs(a) = -a",
   "reg_req"   => { },
-  "emit"      => '. fchs %X1 /* x87 fchs(%X1) -> %X3 */'
+  "emit"      => '. fchs /* x87 fchs(%S1) -> %D1 */'
 },
 
 "fsin" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Sin: Sin(a) = sin(a)",
   "reg_req"   => { },
-  "emit"      => '. fsin %X1 /* x87 sin(%X1) -> %X3 */'
+  "emit"      => '. fsin /* x87 sin(%S1) -> %D1 */'
 },
 
 "fcos" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Cos: Cos(a) = cos(a)",
   "reg_req"   => { },
-  "emit"      => '. fcos %X1 /* x87 cos(%X1) -> %X3 */'
+  "emit"      => '. fcos /* x87 cos(%S1) -> %D1 */'
 },
 
 "fsqrt" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Sqrt: Sqrt(a) = a ^ 0.5",
   "reg_req"   => { },
-  "emit"      => '. fsqrt %X1 $ /* x87 sqrt(%X1) -> %X3 */'
+  "emit"      => '. fsqrt $ /* x87 sqrt(%S1) -> %D1 */'
 },
 
 # x87 Load and Store
 
 "fld" => {
   "rd_constructor" => "NONE",
-  "op_flags"  => "L|F",
+  "op_flags"  => "R|L|F",
   "state"     => "exc_pinned",
   "comment"   => "x87 fp Load: Load(ptr, mem) = LD ptr -> reg",
   "reg_req"   => { },
-  "emit"      => '. fld %X3, %ia32_emit_am /* Load((%A1)) -> %X3 */'
+  "emit"      => '. fld %ia32_emit_am /* Load((%A1)) -> %D1 */'
 },
 
 "fst" => {
   "rd_constructor" => "NONE",
-  "op_flags"  => "L|F",
+  "op_flags"  => "R|L|F",
   "state"     => "exc_pinned",
   "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
   "reg_req"   => { },
-  "emit"      => '. fst %ia32_emit_binop /* Store(%X3) -> (%A1) */'
+  "emit"      => '. fst %ia32_emit_am /* Store(%A3) -> (%A1) */'
 },
 
 "fstp" => {
   "rd_constructor" => "NONE",
-  "op_flags"  => "L|F",
+  "op_flags"  => "R|L|F",
   "state"     => "exc_pinned",
   "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
   "reg_req"   => { },
-  "emit"      => '. fstp %ia32_emit_binop /* Store(%X3) -> (%A1) and pop */'
+  "emit"      => '. fstp %ia32_emit_am /* Store(%A3) -> (%A1) and pop */'
 },
 
 # Conversions
 
 "fild" => {
+  "op_flags"  => "R",
   "irn_flags" => "R",
   "comment"   => "x87 fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
   "reg_req"   => { },
-  "emit"      => '. fild %X3, %ia32_emit_am /* integer Load((%A1)) -> %X3 */'
+  "emit"      => '. fild %ia32_emit_am /* integer Load((%A1)) -> %D1 */'
 },
 
 "fist" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
   "reg_req"   => { },
-  "emit"      => '. fist %ia32_emit_binop /* integer Store(%X3) -> (%A1) */'
+  "emit"      => '. fist %ia32_emit_am /* integer Store(%A3) -> (%A1) */'
 },
 
 "fistp" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
   "reg_req"   => { },
-  "emit"      => '. fistp %ia32_emit_binop /* integer Store(%X3) -> (%A1) and pop */'
+  "emit"      => '. fistp %ia32_emit_am /* integer Store(%A3) -> (%A1) and pop */'
 },
 
 # constants
 
 "fldz" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Load 0.0: Ld 0.0 -> reg",
   "reg_req"   => { },
-  "emit"      => '. fldz %X3 /* x87 0.0 -> %X3 */'
+  "emit"      => '. fldz /* x87 0.0 -> %D1 */'
 },
 
 "fld1" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Load 1.0: Ld 1.0 -> reg",
   "reg_req"   => { },
-  "emit"      => '. fld1 %X3 /* x87 1.0 -> %X3 */'
+  "emit"      => '. fld1 /* x87 1.0 -> %D1 */'
 },
 
 "fldpi" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Load pi: Ld pi -> reg",
   "reg_req"   => { },
-  "emit"      => '. fldpi %X3 /* x87 pi -> %X3 */'
+  "emit"      => '. fldpi /* x87 pi -> %D1 */'
 },
 
 "fldln2" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Load ln 2: Ld ln 2 -> reg",
   "reg_req"   => { },
-  "emit"      => '. fldln2 %X3 /* x87 ln(2) -> %X3 */'
+  "emit"      => '. fldln2 /* x87 ln(2) -> %D1 */'
 },
 
 "fldlg2" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Load lg 2: Ld lg 2 -> reg",
   "reg_req"   => { },
-  "emit"      => '. fldlg2 %X3 /* x87 log(2) -> %X3 */'
+  "emit"      => '. fldlg2 /* x87 log(2) -> %D1 */'
 },
 
 "fldl2t" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Load ld 10: Ld ld 10 -> reg",
   "reg_req"   => { },
-  "emit"      => '. fldll2t %X3 /* x87 ld(10) -> %X3 */'
+  "emit"      => '. fldll2t /* x87 ld(10) -> %D1 */'
 },
 
 "fldl2e" => {
+  "op_flags"  => "R",
   "rd_constructor" => "NONE",
   "comment"   => "x87 fp Load ld e: Ld ld e -> reg",
   "reg_req"   => { },
-  "emit"      => '. fldl2e %X3 /* x87 ld(e) -> %X3 */'
+  "emit"      => '. fldl2e /* x87 ld(e) -> %D1 */'
 },
 
 "fldConst" => {
+  "op_flags"  => "R",
   "op_flags"  => "c",
   "irn_flags" => "R",
   "comment"   => "represents a x87 constant",
   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
   "reg_req"   => { "out" => [ "st" ] },
-  "emit"      => '. fld%M %C /* Load fConst into register -> %X3 */',
+  "emit"      => '. fld%M %C /* Load fConst into register -> %D1 */',
 },
 
 # fxch, fpush
+# Note that it is NEVER allowed to do CSE on these nodes
 
 "fxch" => {
+  "op_flags"  => "R|K",
   "comment"   => "x87 stack exchange",
   "reg_req"   => { "in" => [ "st"], "out" => [ "st" ] },
-  "emit"      => '. fxch %X1, %X3 /* x87 swap %X1, %X3 */',
+  "cmp_attr"  => "  return 1;\n",
+  "emit"      => '. fxch %X1 /* x87 swap %X1, %X3 */',
 },
 
 "fpush" => {
+  "op_flags"  => "R",
   "comment"   => "x87 stack push",
   "reg_req"   => { "in" => [ "st"], "out" => [ "st" ] },
+  "cmp_attr"  => "  return 1;\n",
   "emit"      => '. fld %X1 /* x87 push %X1 */',
 },