Message ID | 20110129035406.GI9489@bubble.grove.modra.org |
---|---|
State | New |
Headers | show |
On Fri, Jan 28, 2011 at 10:54 PM, Alan Modra <amodra@gmail.com> wrote: > Well it seems that combine is merging a subreg with a load from mem, > which is OK, I think, but that's how the +4 offset happens. For > power6/7 we also combine to get a lfiwax insn, which can't take an > offset. So the address gets reloaded into a reg. All of a sudden > the toc-relative address is no longer in a mem, instead being in a > largetoc_low insn. When final.c emits the insn, print_operand is > called rather than print_operand_address, bypassing the hack I added > there to rearrange the addend to suit gas. > > Bootstrapped and regression tested powerpc64-linux. OK to apply? > > * config/rs6000/rs6000.c (print_operand): Rearrange addends in > toc relative expressions as we do in print_operand_address. Okay. Thanks, David
Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 169076) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -16182,7 +16182,18 @@ print_operand (FILE *file, rtx x, int co output_address (XEXP (x, 0)); } else - output_addr_const (file, x); + { + if (toc_relative_expr_p (x)) + /* This hack along with a corresponding hack in + rs6000_output_addr_const_extra arranges to output addends + where the assembler expects to find them. eg. + (const (plus (unspec [symbol_ref ("x") tocrel]) 4)) + without this hack would be output as "x@toc+4". We + want "x+4@toc". */ + output_addr_const (file, tocrel_base); + else + output_addr_const (file, x); + } return; case '&':