Commit 32ad6a47 by Richard Sandiford Committed by Richard Sandiford

mips-protos.h (mips_output_division): Declare.

	* 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.c (mips_output_division): New function.
	* 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.

From-SVN: r67655
parent d334c3c1
2003-06-09 Richard Sandiford <rsandifo@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.c (mips_output_division): New function.
* 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.
2003-06-09 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.c (mips_reg_names): Change hilo entry to "".
(mips_sw_reg_names): Likewise.
(mips_regno_to_class): Change hilo entry to NO_REGS.
......
......@@ -110,6 +110,7 @@ extern const char *mips_output_load_label PARAMS ((void));
extern const char *mips_output_conditional_branch PARAMS ((rtx, rtx *,
int, int, int,
int));
extern const char *mips_output_division PARAMS ((const char *, rtx *));
extern int mips_adjust_insn_length PARAMS ((rtx, int));
extern enum reg_class mips_secondary_reload_class PARAMS ((enum reg_class,
enum machine_mode,
......
......@@ -10217,6 +10217,28 @@ mips_output_conditional_branch (insn,
return 0;
}
/* Used to output div or ddiv instruction DIVISION, which has the
operands given by OPERANDS. If we need a divide-by-zero check,
output the instruction and return an asm string that traps if
operand 2 is zero. Otherwise just return DIVISION itself. */
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;
}
/* Return true if GIVEN is the same as CANONICAL, or if it is CANONICAL
with a final "000" replaced by "k". Ignore case.
......
......@@ -201,15 +201,13 @@ extern void sbss_section PARAMS ((void));
#define MASK_MIPS16 0x00100000 /* Generate mips16 code */
#define MASK_NO_CHECK_ZERO_DIV \
0x00200000 /* divide by zero checking */
#define MASK_CHECK_RANGE_DIV \
0x00400000 /* divide result range checking */
#define MASK_BRANCHLIKELY 0x00400000 /* Generate Branch Likely
instructions. */
#define MASK_UNINIT_CONST_IN_RODATA \
0x00800000 /* Store uninitialized
consts in rodata */
#define MASK_NO_FUSED_MADD 0x01000000 /* Don't generate floating point
multiply-add operations. */
#define MASK_BRANCHLIKELY 0x02000000 /* Generate Branch Likely
instructions. */
/* Debug switches, not documented */
#define MASK_DEBUG 0 /* unused */
......@@ -294,8 +292,7 @@ extern void sbss_section PARAMS ((void));
#define TARGET_4300_MUL_FIX (target_flags & MASK_4300_MUL_FIX)
#define TARGET_NO_CHECK_ZERO_DIV (target_flags & MASK_NO_CHECK_ZERO_DIV)
#define TARGET_CHECK_RANGE_DIV (target_flags & MASK_CHECK_RANGE_DIV)
#define TARGET_CHECK_ZERO_DIV (!(target_flags & MASK_NO_CHECK_ZERO_DIV))
#define TARGET_BRANCHLIKELY (target_flags & MASK_BRANCHLIKELY)
......@@ -624,10 +621,6 @@ extern void sbss_section PARAMS ((void));
N_("Trap on integer divide by zero")}, \
{"no-check-zero-division", MASK_NO_CHECK_ZERO_DIV, \
N_("Don't trap on integer divide by zero")}, \
{"check-range-division",MASK_CHECK_RANGE_DIV, \
N_("Trap on integer divide overflow")}, \
{"no-check-range-division",-MASK_CHECK_RANGE_DIV, \
N_("Don't trap on integer divide overflow")}, \
{ "branch-likely", MASK_BRANCHLIKELY, \
N_("Use Branch Likely instructions, overriding default for arch")}, \
{ "no-branch-likely", -MASK_BRANCHLIKELY, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment