https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116264

--- Comment #1 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
Our strategy is only generating nf when it's needed(nf operations are needed
between eflags producer and consumer).

Here, look like pass_combine find an opportunity to drop the clobber flags and
cost model is profitable. 

Trying 3, 32 -> 34:
    3: r101:SI=r107:SI
      REG_DEAD r107:SI
   32: {r104:SI=r101:SI&0xffffffffffefffff;clobber flags:CC;}
      REG_UNUSED flags:CC
   34: r101:SI={(flags:CCZ!=0)?r104:SI:r101:SI}
      REG_DEAD r104:SI
      REG_DEAD flags:CCZ
Failed to match this instruction:
(set (reg/v:SI 101 [ b ])
    (if_then_else:SI (ne (reg:CCZ 17 flags)
            (const_int 0 [0]))
        (and:SI (reg:SI 107 [ b ])
            (const_int -1048577 [0xffffffffffefffff]))
        (reg:SI 107 [ b ])))
Successfully matched this instruction:
(set (reg:SI 104)
    (and:SI (reg:SI 107 [ b ])
        (const_int -1048577 [0xffffffffffefffff])))
Successfully matched this instruction:
(set (reg/v:SI 101 [ b ])
    (if_then_else:SI (ne (reg:CCZ 17 flags)
            (const_int 0 [0]))
        (reg:SI 104)
        (reg:SI 107 [ b ])))
allowing combination of insns 3, 32 and 34
original costs 4 + 4 + 4 = 12
replacement costs 4 + 4 = 8
deferring deletion of insn with uid = 3.
modifying insn i2    32: r104:SI=r107:SI&0xffffffffffefffff
deferring rescan insn with uid = 32.
modifying insn i3    34: r101:SI={(flags:CCZ!=0)?r104:SI:r107:SI}
      REG_DEAD r107:SI
      REG_DEAD flags:CCZ
      REG_DEAD r104:SI
deferring rescan insn with uid = 34.

@hongyu could you take a look.

Reply via email to