Message ID | 20110428152227.GL19947@bubble.grove.modra.org |
---|---|
State | New |
Headers | show |
On Thu, Apr 28, 2011 at 11:22 AM, Alan Modra <amodra@gmail.com> wrote: > This patch fixes the following warnings seen during a powerpc64 > bootstrap. > > libgomp/config/linux/sem.c: In function ‘gomp_sem_wait_slow’: > libgomp/config/linux/sem.c:33:1: note: non-delegitimized UNSPEC UNSPEC_TOCREL (44) found in variable location > libgomp/config/linux/bar.c: In function ‘gomp_barrier_wait_end’: > libgomp/config/linux/bar.c:34:1: note: non-delegitimized UNSPEC UNSPEC_TOCREL (44) found in variable location > > What's happening is that we are getting an address that looked like > lo_sum ((reg 31) > (const (plus (unspec [symbol_ref ("some_var") tocrel]) 4))) > > but only expect to handle something like > lo_sum ((reg 31) > (const (unspec [symbol_ref ("some_var") tocrel]))) > > I also tidied the macho code which used a mix of "orig_x" and "x", > makeing the code fragile wrt. some future change that assigns "x" > earlier in the function. (If orig_x is a lo_sum, then x == orig_x > currently.) > > Bootstrapped and regression tested powerpc64-linux. OK to apply? > > * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle > unspec plus offset. Tidy macho code. Looks good. Thanks, David
On Thu, Apr 28, 2011 at 01:58:24PM -0400, David Edelsohn wrote: > On Thu, Apr 28, 2011 at 11:22 AM, Alan Modra <amodra@gmail.com> wrote: > > * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle > > unspec plus offset. Tidy macho code. > > Looks good. Committed mainline revision 173141. I meant to ask about 4.6 as we have the same problem there. OK for 4.6 too?
Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 173064) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -6380,7 +6380,16 @@ rs6000_delegitimize_address (rtx orig_x) if (GET_CODE (x) == (TARGET_CMODEL != CMODEL_SMALL ? LO_SUM : PLUS) && GET_CODE (XEXP (x, 1)) == CONST) { + rtx offset = NULL_RTX; + y = XEXP (XEXP (x, 1), 0); + if (GET_CODE (y) == PLUS + && GET_MODE (y) == Pmode + && CONST_INT_P (XEXP (y, 1))) + { + offset = XEXP (y, 1); + y = XEXP (y, 0); + } if (GET_CODE (y) == UNSPEC && XINT (y, 1) == UNSPEC_TOCREL && ((GET_CODE (XEXP (x, 0)) == REG @@ -6396,6 +6405,8 @@ rs6000_delegitimize_address (rtx orig_x) XEXP (XEXP (XEXP (x, 0), 1), 0))))) { y = XVECEXP (y, 0, 0); + if (offset != NULL_RTX) + y = gen_rtx_PLUS (Pmode, y, offset); if (!MEM_P (orig_x)) return y; else @@ -6405,9 +6416,9 @@ rs6000_delegitimize_address (rtx orig_x) if (TARGET_MACHO && GET_CODE (orig_x) == LO_SUM - && GET_CODE (XEXP (x, 1)) == CONST) + && GET_CODE (XEXP (orig_x, 1)) == CONST) { - y = XEXP (XEXP (x, 1), 0); + y = XEXP (XEXP (orig_x, 1), 0); if (GET_CODE (y) == UNSPEC && XINT (y, 1) == UNSPEC_MACHOPIC_OFFSET) return XVECEXP (y, 0, 0);