This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[MIPS 24/30] Fix rtx_costs recip handling
- From: Richard Sandiford <rsandifo at nildram dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 21 Oct 2007 10:13:10 +0100
- Subject: [MIPS 24/30] Fix rtx_costs recip handling
- References: <87przc9wms.fsf@firetop.home>
My rtx_costs patch wrongly treated RECIP.FMT as being a MIPS II rather
than a MIPS IV instruction. As well as fixing that bug, this patch gets
rid of the last ISA-based feature check in mips.c.
Richard
gcc/
* config/mips/mips.c (mips_rtx_costs): Only recognize reciprocals
if ISA_HAS_FP4.
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c 2007-10-18 11:07:15.000000000 +0100
+++ gcc/config/mips/mips.c 2007-10-18 11:07:16.000000000 +0100
@@ -3367,22 +3367,18 @@ mips_rtx_costs (rtx x, int code, int out
case DIV:
/* Check for a reciprocal. */
- if (float_mode_p && XEXP (x, 0) == CONST1_RTX (mode))
- {
- if (ISA_HAS_FP4
- && flag_unsafe_math_optimizations
- && (outer_code == SQRT || GET_CODE (XEXP (x, 1)) == SQRT))
- {
- /* An rsqrt<mode>a or rsqrt<mode>b pattern. Count the
- division as being free. */
- *total = rtx_cost (XEXP (x, 1), 0);
- return true;
- }
- if (!ISA_MIPS1)
- {
- *total = mips_fp_div_cost (mode) + rtx_cost (XEXP (x, 1), 0);
- return true;
- }
+ if (float_mode_p
+ && ISA_HAS_FP4
+ && flag_unsafe_math_optimizations
+ && XEXP (x, 0) == CONST1_RTX (mode))
+ {
+ if (outer_code == SQRT || GET_CODE (XEXP (x, 1)) == SQRT)
+ /* An rsqrt<mode>a or rsqrt<mode>b pattern. Count the
+ division as being free. */
+ *total = rtx_cost (XEXP (x, 1), 0);
+ else
+ *total = mips_fp_div_cost (mode) + rtx_cost (XEXP (x, 1), 0);
+ return true;
}
/* Fall through. */