Hi! On Mon, Sep 12, 2022 at 12:40:31AM +0100, Roger Sayle wrote: > * gcc/combine.cc (expand_compound_operation): Don't expand/transform > ZERO_EXTEND or SIGN_EXTEND on targets where rtx_cost claims they are > cheap. If gen_lowpart returns a SUBREG of something other than a > REG or a MEM, i.e. invalid RTL, return the original expression.
This needs testing and analysis on all platforms. > @@ -7309,7 +7319,11 @@ expand_compound_operation (rtx x) > if (modewidth >= pos + len) > { > tem = gen_lowpart (mode, XEXP (x, 0)); > - if (!tem || GET_CODE (tem) == CLOBBER) > + if (!tem > + || GET_CODE (tem) == CLOBBER > + || (GET_CODE (tem) == SUBREG > + && !REG_P (SUBREG_REG (tem)) > + && !MEM_P (SUBREG_REG (tem)))) > return x; Why handle subregs of memory here? Those are antiquated, and should go away pretty soon. All of {expand,make}_compound_operation should be removed. But this is non-trivial work. All of {SIGN,ZERO}_EXTRACT should be eradicated as well, in my opinion. Segher