Patchwork [committed] Fix failure of Octeon BADDU tests

login
register
mail settings
Submitter Richard Sandiford
Date Nov. 27, 2011, 10:18 a.m.
Message ID <87k46l6f7o.fsf@firetop.home>
Download mbox | patch
Permalink /patch/127877/
State New
Headers show

Comments

Richard Sandiford - Nov. 27, 2011, 10:18 a.m.
This patch fixes the MIPS octeon-baddu-1.c failures.  As Andrew says
in the PR, the problem is that the combined instruction seems more
expensive than the separate ones.

Tested on mips64-linux-gnu and applied.

Richard


gcc/
	PR target/51278
	* config/mips/mips.c (mips_rtx_costs): Handle baddu.
Andrew Pinski - Nov. 29, 2011, 5:06 a.m.
On Sun, Nov 27, 2011 at 2:18 AM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> This patch fixes the MIPS octeon-baddu-1.c failures.  As Andrew says
> in the PR, the problem is that the combined instruction seems more
> expensive than the separate ones.

I was going to submit a similar patch which I created internally at
Cavium.  I have a few more insn_cost patches in my queue also.

Thanks,
Andrew Pinski

Patch

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2011-11-26 12:51:05.000000000 +0000
+++ gcc/config/mips/mips.c	2011-11-26 12:57:02.000000000 +0000
@@ -3777,6 +3777,16 @@  mips_rtx_costs (rtx x, int code, int out
       return false;
 
     case ZERO_EXTEND:
+      if (outer_code == SET
+	  && ISA_HAS_BADDU
+	  && (GET_CODE (XEXP (x, 0)) == TRUNCATE
+	      || GET_CODE (XEXP (x, 0)) == SUBREG)
+	  && GET_MODE (XEXP (x, 0)) == QImode
+	  && GET_CODE (XEXP (XEXP (x, 0), 0)) == PLUS)
+	{
+	  *total = set_src_cost (XEXP (XEXP (x, 0), 0), speed);
+	  return true;
+	}
       *total = mips_zero_extend_cost (mode, XEXP (x, 0));
       return false;