This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, mips] Fix optimization bug involving nor instruction


On Tue, 2013-10-22 at 18:34 +0100, Richard Sandiford wrote:
> Good spot!

> We should use set_src_cost for both operands (the idea being that only
> a register is allowed, and that anything else will end up being a SET_SRC).
> I think the formatting should be something like:
> 
>       /* (AND (NOT op0) (NOT op1)) is a NOR operation that can be done in
> 	 a single instruction.  */
>       if (!TARGET_MIPS16
> 	  && GET_CODE (XEXP (x, 0)) == NOT
> 	  && GET_CODE (XEXP (x, 1)) == NOT)
> 	{
> 	  cost = GET_MODE_SIZE (mode) > UNITS_PER_WORD ? 2 : 1;
> 	  *total = (COSTS_N_INSNS (cost)
> 		    + set_src_cost (XEXP (XEXP (x, 0), 0), speed)
> 		    + set_src_cost (XEXP (XEXP (x, 1), 0), speed));
> 	  return true;
> 	}
> 
> OK with that change, thanks.
> 
> Richard

OK, but I am curious why you put parenthesis around the right hand side
of the total expression.  I.e.  *total = (....);

Steve Ellcey



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]