This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Patch to fix mips execute/980605-1.c failures
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 07 Nov 2003 08:20:06 +0000
- Subject: [committed] Patch to fix mips execute/980605-1.c failures
I've installed this patch to fix the execute/980605-1.c failures on
mips-sgi-irix6.5 and mips64-linux-gnu. In my earlier reloc patch,
I forgot to make $25 an operand to loadgp, so -frename-registers
decided to use $25 for something that was live before the loadgp.
Sorry for the breakage.
Tested on mips64{,el}-linux-gnu, installed as obvious.
Richard
* config/mips/mips.md (loadgp): Take $25 as a second operand.
* config/mips/mips.c (mips_expand_prologue): Modify accordingly.
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.340
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.340 mips.c
*** config/mips/mips.c 4 Nov 2003 22:13:27 -0000 1.340
--- config/mips/mips.c 5 Nov 2003 11:01:23 -0000
*************** mips_expand_prologue (void)
*** 6648,6658 ****
/* If generating n32/n64 abicalls, emit the instructions to load $gp. */
if (TARGET_ABICALLS && TARGET_NEWABI && cfun->machine->global_pointer > 0)
{
! rtx addr, offset;
addr = XEXP (DECL_RTL (current_function_decl), 0);
offset = mips_unspec_address (addr, SYMBOL_GOTOFF_LOADGP);
! emit_insn (gen_loadgp (offset));
if (!TARGET_EXPLICIT_RELOCS)
emit_insn (gen_loadgp_blockage ());
}
--- 6648,6659 ----
/* If generating n32/n64 abicalls, emit the instructions to load $gp. */
if (TARGET_ABICALLS && TARGET_NEWABI && cfun->machine->global_pointer > 0)
{
! rtx addr, offset, incoming_address;
addr = XEXP (DECL_RTL (current_function_decl), 0);
offset = mips_unspec_address (addr, SYMBOL_GOTOFF_LOADGP);
! incoming_address = gen_rtx_REG (Pmode, PIC_FUNCTION_ADDR_REGNUM);
! emit_insn (gen_loadgp (offset, incoming_address));
if (!TARGET_EXPLICIT_RELOCS)
emit_insn (gen_loadgp_blockage ());
}
Index: config/mips/mips.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.md,v
retrieving revision 1.207
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.207 mips.md
*** config/mips/mips.md 4 Nov 2003 22:13:32 -0000 1.207
--- config/mips/mips.md 5 Nov 2003 11:01:24 -0000
*************** (define_insn "store_df_high"
*** 5123,5142 ****
(set_attr "mode" "SF")
(set_attr "length" "4")])
(define_insn_and_split "loadgp"
! [(unspec_volatile [(match_operand 0 "" "")] UNSPEC_LOADGP)]
"TARGET_ABICALLS && TARGET_NEWABI"
"#"
""
! [(set (match_dup 1) (match_dup 2))
! (set (match_dup 1) (match_dup 3))
! (set (match_dup 1) (match_dup 4))]
{
! operands[1] = pic_offset_table_rtx;
! operands[2] = gen_rtx_HIGH (Pmode, operands[0]);
! operands[3] = gen_rtx_PLUS (Pmode, operands[1],
! gen_rtx_REG (Pmode, PIC_FUNCTION_ADDR_REGNUM));
! operands[4] = gen_rtx_LO_SUM (Pmode, operands[1], operands[0]);
}
[(set_attr "length" "12")])
--- 5123,5145 ----
(set_attr "mode" "SF")
(set_attr "length" "4")])
+ ;; Insn to initialize $gp for n32/n64 abicalls. Operand 0 is the offset
+ ;; of _gp from the start of this function. Operand 1 is the incoming
+ ;; function address.
(define_insn_and_split "loadgp"
! [(unspec_volatile [(match_operand 0 "" "")
! (match_operand 1 "register_operand" "")] UNSPEC_LOADGP)]
"TARGET_ABICALLS && TARGET_NEWABI"
"#"
""
! [(set (match_dup 2) (match_dup 3))
! (set (match_dup 2) (match_dup 4))
! (set (match_dup 2) (match_dup 5))]
{
! operands[2] = pic_offset_table_rtx;
! operands[3] = gen_rtx_HIGH (Pmode, operands[0]);
! operands[4] = gen_rtx_PLUS (Pmode, operands[2], operands[1]);
! operands[5] = gen_rtx_LO_SUM (Pmode, operands[2], operands[0]);
}
[(set_attr "length" "12")])