[Bug target/85755] PowerPC Gcc's -mupdate produces inefficient code on power8/power9 machines

segher at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat May 12 00:21:00 GMT 2018


Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-05-12
     Ever confirmed|0                           |1

--- Comment #1 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Before RA it is all just fine:

insn_cost 4 for    14: [++r121:DI]=r122:DI
      REG_INC r121:DI
insn_cost 4 for    15: r122:DI=r122:DI+0x1
insn_cost 0 for    30: {pc={(r129:DI!=0x1)?L16:pc};r129:DI=r129:DI-0x1;clobber
scratch;clobber scratch;}
      REG_BR_PROB 955630228

IRA make a good choice:

    3:r121 l0     3    0:r122 l0     9    4:r125 l0     3    2:r126 l0     4
    5:r127 l0    68    1:r129 l0    66

and then LRA comes along:

         Choosing alt 6 in insn 14:  (0) ^m  (1) d {*movdi_internal64}
      Creating newreg=132 from oldreg=122, assigning class FLOAT_REGS to r132
   14: [++r121:DI]=r132:DI
      REG_INC r121:DI
    Inserting insn reload before:
   35: r132:DI=r122:DI

We want to have alt 0 instead (r -> YZ), which gives

            0 Non input pseudo reload: reject++

but we get alt 6 (d -> ^m), which gives


Putting the disparagement on the correct operand, i.e. as  ^d -> m  gives

            alt=6,overall=12,losers=1 -- refuse

and we should make that change; but yes we want an stdu, too.  Should "Y"
allow that?

GCC 7 did this fine; GCC 8 of a month ago, too.  What changed?

More information about the Gcc-bugs mailing list