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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |9.0
             Status|NEW                         |RESOLVED

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC9+ does:
        subs    x3, x0, x1, sxth 3
        add     w1, w2, w1, sxth
        add     w1, w1, w3
        add     w0, w2, w0
        csel    w0, w1, w0, ne
        ret

GCC 8 produced:
        sxth    w1, w1
        subs    x3, x0, x1, sxth 3
        add     w1, w1, w2
        add     w1, w1, w3
        add     w0, w2, w0
        csel    w0, w1, w0, ne
        ret

GCC 9's combine is able to do this:
Trying 3 -> 8:
    3: r99:SI=sign_extend(x1:HI)
      REG_DEAD x1:HI
    8: r101:DI=sign_extend(r99:SI#0)
Failed to match this instruction:
(parallel [
        (set (reg:DI 101 [ b ])
            (sign_extend:DI (reg:HI 1 x1 [ b ])))
        (set (reg/v:SI 99 [ b ])
            (sign_extend:SI (reg:HI 1 x1 [ b ])))
    ])
Failed to match this instruction:
(parallel [
        (set (reg:DI 101 [ b ])
            (sign_extend:DI (reg:HI 1 x1 [ b ])))
        (set (reg/v:SI 99 [ b ])
            (sign_extend:SI (reg:HI 1 x1 [ b ])))
    ])
Successfully matched this instruction:
(set (reg/v:SI 99 [ b ])
    (sign_extend:SI (reg:HI 1 x1 [ b ])))
Successfully matched this instruction:
(set (reg:DI 101 [ b ])
    (sign_extend:DI (reg:HI 1 x1 [ b ])))
allowing combination of insns 3 and 8
original costs 4 + 4 = 8
replacement costs 4 + 4 = 8

So fixed by r9-2064.

Reply via email to