This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [i386] Scalar DImode instructions on XMM registers


2015-05-21 22:08 GMT+03:00 Vladimir Makarov <vmakarov@redhat.com>:
> On 05/21/2015 05:54 AM, Ilya Enkovich wrote:
>>>
>>> Thanks.  For me it looks like an inheritance bug.  It is really hard
>>> >to fix the bug w/o the source code.  Could you send me your patch in
>>> >order I can debug RA with it to investigate more.
>>> >
>>
>> Sure! Here is a patch and a testcase.  I applied patch to r222125.  Cmd to
>> reproduce:
>>
>> gcc -m32 -msse4.2 -O2 pr65105.c -S -march=slm -fPIE
>
> The problem is in sharing a subreg in different insns.  Pseudo should be
> shared but not their subregs.
>
> We have before inheritance:
>
>    28: r132:V2DI=r132:V2DI|r126:DI#0
>       REG_DEAD r126:DI
>       REG_DEAD r118:DI
>     Inserting insn reload before:
>    81: r132:V2DI=r118:DI#0
>     Inserting insn reload after:
>    82: r108:DI#0=r132:V2DI
> ...
>       Creating newreg=135, assigning class SSE_REGS to r135
>    42: r135:V2DI=r135:V2DI&r108:DI#0
>       REG_DEAD r127:DI
>     Inserting insn reload before:
>    85: r135:V2DI=r127:DI#0
>     Inserting insn reload after:
>    86: r108:DI#0=r135:V2DI
>
> As subreg of 108 in original insns 28 and 42 are shared, The subregs of 108
> in insns 82 and 86 are shared too.  During inheritance subpass we change
> r108 in insn 82 onto r137.  This change insn 86 too.
>
>       Creating newreg=137 from oldreg=108, assigning class NO_REX_SSE_REGS
> to inheritance r137
>     Original reg change 108->137 (bb2):
>    82: r137:DI#0=r132:V2DI
>       REG_DEAD r132:V2DI
>     Add original<-inheritance after:
>    88: r108:DI=r137:DI
>
>     Inheritance reuse change 108->137 (bb2):
>    68: r124:V2DI=r137:DI#0
>
> And now we are trying to do inheritance for insn #86:
>
>      Creating newreg=138 from oldreg=108, assigning class NO_REX_SSE_REGS to
> inheritance r138
>     Original reg change 108->138 (bb3):
>    86: r137:DI#0=r135:V2DI
>       REG_DEAD r135:V2DI
>     Add original<-inheritance after:
>    89: r108:DI=r138:DI
>
>     Inheritance reuse change 108->138 (bb3):
>    64: r123:V2DI=r137:DI#0
>
> and after that having a complete mess.  We are trying to change r108 onto
> r138, but r108 is already r137 because of sharing. Later we undo the second
> inheritance creating even more mess.
>
> So, Ilya, to solve the problem you need to avoid sharing subregs for the
> correct LRA/reload work.
>
>

Thanks a lot for your help! I'll fix it.

Ilya


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]