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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-02-13
                 CC|                            |rts at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I guess the backend needs to help combiner here, e.g. for octeon-exts-3.c
before the combiner change on
(insn 2 4 3 2 (set (reg/v:DI 196 [ i+-4 ])
        (reg:DI 4 $4 [ i+-4 ])) "octeon-exts-3.c":34:1 312 {*movdi_64bit}
     (expr_list:REG_DEAD (reg:DI 4 $4 [ i+-4 ])
        (nil)))
(insn 6 3 7 2 (set (reg:SI 198)
        (ashift:SI (subreg/s/u:SI (reg/v:DI 196 [ i+-4 ]) 4)
            (const_int 4 [0x4]))) "octeon-exts-3.c":35:13 444 {*ashlsi3}
     (expr_list:REG_DEAD (reg/v:DI 196 [ i+-4 ])
        (nil)))
(insn 7 6 13 2 (set (reg:SI 197)
        (ashiftrt:SI (reg:SI 198)
            (const_int 24 [0x18]))) "octeon-exts-3.c":35:19 445 {*ashrsi3}
     (expr_list:REG_DEAD (reg:SI 198)
        (nil)))
(insn 13 7 14 2 (set (reg/i:DI 2 $2)
        (sign_extend:DI (reg:SI 197))) "octeon-exts-3.c":36:1 236 {extendsidi2}
     (expr_list:REG_DEAD (reg:SI 197)
        (nil)))
there was:
Trying 2 -> 6:
Successfully matched this instruction:
(set (reg:SI 199 [ D.1424 ])
    (ashift:SI (reg:SI 4 $4 [ i ])
        (const_int 4 [0x4])))
Trying 6 -> 7:
Successfully matched this instruction:
(set (reg:SI 198 [ D.1424 ])
    (sign_extract:SI (reg:SI 4 $4 [ i ])
        (const_int 8 [0x8])
        (const_int 20 [0x14])))
but after the combiner change the hard regs aren't propagated into the
instructions anymore, so we end up with:
Trying 2 -> 6:
Successfully matched this instruction:
(set (reg:SI 198)
    (ashift:SI (subreg:SI (reg:DI 200) 4)
        (const_int 4 [0x4])))
Trying 6 -> 7:
Failed to match this instruction:
(set (reg:SI 197)
    (ashiftrt:SI (truncate:SI (ashift:DI (reg:DI 200)
                (const_int 4 [0x4])))
        (const_int 24 [0x18])))
So, I'd say adding define_insn_and_split which would handle the above pattern
from the failed match, i.e. ashiftrt with truncate of ashift and split it into
a sign_extract of the lowpart subreg, then it would succeed again.

Reply via email to