Work on some SM5 opcodes plus ld_ms, uge and ult.

Fixes for countbits, firstbit, bfrev, bfi and reflecting resource
dimensions.
Support more opcodes: uge, ult, ld_ms, ubfe, ibfe,
atomic_and/iadd/or/xor/imax/imin/umax/umin/cmp_store.
Removed some unused variables.