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

--- Comment #5 from user202729 <user202729 at protonmail dot com> ---
I think this can be resolved by implementing some code in combine.cc to
replace:

(set:TI (reg:TI 101) (zero_extend:TI (...:DI ...)))
(set:DI (reg:DI ...) (subreg:DI (reg:TI 101) 8))

with

(set:TI (reg:TI 101) (zero_extend:TI (...:DI ...)))
(set:DI (reg:DI ...) (const_int 0))

This certainly is always an improvement, because 0 is simpler than extracting
the subregister.

After that, a few other passes of combine rescanning should be able to constant
fold the 0 forward.

Unfortunately, I don't know how to modify combine.cc or some other files to
handle this pattern. Can anyone give a suggestion? (maybe add a
define_peephole2 in common.md ? )

Reply via email to