Internally we store constants in int64_t after parsing, but this is
kind of an implementation detail. If we only supported rv32, we might
have chosen int32_t.
For rv32, I think it makes sense to accept the constants that we
would accept if int32_t was the internal type. In fact we already
do this for the li alias. This patch extends this to sign
extended constants for other instructions.
This matches the GNU assembler. The difference between LLVM and gcc
was previously noted here. https://github.com/riscv-non-isa/riscv-asm-manual/pull/71
Is this checking the right thing? It seems like maybe we want to allow the 32 bit form on the Imm -1, not the Imm. Main case I'm thinking of is what if imm is smin<5> and thus smin<5>-1 is not an int<5>.
Alternatively said, please check what gcc does and make sure our behavior matches in the edge case.