diff mbox

[MIPS,committed] Fix cost of CINS

Message ID 87ipc531h2.fsf@talisman.home
State New
Headers show

Commit Message

Richard Sandiford Aug. 26, 2012, 7:19 p.m. UTC
CINS wasn't being used in -Os code because the combination didn't
seem profitable enough.

Tested on mipsisa64-elf, mips64-elf and mips64-linux-gnu.  Applied.
Will be tested once gcc.target/mips uses gcc-dg.

Richard


gcc/
	* config/mips/mips.c (mips_rtx_costs): Add costs for CINS.
diff mbox

Patch

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2012-08-26 11:32:09.000000000 +0100
+++ gcc/config/mips/mips.c	2012-08-26 11:34:07.346812457 +0100
@@ -3681,6 +3681,18 @@  mips_rtx_costs (rtx x, int code, int out
 		    + set_src_cost (XEXP (x, 0), speed));
 	  return true;
 	}
+      if (ISA_HAS_CINS && CONST_INT_P (XEXP (x, 1)))
+	{
+	  rtx op = XEXP (x, 0);
+	  if (GET_CODE (op) == ASHIFT
+	      && CONST_INT_P (XEXP (op, 1))
+	      && mask_low_and_shift_p (mode, XEXP (x, 1), XEXP (op, 1), 32))
+	    {
+	      *total = COSTS_N_INSNS (1) + set_src_cost (XEXP (op, 0), speed);
+	      return true;
+	    }
+	}
+	    
       /* Fall through.  */
 
     case IOR: