fixed some bugs
[libfirm] / ir / be / ia32 / ia32_spec.pl
index b81fc45..f791806 100644 (file)
@@ -351,7 +351,7 @@ $arch = "ia32";
   "op_flags"  => "L|X|Y",
   "comment"   => "construct switch",
   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
-  "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "none" ] },
+  "reg_req"   => { "in" => [ "gp" ], "out" => [ "none" ] },
 },
 
 "Const" => {
@@ -360,7 +360,14 @@ $arch = "ia32";
   "comment"   => "represents an integer constant",
   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
   "reg_req"   => { "out" => [ "gp" ] },
-  "emit"      => '. mov %D1, %C\t\t\t/* Mov Const into register */',
+  "emit"      =>
+'  if (get_ia32_Immop_tarval(n) == get_tarval_null(get_irn_mode(n))) {
+4.   sub %D1, %D1\t\t\t/* optimized mov 0 to register */
+  }
+  else {
+4.   mov %D1, %C\t\t\t/* Mov Const into register */
+  }
+',
 },
 
 "Cdq" => {