Hi Richard,
 
This patch attemps to elimate the TEQ instruction div DIV/MOD instructions
if possible (i.e the numerator is known to be non-zero)
 
I have introduced and seperated UNSPEC UNSPEC_SET_HILO_NOTRAP
which is generation by a peephole2 when the trap is known not to be required.
 
The peephole's work by checking for a REG_EQUAL or/REG_EQUIV on the
instruction which sets the numerator for the DIV/MOD this doesn't catch all
possible cases but does catch the common cases where ths numerator is
set set in a insn immediately preceeding the DIV/MOD.
 
ChangeLog
 
2013-07-03    Graham Stott    grah...@btinternet.com
                * config/mips/mips.c: (mips_output_division) : Make static
                  add new traps enables/disables the geration if a trap
                 insn is TRAPS for divison are enabled.
                 (mips_output_division_with_trap): New enables geration of trap
                 on division by zero instruction.
                 (mips_output_division_without_trap) New disables generation of
                 trap.on division by zero instruction.
                * config/mips/mips-protos.h (mips_output_divison): Delete.
                  (mips_output_division_with_trap):  Add outputs a division 
sequence
                  with a trap-if-zero if required.
                  (mips_output_division_without_trap):  Add outputs the division
                 sequence without and trap-if-zero instruction.
                 * config/mips/mips.md (UNSPEC_SET_HILO_NOTRAP): Add unspec
                   and two peephole2 defines
                   (<u>divmod<GPR:mode>4_hilo_<HILO:mode>: Rename
                   <u>divmod<GPR:mode>4_hilo_<HILO:mode>_with_trap.
                    (<u>divmod<GPR:mode>4_hilo_<HILO:mode>_without_trap): New
                 * config/mips/predicates.md (binary_operator): Define.
                 (unary_operator): Define.

Attachment: mips.md.diff
Description: Binary data


Attachment: mips-protoes.h.diff
Description: Binary data

Attachment: mips.c.diff
Description: Binary data

Attachment: predicates.md.diff
Description: Binary data

Reply via email to