mips.c (mips_rtx_costs): Add costs for CINS.
authorRichard Sandiford <rdsandiford@googlemail.com>
Sun, 26 Aug 2012 19:19:31 +0000 (19:19 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 26 Aug 2012 19:19:31 +0000 (19:19 +0000)
gcc/
* config/mips/mips.c (mips_rtx_costs): Add costs for CINS.

From-SVN: r190699

gcc/ChangeLog
gcc/config/mips/mips.c

index 98aafc62ab31ceca2991e9527906f78f393450cc..ae2bb1b12ec2690532144462e53e104da8263d56 100644 (file)
@@ -1,3 +1,7 @@
+2012-08-26  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * config/mips/mips.c (mips_rtx_costs): Add costs for CINS.
+
 2012-08-26  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/mips/mips.c (mips_rtx_costs): Add missing COSTS_N_INSNS
index b8210de37901f5e047c49c7feedde4c927e097d1..1f0c9ae1df02c3b8c37f97ad60bda77f5e50becb 100644 (file)
@@ -3677,6 +3677,18 @@ mips_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
                    + 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: