Paolo Bonzini wrote:
I think that if you add the simplification to simplify-rtx.c's
simplify_subreg, combine should pick it up automagically.
Paolo
There we have it! There is apparently already this optimization
performed - so I will have to dig further into why it does not a happen.
simplify_subreg()
<snip>
/* If we're requesting the lowpart of a zero or sign extension,
there are three possibilities. If the outermode is the same
as the origmode, we can omit both the extension and the subreg.
If the outermode is not larger than the origmode, we can apply
the truncation without the extension. Finally, if the outermode
is larger than the origmode, but both are integer modes, we
can just extend to the appropriate mode. */