From 6513bb525c0554ae2222d331f6bbcd76aaef12e3 Mon Sep 17 00:00:00 2001 From: rth Date: Fri, 9 Nov 2001 22:00:08 +0000 Subject: [PATCH] * config/mips/mips.c (mips_output_conditional_branch): Do not hard code the branch target as ".+16/.+12", but rather use labels. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46893 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 ++++ gcc/config/mips/mips.c | 62 ++++++++++++++++++++++++-------------------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 54c7a97..0066156 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-11-08 Jason Eckhardt + + * config/mips/mips.c (mips_output_conditional_branch): Do not hard + code the branch target as ".+16/.+12", but rather use labels. + Fri Nov 9 11:27:42 2001 Jeffrey A Law (law@cygnus.com) * config/pa/milli64.S: Use %r25 and %r0 instead of arg1 and r0 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 23491ca..cab2aa1 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -9676,46 +9676,44 @@ mips_output_conditional_branch (insn, .set reorder l: - Because we have to jump four bytes *past* the following - instruction if this branch was annulled, we can't just use - a label, as in the picture above; there's no way to put the - label after the next instruction, as the assembler does not - accept `.L+4' as the target of a branch. (We can't just - wait until the next instruction is output; it might be a - macro and take up more than four bytes. Once again, we see - why we want to eliminate macros.) - - If the branch is annulled, we jump four more bytes that we - would otherwise; that way we skip the annulled instruction - in the delay slot. */ + */ - const char *const target - = ((mips_branch_likely || length == 16) ? ".+16" : ".+12"); - char *c; + rtx orig_target; + rtx target = gen_label_rtx (); - strcpy (buffer, "%(%<"); - c = strchr (buffer, '\0'); - /* Generate the reversed comparision. This takes four + output_asm_insn ("%(%<", 0); + orig_target = operands[1]; + operands[1] = target; + /* Generate the reversed comparison. This takes four bytes. */ if (float_p) - sprintf (c, "%%*b%s\t%%Z2%s", - inverted_p ? comp : inverted_comp, - target); + sprintf (buffer, "%%*b%s\t%%Z2%%1", + inverted_p ? comp : inverted_comp); else - sprintf (c, "%%*b%s%s\t%s%s,%s", + sprintf (buffer, "%%*b%s%s\t%s%s,%%1", inverted_p ? comp : inverted_comp, need_z_p ? "z" : "", op1, - op2, - target); - strcat (c, "\n\tnop\n\tj\t%1"); - if (length == 16) - /* The delay slot was unfilled. Since we're inside - .noreorder, the assembler will not fill in the NOP for - us, so we must do it ourselves. */ - strcat (buffer, "\n\tnop"); - strcat (buffer, "%>%)"); - return buffer; + op2); + output_asm_insn (buffer, operands); + operands[1] = orig_target; + + output_asm_insn ("nop\n\tj\t%1", operands); + + if (length == 16) + output_asm_insn ("nop", 0); + else + { + /* Output delay slot instruction. */ + rtx insn = final_sequence; + final_scan_insn (XVECEXP (insn, 0, 1), asm_out_file, + optimize, 0, 1); + INSN_DELETED_P (XVECEXP (insn, 0, 1)) = 1; + } + output_asm_insn ("%>%)", 0); + ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", + CODE_LABEL_NUMBER (target)); + return ""; } /* We do not currently use this code. It handles jumps to -- 2.7.4