On Tue, Jul 26, 2011 at 10:12 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Tue, Jul 26, 2011 at 10:05:06PM +0200, Uros Bizjak wrote: >> > 2011-07-26 H.J. Lu <hongjiu...@intel.com> >> > >> > PR target/47372 >> > * config/i386/i386.c (ix86_delegitimize_address): Call >> > simplify_gen_subreg for PIC with ptr_mode only if modes of >> > x and orig_x are different. >> > >> > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c >> > index 429cd62..9c52aa3 100644 >> > --- a/gcc/config/i386/i386.c >> > +++ b/gcc/config/i386/i386.c >> > @@ -12967,9 +12982,10 @@ ix86_delegitimize_address (rtx x) >> > || !MEM_P (orig_x)) >> > return ix86_delegitimize_tls_address (orig_x); >> > x = XVECEXP (XEXP (x, 0), 0, 0); > > When x is no longer known to be Pmode > >> > - if (GET_MODE (orig_x) != Pmode) >> > + if (GET_MODE (orig_x) != GET_MODE (x) >> > + && GET_MODE (orig_x) != ptr_mode) > > why not simply just > if (GET_MODE (orig_x) != GET_MODE (x)) > >> > { >> > - x = simplify_gen_subreg (GET_MODE (orig_x), x, Pmode, 0); >> > + x = simplify_gen_subreg (GET_MODE (orig_x), x, ptr_mode, 0); > > and using GET_MODE (x) instead of Pmode/ptr_mode here? I mean, > x is certainly not VOIDmode here, should be either SImode or DImode > and thus simplify_gen_subreg ought to work for it.
This also works, we look at orig_x that looks like: (mem/u/c:SI (const:DI (unspec:DI [ (symbol_ref:SI ("__sflush") [flags 0x41] <function_decl 0x7f6f2eaad000 __sflush>) ] UNSPEC_GOTPCREL)) [2 S4 A8]) So, we look at SImode load, and compare it with SImode (actually ptr_mode) symbol. Will your suggestion work with this RTX? Thanks, Uros.