This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Clean up MIPS branch handling, fix mips-ps-*.c failures
- From: Richard Sandiford <richard at codesourcery dot com>
- To: Thiemo Seufer <ths at networkno dot de>
- Cc: gcc-patches at gcc dot gnu dot org, echristo at apple dot com
- Date: Mon, 13 Mar 2006 22:50:37 +0000
- Subject: Re: Clean up MIPS branch handling, fix mips-ps-*.c failures
- References: <87u0a75xao.fsf@talisman.home> <20060313171221.GB15212@networkno.de>
Thiemo Seufer <ths@networkno.de> writes:
> On Thu, Mar 09, 2006 at 05:43:11PM +0000, Richard Sandiford wrote:
> [snip]
>> * config/mips/mips-protos.h (mips_output_conditional_branch): Change
>> interface.
>> (mips_output_order_conditional_branch): Declare.
>> * config/mips/mips.h (MIPS_BRANCH): New macro.
>> * config/mips/mips.c (gen_conditional_branch): Use VOIDmode
>> for the comparison. Use gen_condjump.
>> (mips_output_conditional_branch): Rework interface to take the
>> asm templates for a direct branch and the inverse of a direct branch.
>> (mips_output_order_conditional_branch): New function.
>> (mips_builtin_branch_and_move): New function.
>> (mips_expand_builtin_compare): Use it. Use VOIDmode for the
>> branch condition. Use gen_single_cc as the condition for
>> __builtin_mips_upper_* or __builtin_mips_lower_*.
>> (mips_expand_builtin_bposge): Use mips_builtin_branch_and_move.
>> Use VOIDmode for the branch condition.
>> * config/mips/predicates.md (order_operator): New predicate.
>> * config/mips/mips.md (UNSPEC_SINGLE_CC): New constant.
>> (branch_fp): Rename to...
>> (*branch_fp): ...this. Remove mode from comparison operator.
>> Use new mips_output_conditional_branch interface.
>> (branch_fp_inverted): Rename to...
>> (*branch_fp_inverted): ...this and update as for *branch_fp.
>> (*branch_zero<mode>): Rename to...
>> (*branch_order<mode>): ...this. Remove mode from comparison operator.
>> Use mips_output_order_conditional_branch. Only accept ordered
>> comparisons.
>> (*branch_zero<mode>_inverted): Rename to...
>> (*branch_order<mode>_inverted): ...this and update as for
>> *branch_order<mode>.
>> (*branch_equality<mode>): Accept zero as the second operand to
>> the equality operator. Use the new mips_output_conditional_branch
>> interface.
>> (*branch_equality<mode>_inverted): Likewise.
>> (condjump): New expander.
>> * config/mips/mips-dsp.md (mips_bposge): Remove mode from comparison
>> operator.
>> * config/mips/mips-ps-3d.md (bc1any4t, bc1any4f): Likewise.
>> (bc1any2t, bc1any2f): Likewise.
>> (single_cc): New expander.
>> (*branch_upper_lower, *branch_upper_lower_inverted): New patterns.
>
> This patch broke bootstrap for mips-linux, due to emitting FP
> conditional branches which aren't available on MIPS III and lower.
Argh! That was very sloppy of me, sorry. I've applied the patch
below to fix things after verifying that the -mips3 and -mips64
output was OK.
Richard
* config/mips/mips.md (*branch_fp): Use %Z2 for the condition.
(*branch_fp_inverted): Likewise.
Index: gcc/config/mips/mips.md
===================================================================
--- gcc/config/mips/mips.md (revision 111958)
+++ gcc/config/mips/mips.md (working copy)
@@ -4284,8 +4306,8 @@ (define_insn "*branch_fp"
"TARGET_HARD_FLOAT"
{
return mips_output_conditional_branch (insn, operands,
- MIPS_BRANCH ("b%F0", "%2,%1"),
- MIPS_BRANCH ("b%W0", "%2,%1"));
+ MIPS_BRANCH ("b%F0", "%Z2%1"),
+ MIPS_BRANCH ("b%W0", "%Z2%1"));
}
[(set_attr "type" "branch")
(set_attr "mode" "none")])
@@ -4301,8 +4323,8 @@ (define_insn "*branch_fp_inverted"
"TARGET_HARD_FLOAT"
{
return mips_output_conditional_branch (insn, operands,
- MIPS_BRANCH ("b%W0", "%2,%1"),
- MIPS_BRANCH ("b%F0", "%2,%1"));
+ MIPS_BRANCH ("b%W0", "%Z2%1"),
+ MIPS_BRANCH ("b%F0", "%Z2%1"));
}
[(set_attr "type" "branch")
(set_attr "mode" "none")])