This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to rework mips divide patterns
- From: Eric Christopher <echristo at redhat dot com>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 08 Jun 2003 20:05:21 -0700
- Subject: Re: Patch to rework mips divide patterns
- Organization:
- References: <wvnr864zjk6.fsf@talisman.cambridge.redhat.com>
>
>
> * config/mips/mips-protos.h (mips_output_division): Declare.
> * config/mips/mips.h (MASK_CHECK_RANGE_DIV): Remove.
> (MASK_BRANCHLIKELY): Use MASK_CHECK_RANGE_DIV's old number.
> (TARGET_NO_CHECK_ZERO_DIV, TARGET_CHECK_RANGE_DIV): Remove.
> (TARGET_CHECK_ZERO_DIV): New macro.
> (TARGET_SWITCHES): Remove -mcheck-range-div & -mno-check-range-div.
> * config/mips/mips.md (length): Take TARGET_CHECK_ZERO_DIV into
> account when calculating the default length of a division.
> (divmodsi4, divmoddi4, udivmodsi4, udivmoddi4): Turn into define_insns.
> Enable regardless of optimization level. Use mips_output_division.
> (divmodsi4_internal, divmoddi4_internal, udivmodsi4_internal,
> udivmoddi4_internal, div_trap, div_trap_normal, div_trap_mips16,
> divsi3, divsi3_internal, divdi3, divdi3_internal, modsi3,
> modsi3_internal, moddi3, moddi3_internal, udivsi3, udivsi3_internal,
> udivdi3, udivdi3_internal, umodsi3, umodsi3_internal, umoddi3,
> umoddi3_internal): Remove.
> + /* If appropriate, add divide-by-zero checks to div or ddiv instruction
> + DIVISION, which has the given operands. Return an asm string for the
> + final instruction. */
> +
> + const char *
> + mips_output_division (division, operands)
> + const char *division;
> + rtx *operands;
> + {
> + if (TARGET_CHECK_ZERO_DIV)
> + {
> + output_asm_insn (division, operands);
> +
> + if (TARGET_MIPS16)
> + return "bnez\t%2,1f\n\tbreak\t7\n1:";
> + else
> + return "bne\t%2,%.,1f\n\t%#break\t7\n1:";
> + }
> + return division;
> + }
> +
The comment and the function don't really seem to agree. I think I see
what you're doing, but...
The rest of this looks fine though. Lots of code removal is good.
-eric
--
Eric Christopher <echristo@redhat.com>