Sounds a lot like the PowerPC's rlwinm instruction.
The PowerPC 600 series, part 5: Rotates and shifts
https://devblogs.microsoft.com/oldnewthing/20180810-00/?p=99...