On Sat, Jul 9, 2011 at 3:43 PM, Richard Henderson <r...@redhat.com> wrote: > On 07/09/2011 02:36 PM, H.J. Lu wrote: >> >> Hi, >> >> Thunk is in ptr_mode, not Pmode. OK for trunk? >> >> Thanks. >> >> H.J. >> --- >> 2011-07-09 H.J. Lu <hongjiu...@intel.com> >> >> * config/i386/i386.c (x86_output_mi_thunk): Use ptr_mode instead >> of Pmode for vtable adjustment. >> >> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c >> index 04cb07d..c852719 100644 >> --- a/gcc/config/i386/i386.c >> +++ b/gcc/config/i386/i386.c >> @@ -29338,7 +29681,7 @@ x86_output_mi_thunk (FILE *file, >> if (vcall_offset) >> { >> if (TARGET_64BIT) >> - tmp = gen_rtx_REG (DImode, R10_REG); >> + tmp = gen_rtx_REG (ptr_mode, R10_REG); >> else >> { >> int tmp_regno = CX_REG; >> @@ -29348,7 +29691,7 @@ x86_output_mi_thunk (FILE *file, >> tmp = gen_rtx_REG (SImode, tmp_regno); >> } >> >> - xops[0] = gen_rtx_MEM (Pmode, this_reg); >> + xops[0] = gen_rtx_MEM (ptr_mode, this_reg); >> xops[1] = tmp; >> output_asm_insn ("mov%z1\t{%0, %1|%1, %0}", xops); >> >> @@ -29360,9 +29703,10 @@ x86_output_mi_thunk (FILE *file, >> xops[0] = GEN_INT (vcall_offset); >> xops[1] = tmp2; >> output_asm_insn ("mov{q}\t{%0, %1|%1, %0}", xops); >> - xops[0] = gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, tmp, tmp2)); >> + xops[0] = gen_rtx_MEM (ptr_mode, >> + gen_rtx_PLUS (Pmode, tmp, tmp2)); >> } >> - xops[1] = this_reg; >> + xops[1] = gen_rtx_REG (ptr_mode, REGNO (this_reg)); > > Not ok. This is incoherent in its treatment of Pmode vs ptr_mode. > You're creating an addition > > (plus:P (reg:ptr tmp) (reg:P tmp2))
It is because thunk is stored in ptr_mode, not Pmode. > > I have a queued patch that replaces all of this with rtl. I will > post it later today. > I will update it for x32 after your change is checked in. Thanks. -- H.J.