This fixes the first issue exposed by PR30483. (See comment 1 in the IR).
First I tried to fix a more general problem in dag combine. I wanted to address all code sequences of shifts and ands, with an extension in the middle. My solution was to bring the extension insn to the beginning of the sequence so the sequence of shifts and ands can be merged together during isel. That approach did not work because this particular sequence is created in target independent dag combine in DAGCombiner::visitSRL.
So alternatively I decided to address this particular sequence in isel. If we encounter similar issues, we can think of a more general solution.
I am not sure if this is always legal. Will check that.