Commit d9d7a1bf by Alan Modra Committed by Alan Modra

re PR rtl-optimization/44169 (Wrong code while generating TLS offsets)

	PR target/44169
	* config/rs6000/rs6000.md (load_toc_v4_PIC_1b): Add label operand.
	* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Pass label
	rtx to gen_load_toc_v4_PIC_1b.  Tidy.
	(rs6000_emit_load_toc_table): Likewise.

From-SVN: r160206
parent 514f01ad
2010-06-03 Alan Modra <amodra@gmail.com>
PR target/44169
* config/rs6000/rs6000.md (load_toc_v4_PIC_1b): Add label operand.
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Pass label
rtx to gen_load_toc_v4_PIC_1b. Tidy.
(rs6000_emit_load_toc_table): Likewise.
2010-06-02 Jan Hubicka <jh@suse.cz>
* passes.c (init_optimization_passes): Put ipa reference
......
......@@ -5714,20 +5714,16 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
rs6000_emit_move (got, gsym, Pmode);
else
{
rtx tmp3, mem;
rtx last;
rtx mem, lab, last;
tmp1 = gen_reg_rtx (Pmode);
tmp2 = gen_reg_rtx (Pmode);
tmp3 = gen_reg_rtx (Pmode);
mem = gen_const_mem (Pmode, tmp1);
emit_insn (gen_load_toc_v4_PIC_1b (gsym));
emit_move_insn (tmp1,
gen_rtx_REG (Pmode, LR_REGNO));
lab = gen_label_rtx ();
emit_insn (gen_load_toc_v4_PIC_1b (gsym, lab));
emit_move_insn (tmp1, gen_rtx_REG (Pmode, LR_REGNO));
emit_move_insn (tmp2, mem);
emit_insn (gen_addsi3 (tmp3, tmp1, tmp2));
last = emit_move_insn (got, tmp3);
last = emit_insn (gen_addsi3 (got, tmp1, tmp2));
set_unique_reg_note (last, REG_EQUAL, gsym);
}
}
......@@ -18145,12 +18141,12 @@ rs6000_emit_load_toc_table (int fromprolog)
}
else
{
rtx tocsym;
rtx tocsym, lab;
tocsym = gen_rtx_SYMBOL_REF (Pmode, toc_label_name);
emit_insn (gen_load_toc_v4_PIC_1b (tocsym));
emit_move_insn (dest,
gen_rtx_REG (Pmode, LR_REGNO));
lab = gen_label_rtx ();
emit_insn (gen_load_toc_v4_PIC_1b (tocsym, lab));
emit_move_insn (dest, gen_rtx_REG (Pmode, LR_REGNO));
emit_move_insn (temp0, gen_rtx_MEM (Pmode, dest));
}
emit_insn (gen_addsi3 (dest, temp0, dest));
......
......@@ -11459,10 +11459,12 @@
(define_insn "load_toc_v4_PIC_1b"
[(set (reg:SI LR_REGNO)
(unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
UNSPEC_TOCPTR))]
(unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
(label_ref (match_operand 1 "" ""))]
UNSPEC_TOCPTR))
(match_dup 1)]
"TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
"bcl 20,31,$+8\\n\\t.long %0-$"
"bcl 20,31,$+8\;.long %0-$"
[(set_attr "type" "branch")
(set_attr "length" "8")])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment