diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8565d929c7de7bf78520f5361cb4b7343e231771..181781e3fdbfbff5350d1d2f189932dbd3fcfc3e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2010-06-07  Uros Bizjak  <ubizjak@gmail.com>
+
+	* config/i386/i386.md (*add<mode>_1): Remove alternative 2.
+	<TYPE_LEA>: Split instruction.
+	<default>: Remove alternative 2 handling.
+	(*addsi_1_zext) <TYPE_LEA>: Split instruction.
+	(add lea splitter): Generate SImode lea for mode sizes <= SImode.
+	(add_zext lea splitter): Use ix86_lea_for_add_ok in insn predicate.
+
+	(*movsi_1) <TYPE_LEA>: Use %a modifier to output operand 1.
+	(ashift_zext lea splitter): Use DImode for multiplication.
+
+	* config/i386/i386.c (ix86_expand_epilogue): Do not use ix86_gen_add
+	to generate addition.
+
 2010-06-07  Joseph Myers  <joseph@codesourcery.com>
 
 	* common.opt (fira-verbose): Use Var.
@@ -9,8 +24,7 @@
 	flag_detailed_statistics, flag_remove_unreachable_functions):
 	Remove.
 	* toplev.c (flag_detailed_statistics, flag_signed_char,
-	flag_short_enums, flag_pcc_struct_return, flag_ira_verbose):
-	Remove.
+	flag_short_enums, flag_pcc_struct_return, flag_ira_verbose): Remove.
 	(DEFAULT_PCC_STRUCT_RETURN): Move definition to defaults.h.
 	* toplev.h (flag_crossjumping, flag_if_conversion,
 	flag_if_conversion2, flag_keep_static_consts, flag_peel_loops,
@@ -95,7 +109,7 @@
 	and above and defer till target is known.
 	(optimization_options): Turn on zee pass if TARGET_64BIT is set and
 	turn off otherwise.
-	
+
 2010-05-25  Jan Hubicka  <jh@suse.cz>
 
 	* df-core.c (df_set_blocks): Use bitmap_head instead of bitmap.
@@ -136,7 +150,7 @@
 2010-06-06  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
 	PR c/20000
-        * c-decl.c (grokdeclarator): Delete warning.
+	* c-decl.c (grokdeclarator): Delete warning.
 
 2010-06-06  Eric Botcazou  <ebotcazou@adacore.com>
 
@@ -327,8 +341,7 @@
 2010-06-04  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR boostrap/44421
-	* df-problems.c (df_lr_bb_local_compute): Updated for embedded
-	bitmaps.
+	* df-problems.c (df_lr_bb_local_compute): Updated for embedded bitmaps.
 	(df_byte_lr_bb_local_compute): Likewise.
 
 2010-06-03  Jason Merrill  <jason@redhat.com>
@@ -358,11 +371,11 @@
 	(*addqi_1_lea) <TYPE_INCDEC, default>: Ditto.
 	(*add<mode>_2) <TYPE_INCDEC>: Remove assert that operand 0
 	and operand 1 are equal.
-	<default>: Ditto. Remove ??? comment.
+	<default>: Ditto.  Remove ??? comment.
 	(*add<mode>_3) <TYPE_INCDEC>: Remove assert that operand 0
 	and operand 1 are equal.
-	<default>: Ditto. Remove ??? comment.
-	(*adddi_4) <default>:  Remove assert that operand 0 and operand 1
+	<default>: Ditto.  Remove ??? comment.
+	(*adddi_4) <default>: Remove assert that operand 0 and operand 1
 	are equal.
 	(*add<mode>_4) <default>: Ditto.
 	(*add<mode>_5) <TYPE_INCDEC, default>: Ditto.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 407238fd430565763d2246d101c43da6d1ba320f..df18fdbd7eb4b9b6b8a60c264cd60ff58462c1ae 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -9356,10 +9356,11 @@ ix86_expand_epilogue (int style)
       if (!call_used_regs[REGNO (crtl->drap_reg)])
 	param_ptr_offset += UNITS_PER_WORD;
 
-      insn = emit_insn ((*ix86_gen_add3) (stack_pointer_rtx,
-					  crtl->drap_reg,
-					  GEN_INT (-param_ptr_offset)));
-
+      insn = emit_insn (gen_rtx_SET
+			(VOIDmode, stack_pointer_rtx,
+			 gen_rtx_PLUS (Pmode,
+				       crtl->drap_reg,
+				       GEN_INT (-param_ptr_offset))));
       ix86_cfa_state->reg = stack_pointer_rtx;
       ix86_cfa_state->offset = param_ptr_offset;
 
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index d446633aaa1bcd2cb0cfaaba886ce219d983c4fe..f7972445cc348ff35ce7781dcab4827c86e7cdf1 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1710,7 +1710,7 @@
       return "movd\t{%1, %0|%0, %1}";
 
     case TYPE_LEA:
-      return "lea{l}\t{%1, %0|%0, %1}";
+      return "lea{l}\t{%a1, %0|%0, %a1}";
 
     default:
       gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
@@ -6077,18 +6077,17 @@
    (set_attr "mode" "SI")])
 
 (define_insn "*add<mode>_1"
-  [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm,r,r")
+  [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm,r")
 	(plus:SWI48
-	  (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,r,r")
-	  (match_operand:SWI48 2 "<general_operand>" "<g>,r<i>,0,l<i>")))
+	  (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,r")
+	  (match_operand:SWI48 2 "<general_operand>" "<g>,r<i>,l<i>")))
    (clobber (reg:CC FLAGS_REG))]
   "ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
 {
   switch (get_attr_type (insn))
     {
     case TYPE_LEA:
-      operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
-      return "lea{<imodesuffix>}\t{%a2, %0|%0, %a2}";
+      return "#";
 
     case TYPE_INCDEC:
       gcc_assert (rtx_equal_p (operands[0], operands[1]));
@@ -6101,10 +6100,6 @@
 	}
 
     default:
-      /* Use add as much as possible to replace lea for AGU optimization. */
-      if (which_alternative == 2 && TARGET_OPT_AGU)
-        return "add{<imodesuffix>}\t{%1, %0|%0, %1}";
-        
       gcc_assert (rtx_equal_p (operands[0], operands[1]));
       if (x86_maybe_negate_const_int (&operands[2], <MODE>mode))
         return "sub{<imodesuffix>}\t{%2, %0|%0, %2}";
@@ -6113,11 +6108,8 @@
     }
 }
   [(set (attr "type")
-     (cond [(and (eq_attr "alternative" "2") 
-                 (eq (symbol_ref "TARGET_OPT_AGU") (const_int 0)))
+     (cond [(eq_attr "alternative" "2") 
 	      (const_string "lea")
-            (eq_attr "alternative" "3")
-              (const_string "lea")
 	    (match_operand:SWI48 2 "incdec_operand" "")
 	      (const_string "incdec")
 	   ]
@@ -6146,8 +6138,7 @@
   switch (get_attr_type (insn))
     {
     case TYPE_LEA:
-      operands[2] = XEXP (SET_SRC (XVECEXP (PATTERN (insn), 0, 0)), 0);
-      return "lea{l}\t{%a2, %k0|%k0, %a2}";
+      return "#";
 
     case TYPE_INCDEC:
       if (operands[2] == const1_rtx)
@@ -6398,6 +6389,64 @@
         (const_string "none")))
    (set_attr "mode" "QI")])
 
+;; Convert lea to the lea pattern to avoid flags dependency.
+(define_split
+  [(set (match_operand:DI 0 "register_operand" "")
+	(plus:DI (match_operand:DI 1 "register_operand" "")
+		 (match_operand:DI 2 "x86_64_nonmemory_operand" "")))
+   (clobber (reg:CC FLAGS_REG))]
+  "TARGET_64BIT && reload_completed 
+   && ix86_lea_for_add_ok (PLUS, insn, operands)"
+  [(set (match_dup 0)
+	(plus:DI (match_dup 1)
+		 (match_dup 2)))]
+  "")
+
+;; Convert lea to the lea pattern to avoid flags dependency.
+(define_split
+  [(set (match_operand 0 "register_operand" "")
+	(plus (match_operand 1 "register_operand" "")
+              (match_operand 2 "nonmemory_operand" "")))
+   (clobber (reg:CC FLAGS_REG))]
+  "reload_completed
+   && ix86_lea_for_add_ok (PLUS, insn, operands)
+   && GET_MODE_SIZE (GET_MODE (operands[0])) <= 4"
+  [(const_int 0)]
+{
+  rtx pat;
+  enum machine_mode mode = GET_MODE (operands[0]);
+
+  if (GET_MODE_SIZE (mode) < 4)
+    operands[0] = gen_lowpart (SImode, operands[0]);
+  if (mode != Pmode)
+    {
+      operands[1] = gen_lowpart (Pmode, operands[1]);
+      operands[2] = gen_lowpart (Pmode, operands[2]);
+    }
+
+  pat = gen_rtx_PLUS (Pmode, operands[1], operands[2]);
+  if (Pmode != SImode)
+    pat = gen_rtx_SUBREG (SImode, pat, 0);
+  emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
+  DONE;
+})
+
+;; Convert lea to the lea pattern to avoid flags dependency.
+(define_split
+  [(set (match_operand:DI 0 "register_operand" "")
+	(zero_extend:DI
+	  (plus:SI (match_operand:SI 1 "register_operand" "")
+		   (match_operand:SI 2 "nonmemory_operand" ""))))
+   (clobber (reg:CC FLAGS_REG))]
+  "TARGET_64BIT && reload_completed
+   && ix86_lea_for_add_ok (PLUS, insn, operands)"
+  [(set (match_dup 0)
+	(zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))]
+{
+  operands[1] = gen_lowpart (Pmode, operands[1]);
+  operands[2] = gen_lowpart (Pmode, operands[2]);
+})
+
 (define_insn "*add<mode>_2"
   [(set (reg FLAGS_REG)
 	(compare
@@ -6939,60 +6988,6 @@
 }
   [(set_attr "type" "lea")
    (set_attr "mode" "SI")])
-
-;; Convert lea to the lea pattern to avoid flags dependency.
-(define_split
-  [(set (match_operand:DI 0 "register_operand" "")
-	(plus:DI (match_operand:DI 1 "register_operand" "")
-		 (match_operand:DI 2 "x86_64_nonmemory_operand" "")))
-   (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && reload_completed 
-   && ix86_lea_for_add_ok (PLUS, insn, operands)"
-  [(set (match_dup 0)
-	(plus:DI (match_dup 1)
-		 (match_dup 2)))]
-  "")
-
-;; Convert lea to the lea pattern to avoid flags dependency.
-(define_split
-  [(set (match_operand 0 "register_operand" "")
-	(plus (match_operand 1 "register_operand" "")
-              (match_operand 2 "nonmemory_operand" "")))
-   (clobber (reg:CC FLAGS_REG))]
-  "reload_completed && ix86_lea_for_add_ok (PLUS, insn, operands)" 
-  [(const_int 0)]
-{
-  rtx pat;
-  /* In -fPIC mode the constructs like (const (unspec [symbol_ref]))
-     may confuse gen_lowpart.  */
-  if (GET_MODE (operands[0]) != Pmode)
-    {
-      operands[1] = gen_lowpart (Pmode, operands[1]);
-      operands[2] = gen_lowpart (Pmode, operands[2]);
-    }
-  operands[0] = gen_lowpart (SImode, operands[0]);
-  pat = gen_rtx_PLUS (Pmode, operands[1], operands[2]);
-  if (Pmode != SImode)
-    pat = gen_rtx_SUBREG (SImode, pat, 0);
-  emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
-  DONE;
-})
-
-;; Convert lea to the lea pattern to avoid flags dependency.
-(define_split
-  [(set (match_operand:DI 0 "register_operand" "")
-	(zero_extend:DI
-	  (plus:SI (match_operand:SI 1 "register_operand" "")
-		   (match_operand:SI 2 "nonmemory_operand" ""))))
-   (clobber (reg:CC FLAGS_REG))]
-  "TARGET_64BIT && reload_completed
-   && true_regnum (operands[0]) != true_regnum (operands[1])"
-  [(set (match_dup 0)
-	(zero_extend:DI (subreg:SI (plus:DI (match_dup 1) (match_dup 2)) 0)))]
-{
-  operands[1] = gen_lowpart (Pmode, operands[1]);
-  operands[2] = gen_lowpart (Pmode, operands[2]);
-})
 
 ;; Subtract instructions
 
@@ -9807,7 +9802,7 @@
   "TARGET_64BIT && reload_completed
    && true_regnum (operands[0]) != true_regnum (operands[1])"
   [(set (match_dup 0)
-	(zero_extend:DI (subreg:SI (mult:SI (match_dup 1) (match_dup 2)) 0)))]
+	(zero_extend:DI (subreg:SI (mult:DI (match_dup 1) (match_dup 2)) 0)))]
 {
   operands[1] = gen_lowpart (Pmode, operands[1]);
   operands[2] = gen_int_mode (1 << INTVAL (operands[2]), Pmode);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 70d709eb0761acef53060cfc6996e9bf6bc1d1cb..fd6994a3c36e0f046e60c620f8d2f66f005efb48 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -44,11 +44,11 @@
 	Additional add dg-compile to avoid failure due
 	missing foo symbol.
 
-        * gcc.dg/compound-literal-1.c: Fix for llp64.
-        * gcc.dg/pr32370.c: Likewise.
-        * gcc.dg/pr37561.c: Likewise.
-        * gcc.dg/pr41340.c: Likewise.
-        * gcc.dg/pr41551.c: Likewise.
+	* gcc.dg/compound-literal-1.c: Fix for llp64.
+	* gcc.dg/pr32370.c: Likewise.
+	* gcc.dg/pr37561.c: Likewise.
+	* gcc.dg/pr41340.c: Likewise.
+	* gcc.dg/pr41551.c: Likewise.
 
 2010-05-25  Dodji Seketeli  <dodji@redhat.com>
 
@@ -58,7 +58,7 @@
 2010-06-06  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
 	PR c/20000
-        * c-c++-common/pr20000.c: New.
+	* c-c++-common/pr20000.c: New.
 
 2010-06-05  Fabien Chêne  <fabien@gcc.gnu.org>