On Thu, Jul 28, 2011 at 3:47 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>>>> TLS on X32 is almost identical to TLS on x86-64. The only difference is >>>> x32 address space is 32bit. That means TLS symbols can be in either >>>> SImode or DImode with upper 32bit zero. This patch updates >>>> tls_global_dynamic_64 to support x32. OK for trunk? >> >> Please also change 64bit GNU2_TLS patterns, so -mtls-dialect=gnu2 will >> also work. Please see attached patch. >> > > Yes, it works. Can you apply it? This is what I have committed: 2011-07-28 Uros Bizjak <ubiz...@gmail.com> PR target/47715 * config/i386/i386.md (*tls_global_dynamic_64): Remove mode from tls_symbolic_operand check. Update code sequence for TARGET_X32. (tls_global_dynamic_64): Remove mode from tls_symbolic_operand check. (tls_dynamic_gnu2_64): Ditto. (*tls_dynamic_gnu2_lea_64): Ditto. (*tls_dynamic_gnu2_call_64): Ditto. (*tls_dynamic_gnu2_combine_64): Ditto. Uros.
Index: i386.md =================================================================== --- i386.md (revision 176870) +++ i386.md (working copy) @@ -12327,11 +12327,12 @@ (call:DI (mem:QI (match_operand:DI 2 "constant_call_address_operand" "z")) (match_operand:DI 3 "" ""))) - (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")] + (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_TLS_GD)] "TARGET_64BIT" { - fputs (ASM_BYTE "0x66\n", asm_out_file); + if (!TARGET_X32) + fputs (ASM_BYTE "0x66\n", asm_out_file); output_asm_insn ("lea{q}\t{%a1@tlsgd(%%rip), %%rdi|rdi, %a1@tlsgd[rip]}", operands); fputs (ASM_SHORT "0x6666\n", asm_out_file); @@ -12349,7 +12350,7 @@ (call:DI (mem:QI (match_operand:DI 2 "constant_call_address_operand" "")) (const_int 0))) - (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")] + (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_TLS_GD)])]) (define_insn "*tls_local_dynamic_base_32_gnu" @@ -12553,7 +12554,7 @@ (define_expand "tls_dynamic_gnu2_64" [(set (match_dup 2) - (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")] + (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_TLSDESC)) (parallel [(set (match_operand:DI 0 "register_operand" "") @@ -12568,7 +12569,7 @@ (define_insn "*tls_dynamic_lea_64" [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")] + (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_TLSDESC))] "TARGET_64BIT && TARGET_GNU2_TLS" "lea{q}\t{%a1@TLSDESC(%%rip), %0|%0, %a1@TLSDESC[rip]}" @@ -12579,7 +12580,7 @@ (define_insn "*tls_dynamic_call_64" [(set (match_operand:DI 0 "register_operand" "=a") - (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "") + (unspec:DI [(match_operand 1 "tls_symbolic_operand" "") (match_operand:DI 2 "register_operand" "0") (reg:DI SP_REG)] UNSPEC_TLSDESC)) @@ -12598,7 +12599,7 @@ (reg:DI SP_REG)] UNSPEC_TLSDESC) (const:DI (unspec:DI - [(match_operand:DI 1 "tls_symbolic_operand" "")] + [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_DTPOFF)))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && TARGET_GNU2_TLS"