This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: rs6000 load_toc
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: David Edelsohn <dje at watson dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Sep 2002 14:07:13 +0930
- Subject: Re: rs6000 load_toc
- References: <20020908225836.B8357@bubble.sa.bigpond.net.au>
Hi David,
We can't lose TARGET_AIX in rs6000_emit_load_toc_table, because of
that "AIX code in non-PIC ELF" block. The following gets rid of the
nested conditions, and uses the DEFAULT_ABI test in rs6000.md.
* config/rs6000/rs6000.c (rs6000_emit_load_toc_table): Correct
test for non-PowerPC64 ELF.
* config/rs6000/rs6000.md (load_toc_v4_PIC*): Don't enable when
ABI_AIX.
note: -w diff to ignore indentation changes.
Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.376
diff -u -p -w -r1.376 rs6000.c
--- gcc/config/rs6000/rs6000.c 12 Sep 2002 02:14:26 -0000 1.376
+++ gcc/config/rs6000/rs6000.c 12 Sep 2002 04:26:59 -0000
@@ -9495,9 +9495,7 @@ rs6000_emit_load_toc_table (fromprolog)
rtx dest;
dest = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
- if (TARGET_ELF && DEFAULT_ABI != ABI_AIX)
- {
- if (DEFAULT_ABI == ABI_V4 && flag_pic == 1)
+ if (TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 1)
{
rtx temp = (fromprolog
? gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)
@@ -9505,7 +9503,7 @@ rs6000_emit_load_toc_table (fromprolog)
rs6000_maybe_dead (emit_insn (gen_load_toc_v4_pic_si (temp)));
rs6000_maybe_dead (emit_move_insn (dest, temp));
}
- else if (flag_pic == 2)
+ else if (TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2)
{
char buf[30];
rtx tempLR = (fromprolog
@@ -9559,9 +9557,9 @@ rs6000_emit_load_toc_table (fromprolog)
}
rs6000_maybe_dead (emit_insn (gen_addsi3 (dest, temp0, dest)));
}
- else if (flag_pic == 0 && TARGET_MINIMAL_TOC)
+ else if (TARGET_ELF && !TARGET_AIX && flag_pic == 0 && TARGET_MINIMAL_TOC)
{
- /* This is for AIX code running in non-PIC ELF. */
+ /* This is for AIX code running in non-PIC ELF32. */
char buf[30];
rtx realsym;
ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1);
@@ -9570,17 +9568,13 @@ rs6000_emit_load_toc_table (fromprolog)
rs6000_maybe_dead (emit_insn (gen_elf_high (dest, realsym)));
rs6000_maybe_dead (emit_insn (gen_elf_low (dest, dest, realsym)));
}
- else
+ else if (TARGET_ELF && !TARGET_AIX)
abort ();
- }
- else
- {
- if (TARGET_32BIT)
+ else if (TARGET_32BIT)
rs6000_maybe_dead (emit_insn (gen_load_toc_aix_si (dest)));
else
rs6000_maybe_dead (emit_insn (gen_load_toc_aix_di (dest)));
}
-}
int
get_TOC_alias_set ()
Index: gcc/config/rs6000/rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.205
diff -u -p -r1.205 rs6000.md
--- gcc/config/rs6000/rs6000.md 5 Sep 2002 22:48:53 -0000 1.205
+++ gcc/config/rs6000/rs6000.md 12 Sep 2002 04:26:32 -0000
@@ -10151,7 +10151,7 @@
[(set (match_operand:SI 0 "register_operand" "=l")
(match_operand:SI 1 "immediate_operand" "s"))
(unspec [(match_dup 1)] 7)]
- "TARGET_ELF && flag_pic == 2"
+ "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
"bl %1\\n%1:"
[(set_attr "type" "branch")
(set_attr "length" "4")])
@@ -10160,7 +10160,7 @@
[(set (match_operand:SI 0 "register_operand" "=l")
(match_operand:SI 1 "immediate_operand" "s"))
(unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")] 6)]
- "TARGET_ELF && flag_pic == 2"
+ "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
"bl %1\\n\\t.long %2-%1+4\\n%1:"
[(set_attr "type" "branch")
(set_attr "length" "8")])
@@ -10170,7 +10170,7 @@
(mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
(minus:SI (match_operand:SI 2 "immediate_operand" "s")
(match_operand:SI 3 "immediate_operand" "s")))))]
- "TARGET_ELF && flag_pic == 2"
+ "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
"{l|lwz} %0,%2-%3(%1)"
[(set_attr "type" "load")])
--
Alan Modra
IBM OzLabs - Linux Technology Centre