This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, mips] Fix optimization bug involving nor instruction
- From: Steve Ellcey <sellcey at mips dot com>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 22 Oct 2013 10:44:01 -0700
- Subject: Re: [patch, mips] Fix optimization bug involving nor instruction
- Authentication-results: sourceware.org; auth=none
- References: <5bfd0151-01e6-4f25-bcc6-0a0f7bb4d56b at BAMAIL02 dot ba dot imgtec dot org> <87ob6hcir1 dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com>
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