On Sun, Mar 11, 2012 at 7:16 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>>>>>> * config/i386/i386.c (ix86_decompose_address): Disallow fs:(reg) >>>>>> if Pmode != word_mode. >>>>>> (legitimize_tls_address): Call gen_tls_initial_exec_x32 if >>>>>> Pmode == SImode for x32. >>>>>> >>>>>> * config/i386/i386.md (UNSPEC_TLS_IE_X32): New. >>>>>> (tls_initial_exec_x32): Likewise. >>>>> >>>>> Nice solution! >>>>> >>>>> OK for mainline. >>>> >>>> Done. >>>> >>>>> BTW: Did you investigate the issue with memory aliasing? >>>>> >>>> >>>> It isn't a problem since it is wrapped in UNSPEC_TLS_IE_X32 >>>> which loads address of the TLS symbol. >>>> >>>> Thanks. >>>> >>> >>> Since we must use reg64 in %fs:(%reg) memory operand like >>> >>> movq x@gottpoff(%rip),%reg64; >>> mov %fs:(%reg64),%reg >>> >>> this patch optimizes x32 TLS IE load and store by wrapping >>> %reg64 inside of UNSPEC when Pmode == SImode. OK for >>> trunk? >> >> I think we should just scrap all these complications and go with the >> idea of clearing MASK_TLS_DIRECT_SEG_REFS. >> > > I will give it a try. You can also revert: >>>>>> * config/i386/i386.c (ix86_decompose_address): Disallow fs:(reg) >>>>>> if Pmode != word_mode. then, since this part is handled later in the function. Uros.