Index: gcc/reload.c
===================================================================
*** gcc/reload.c	(revision 126856)
--- gcc/reload.c	(working copy)
*************** find_reloads_address_1 (enum machine_mod
*** 5461,5476 ****
  
  	else if (code0 == REG && code1 == REG)
  	  {
! 	    if (REGNO_OK_FOR_INDEX_P (REGNO (op0))
! 		&& regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG))
  	      return 0;
! 	    else if (REGNO_OK_FOR_INDEX_P (REGNO (op1))
! 		     && regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG))
  	      return 0;
- 	    else if (regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG))
- 	      find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH,
- 				      &XEXP (x, 0), opnum, type, ind_levels,
- 				      insn);
  	    else if (regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG))
  	      find_reloads_address_1 (mode, orig_op1, 1, PLUS, SCRATCH,
  				      &XEXP (x, 1), opnum, type, ind_levels,
--- 5461,5472 ----
  
  	else if (code0 == REG && code1 == REG)
  	  {
! 	    if (REGNO_OK_FOR_INDEX_P (REGNO (op1))
! 		&& regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG))
  	      return 0;
! 	    else if (REGNO_OK_FOR_INDEX_P (REGNO (op0))
! 		     && regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG))
  	      return 0;
  	    else if (regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG))
  	      find_reloads_address_1 (mode, orig_op1, 1, PLUS, SCRATCH,
  				      &XEXP (x, 1), opnum, type, ind_levels,
*************** find_reloads_address_1 (enum machine_mod
*** 5479,5494 ****
  	      find_reloads_address_1 (mode, orig_op0, 0, PLUS, REG,
  				      &XEXP (x, 0), opnum, type, ind_levels,
  				      insn);
  	    else if (REGNO_OK_FOR_INDEX_P (REGNO (op0)))
  	      find_reloads_address_1 (mode, orig_op1, 0, PLUS, REG,
  				      &XEXP (x, 1), opnum, type, ind_levels,
  				      insn);
  	    else
  	      {
! 		find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH,
  					&XEXP (x, 0), opnum, type, ind_levels,
  					insn);
! 		find_reloads_address_1 (mode, orig_op1, 0, PLUS, REG,
  					&XEXP (x, 1), opnum, type, ind_levels,
  					insn);
  	      }
--- 5475,5494 ----
  	      find_reloads_address_1 (mode, orig_op0, 0, PLUS, REG,
  				      &XEXP (x, 0), opnum, type, ind_levels,
  				      insn);
+ 	    else if (regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG))
+ 	      find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH,
+ 				      &XEXP (x, 0), opnum, type, ind_levels,
+ 				      insn);
  	    else if (REGNO_OK_FOR_INDEX_P (REGNO (op0)))
  	      find_reloads_address_1 (mode, orig_op1, 0, PLUS, REG,
  				      &XEXP (x, 1), opnum, type, ind_levels,
  				      insn);
  	    else
  	      {
! 		find_reloads_address_1 (mode, orig_op0, 0, PLUS, REG,
  					&XEXP (x, 0), opnum, type, ind_levels,
  					insn);
! 		find_reloads_address_1 (mode, orig_op1, 1, PLUS, SCRATCH,
  					&XEXP (x, 1), opnum, type, ind_levels,
  					insn);
  	      }
