Clean up the constant RSH code (and fix some bugs)

You'll just have to trust me on the bug fixing as it's part of an
unreleased chisel-torture.