http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56069



Vladimir Makarov <vmakarov at redhat dot com> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |vmakarov at redhat dot com



--- Comment #2 from Vladimir Makarov <vmakarov at redhat dot com> 2013-01-22 
21:01:21 UTC ---

It is definitely regmove pass drawback.  IRA can do nothing in this

case.



We have the following code before and after regmove:



    2: r62:DI=di:DI                          2: r63:DI=di:DI

      REG_DEAD di:DI                           REG_DEAD di:DI

    6: {r64:DI=r62:DI 0>>0x3;clobber fla     6: {r63:DI=r63:DI 0>>0x3;clobber

fl

      REG_DEAD r62:DI

    7: r65:DI=0x100000000000                 7: r65:DI=0x100000000000

    8: {r63:DI=r64:DI|r65:DI;clobber fla     8: {r63:DI=r63:DI|r65:DI;clobber

fl

      REG_DEAD r65:DI                          REG_DEAD r65:DI

      REG_DEAD r64:DI

   13: ax:DI=r63:DI                         13: ax:DI=r63:DI

      REG_DEAD r63:DI                          REG_DEAD r63:DI

   16: use ax:DI                            16: use ax:DI



Regmove changes r64 to r63.  It makes two equal hard reg preferences

for r63: AX or DI. Choosing either one results in worse code.



The original generated code can be achieved if regmove changes r65 to

r63.  In this case we have only one hard register preference for r63

(AX) and for r62 (DI).



It can be achieved if regmove tries all orders of commutative operands

(now regmove pass uses the first found order) using additional

heuristics (live range length and/or number of preferred hard regs) to

choose the best order.



It is not a trivial change and can not be done for given release

(gcc4.8).



Also now we have LRA and may be such regmove transformations are not

necessary.  I am going to try this for gcc4.9 when I have more time.

Still to assign ax to r65 and r63 we also need some hard register

preference propagations in IRA which is currently absent.



In any case, I think that older releases were just lucky and generated

the best code as some passes before regmove put r65 as a first input

operand.

Reply via email to