On Tue, Jun 09, 2015 at 04:12:33PM +0200, Uros Bizjak wrote: > On Tue, Jun 9, 2015 at 3:39 PM, Jakub Jelinek <ja...@redhat.com> wrote: > > On Tue, Jun 09, 2015 at 03:21:55PM +0200, Uros Bizjak wrote: > >> I'm afraid that simple scan loop won't work correctly on x32. There > >> are some issues with UNSPEC_TP for this target, so we have to generate > >> zero_extend of SImode UNSPEC, e.g.: > >> > >> (plus:DI (zero_extend:DI (unspec:SI [...] UNSPEC_TP) (reg:DI ...)) > >> > >> as can be seen in get_thread_pointer to construct the address. It > >> looks that your loop won't find the UNSPEC_TP tag in the above case. > > > > You're right, for -m32 it would need to start with
Yeah, I meant -mx32 (which I have no experience with nor spare time for). > > rtx *x = &addr; > > + while (GET_CODE (*x) == ZERO_EXTEND > > + || GET_CODE (*x) == AND > > + || GET_CODE (*x) == SUBREG) > > + x = &XEXP (*x, 0); > > Oh, you can use SImode_address_operand predicate here. Do I need to loop, or can there be just one SImode_address_operand code? Do you want to use the iterators (as in the second patch) or not (then is if (SImode_address_operand (addr, VOIDmode)) x = &XEXP (addr, 0); ok)? Is Pmode always SImode for -mx32, or depending on some switch or something? Would it be acceptable to just guard the changes in the patch with !TARGET_X32 and let H.J. deal with that target? I'm afraid I'm lost when to ZERO_EXTEND addr (if needed at all), etc. Jakub