Hi, Segher wrote: >On Tue, Jan 29, 2019 at 02:51:30PM -0800, Andrew Pinski wrote: > >> Seems to me rather this should have been simplified to just: >> (set (reg:SI 93) >> (ashift:SI (sign_extract:SI (reg:SI 95) >> (const_int 3 [0x3]) >> (const_int 0 [0])) >> (const_int 19 [0x13]))) > > Yes.
> Because the two subreg cancel each other out. > Well, why did it ever think of using DI at all? I looked at this last week - the underlying issue is due to using extv optab without a mode. This then defaults to DI mode only. There is a newer extv<mode> optab, and using that to enable zero/sign_extract for SImode fixes this particular issue. However this triggers a bug in expmed using SI->HF lvalue-subregs which isn't legal. Unfortunately generated code after the change ends up worse overall, so it's not clear how to fix this. >> This would be a thing to add to simplify-rtx.c. > > This is probably specific to combine actually. Simplifying the subreg still won't allow the pattern to match since we don't enable sign_extract for SImode. Cheers, Wilco