http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55597
--- Comment #12 from Uros Bizjak <ubizjak at gmail dot com> 2012-12-06 20:14:06 UTC --- (In reply to comment #11) > It works. Thanks. > > Unfortunately it creates GC garbage often unnecessary, when it won't be used > at > all. I agree. Let's keep zext together with their users: --cut here-- Index: i386.c =================================================================== --- i386.c (revision 194263) +++ i386.c (working copy) @@ -12785,6 +12785,9 @@ tp = get_thread_pointer (Pmode, true); dest = force_reg (Pmode, gen_rtx_PLUS (Pmode, tp, dest)); + if (GET_MODE (x) != Pmode) + x = gen_rtx_ZERO_EXTEND (Pmode, x); + set_unique_reg_note (get_last_insn (), REG_EQUAL, x); } else @@ -12793,15 +12796,20 @@ if (TARGET_64BIT) { - rtx rax = gen_rtx_REG (Pmode, AX_REG), insns; + rtx rax = gen_rtx_REG (Pmode, AX_REG); + rtx insns; start_sequence (); - emit_call_insn (ix86_gen_tls_global_dynamic_64 (rax, x, - caddr)); + emit_call_insn + (ix86_gen_tls_global_dynamic_64 (rax, x, caddr)); insns = get_insns (); end_sequence (); RTL_CONST_CALL_P (insns) = 1; + + if (GET_MODE (x) != Pmode) + x = gen_rtx_ZERO_EXTEND (Pmode, x); + emit_libcall_block (insns, dest, rax, x); } else @@ -12842,11 +12850,12 @@ if (TARGET_64BIT) { - rtx rax = gen_rtx_REG (Pmode, AX_REG), insns, eqv; + rtx rax = gen_rtx_REG (Pmode, AX_REG); + rtx insns, eqv; start_sequence (); - emit_call_insn (ix86_gen_tls_local_dynamic_base_64 (rax, - caddr)); + emit_call_insn + (ix86_gen_tls_local_dynamic_base_64 (rax, caddr)); insns = get_insns (); end_sequence (); @@ -12871,6 +12880,9 @@ { dest = force_reg (Pmode, gen_rtx_PLUS (Pmode, dest, tp)); + if (GET_MODE (x) != Pmode) + x = gen_rtx_ZERO_EXTEND (Pmode, x); + set_unique_reg_note (get_last_insn (), REG_EQUAL, x); } break; --cut here--