diff options
author | Alan Modra <amodra@gmail.com> | 2010-06-03 12:17:11 +0930 |
---|---|---|
committer | Alan Modra <amodra@gcc.gnu.org> | 2010-06-03 12:17:11 +0930 |
commit | d9d7a1bf892608e0f55e19ec0bd2818949ba831d (patch) | |
tree | b47138a4c8c7818b25b37c8b5565d612488b72e3 | |
parent | 514f01ad19d2c0864b761a1ee259dcc6eafdcdf4 (diff) | |
download | gcc-d9d7a1bf892608e0f55e19ec0bd2818949ba831d.zip gcc-d9d7a1bf892608e0f55e19ec0bd2818949ba831d.tar.gz gcc-d9d7a1bf892608e0f55e19ec0bd2818949ba831d.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 22 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 8 |
3 files changed, 22 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c200dcd..c8ff7cf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +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 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 9bfaf54..9e31a22 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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)); diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 8f7093a..3106648 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -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")]) |