MIPS compact branch support
authorMatthew Fortune <matthew.fortune@imgtec.com>
Tue, 1 Sep 2015 22:41:08 +0000 (22:41 +0000)
committerMatthew Fortune <mpf@gcc.gnu.org>
Tue, 1 Sep 2015 22:41:08 +0000 (22:41 +0000)
commit22219d9b1a5bcf9b96020f830493fed6525d936c
treeecac4cd742ebbbe8111646b7cdb719b74aedb20c
parent2503fd9e072207822ff7e3d1bd8df97bdfd32666
MIPS compact branch support

gcc/
* config/mips/mips-opts.h (mips_cb_setting): New enum.
* config/mips/mips-protos.h: Add definitions for
mips_output_jump and mips_output_equal_conditional_branch
* gcc/config/mips/mips.c (MIPS_JR): Change to support the
JIC instruction.
(mips_emit_compare): Add support for the MIPS R6 conditional
compact branches.
(mips_process_sync_loop): Likewise.
(mips_output_order_conditional_branch): Likewise.
(mips16_build_call_stub): Change MIPS_CALL to
mips_output_jump.
(mips_print_operand_punctuation): Update 's' case to only
apply to micromips r2.
(mips_adjust_insn_length): Add support for forbidden slot
hazards.
(mips_avoid_hazard): Likewise.
(mips_reorg_process_insns): Likewise.
(mips_output_jump): New function.
(mips_output_equal_conditional_branch): Likewise.
(mips_output_conditional_branch): Use jrc/bc if compact
branch support is enabled.  Ensure the forbidden slots
between the two branch instructions is filled with a nop.
(mips_option_override): Add support to process the compact
branch option and set the correct defaults.  Prevent
non-explict relocs being using for MIPS R6.
(mips_trampoline_init): Add compact branch support.
(mips_mult_zero_zero_cost): Allow zero initialisation of
accumulators with TARGET_DSP.
* gcc/config/mips/mips.h (TARGET_CB_NEVER): New define.
(TARGET_CB_MAYBE): New define.
(TARGET_CB_ALWAYS): New define.
(ISA_HAS_DELAY_SLOTS): New define.
(ISA_HAS_COMPACT_BRANCHES): New define.
(ISA_HAS_JRC): New define.
(MIPS_BRANCH_C): New define.
(MIPS_CALL): Removed.
(MICROMIPS_J): Removed.
* config/mips/mips.md (compact_form): New attr.
(hazard): Add support for forbidden slots.
(define_delay): Add support for compact branches.
(*branch_order<mode>): Likewise.
(*branch_order<mode>_inverted): Likewise.
(*branch_equality<mode>): Likewise.
(*branch_equality<mode>_inverted): Likewise.
(*jump_absolute): Likewise.
(*jump_pic): Likewise.
(indirect_jump): Use mips_output_jump to produce assembly output.
(tablejump_<mode>"): Likewise.
(*<optab>"): Likewise.
(<optab>_internal): Likewise.
(sibcall_internal): Likewise.
(sibcall_value_internal): Likewise.
(sibcall_value_multiple_internal): Likewise.
(call_internal): Likewise.
(call_split): Likewise.
(call_internal_direct): Likewise.
(call_direct_split): Likewise.
(call_value_internal): Likewise.
(call_value_split): Likewise.
(call_value_internal_direct): Likewise.
(call_value_direct_split): Likewise.
(call_value_multiple_internal): Likewise.
(call_value_multiple_split): Likewise.
(mips_get_fcsr_mips16_<mode>): Likewise.
(mips_set_fcsr_mips16_<mode>): Likewise.
(tls_get_tp_mips16_<mode>): Likewise.
* config/mips/mips.opt: Add -mcompact-branches option.
* config/mips/predicates.md (order_operator): Ensure the
conditional compact branches are only used if the ISA them.
* doc/invoke.texi: Document -mcompact-branches option.

gcc/testsuite/
* gcc.target/mips/mips.exp (mips-dg-options): Handle the
dependencies between ISA level and compact-branches.
* gcc.target/mips/branch-10.c: Update expected output to allow
compact forms of b/bal.
* gcc.target/mips/branch-11.c: Likewise.
* gcc.target/mips/branch-12.c: Likewise.
* gcc.target/mips/branch-13.c: Likewise.
* gcc.target/mips/branch-3.c: Likewise.
* gcc.target/mips/branch-4.c: Likewise.
* gcc.target/mips/branch-5.c: Likewise.
* gcc.target/mips/branch-6.c: Likewise.
* gcc.target/mips/branch-7.c: Likewise.
* gcc.target/mips/branch-8.c: Likewise.
* gcc.target/mips/branch-9.c: Likewise.
* gcc.target/mips/branch-cost-1.c: Likewise.
* gcc.target/mips/call-1.c: Likewise.
* gcc.target/mips/call-2.c: Likewise.
* gcc.target/mips/call-3.c: Likewise.
* gcc.target/mips/call-4.c: Likewise.
* gcc.target/mips/call-5.c: Likewise.
* gcc.target/mips/call-6.c: Likewise.
* gcc.target/mips/lazy-binding-1.c: Likewise.
* gcc.target/mips/near-far-1.c: Likewise.
* gcc.target/mips/near-far-2.c: Likewise.
* gcc.target/mips/near-far-3.c: Likewise.
* gcc.target/mips/near-far-4.c: Likewise.
* gcc.target/mips/umips-branch-3.c: Ensure the test is
run with compact branches allowed.
* gcc.target/mips/compact-branches-1.c: New file.
* gcc.target/mips/compact-branches-2.c: Likewise.
* gcc.target/mips/compact-branches-3.c: Likewise.
* gcc.target/mips/compact-branches-4.c: Likewise.
* gcc.target/mips/compact-branches-5.c: Likewise.
* gcc.target/mips/compact-branches-6.c: Likewise.
* gcc.target/mips/compact-branches-7.c: Likewise.

Co-Authored-By: Andrew Bennett <andrew.bennett@imgtec.com>
From-SVN: r227385
42 files changed:
gcc/ChangeLog
gcc/config/mips/mips-opts.h
gcc/config/mips/mips-protos.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h
gcc/config/mips/mips.md
gcc/config/mips/mips.opt
gcc/config/mips/predicates.md
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/branch-10.c
gcc/testsuite/gcc.target/mips/branch-11.c
gcc/testsuite/gcc.target/mips/branch-12.c
gcc/testsuite/gcc.target/mips/branch-13.c
gcc/testsuite/gcc.target/mips/branch-3.c
gcc/testsuite/gcc.target/mips/branch-4.c
gcc/testsuite/gcc.target/mips/branch-5.c
gcc/testsuite/gcc.target/mips/branch-6.c
gcc/testsuite/gcc.target/mips/branch-7.c
gcc/testsuite/gcc.target/mips/branch-8.c
gcc/testsuite/gcc.target/mips/branch-9.c
gcc/testsuite/gcc.target/mips/branch-cost-1.c
gcc/testsuite/gcc.target/mips/call-1.c
gcc/testsuite/gcc.target/mips/call-2.c
gcc/testsuite/gcc.target/mips/call-3.c
gcc/testsuite/gcc.target/mips/call-4.c
gcc/testsuite/gcc.target/mips/call-5.c
gcc/testsuite/gcc.target/mips/call-6.c
gcc/testsuite/gcc.target/mips/compact-branches-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/compact-branches-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/compact-branches-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/compact-branches-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/compact-branches-5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/compact-branches-6.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/compact-branches-7.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/lazy-binding-1.c
gcc/testsuite/gcc.target/mips/mips.exp
gcc/testsuite/gcc.target/mips/near-far-1.c
gcc/testsuite/gcc.target/mips/near-far-2.c
gcc/testsuite/gcc.target/mips/near-far-3.c
gcc/testsuite/gcc.target/mips/near-far-4.c
gcc/testsuite/gcc.target/mips/umips-branch-3.c