On Fri, Jan 30, 2015 at 1:57 AM, Alan Modra <amo...@gmail.com> wrote:
> On Fri, Jan 16, 2015 at 08:12:27PM +1030, Alan Modra wrote:
>> https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123776.html
>> shows gcc-5 miscompiling a powerpc64 linux kernel.  The executive
>> summary is that the rs6000 backend has a bug in its RTL description of
>> indirect calls.  We specify a parallel containing both the actual call
>> and an action that happens after the call, the restore of r2.  The
>> restore is simply a memory load:
>>             (set (reg:DI 2 2)
>>                 (mem/v/c:DI (plus:DI (reg/f:DI 1 1)
>>                         (const_int 40 [0x28])) [0  S8 A8]))
>> This leads to cprop concluding that it is valid to replace the
>> reference to r1 with another register having the same value before the
>> call.  Unfortunately, sometimes a call-clobbered register is chosen.
>
> This is the rs6000 backend fix.  Bootstrapped etc. powerpc64-linux.
> OK to apply?
>
> gcc/
>         * config/rs6000/rs6000.c (rs6000_call_aix): Use unspec rather
>         than mem for toc_restore.
>         * config/rs6000/rs6000.md (UNSPEC_TOCSLOT): Define.

Please insert UNSPEC_TOCSLOT in the UNSPEC list after UNSPEC_TOCPTR
and UNSPEC_TOC and add  a short comment like the other two.

>         (call_indirect_aix, call_value_indirect_aix): Adjust to suit.
>         (call_indirect_elfv2, call_value_indirect_elfv2): Likewise.
> gcc/testsuite/
>         * gcc.target/powerpc/cprophard.c: New.

Okay with that change.

Thanks, David

Reply via email to