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

--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
FWIW, I agree with Richard that this seems like something that
should be fixed in RTL.  In some ways it's the opposite of
what lower-subreg does: whereas lower-subreg is a bit like SRA
for RTL, the new pass would try to consolidate fields of
individual registers.

I think it's the lack of this consolidation that also causes
unnecessary moves for TBL2, etc., in autovectorised code.

Not thought about this much, but I think there would be two
parts to it:

(1) Look for a pseudo P that always tracks fields N-M of a
    multi-register pseudo MP.  Replace all references to P
    with the associated subreg of MP.

    This goes against the normal practice of preferring
    plain regs to subregs, so should probably happen
    quite late (e.g. after combine).

(2) Look for collections of subreg-to-subreg moves whose
    net effect is to move a multi-pseudo register MP1 to
    another multi-pseudo register MP2.  Replace them with a
    direct move from MP1 to MP2.

    Consolidating multiple subreg moves into one bigger
    subreg move might also be useful, not sure.

Reply via email to