Ideally this could be caught in the asm parser, but that would essentially require that the parser ask the emitter if there is a valid encoding.
So the next best thing is to fail in the emitter rather than encode something that is not the instruction the user wrote.
Fixes PR25003
The HasRex argument to this function isn't used by the body.