RISC-V: add U-type imm parsing to insn.h header
authorHeiko Stuebner <heiko.stuebner@vrull.eu>
Fri, 23 Dec 2022 22:13:29 +0000 (23:13 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 29 Dec 2022 14:59:49 +0000 (06:59 -0800)
commit8963d6224009d7ac0523a05ceb9ea5d04ad5d12d
treebe06ed3a0400fe3ab64fc0ebc7f55080d47e3700
parentdebe28d0a52e972ab4d735ea2e12c2f88ec19d7c
RISC-V: add U-type imm parsing to insn.h header

Similar to other existing types, allow extracting the immediate
for a U-type instruction.

U-type immediates are special in that regard, that the value
in the instruction in bits [31:12] already represents the same
bits of the immediate, so no shifting is required.

U-type immediates are for example used in the auipc instruction,
so these constants make it easier to parse such instructions.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@vrull.eu>
Link: https://lore.kernel.org/r/20221223221332.4127602-10-heiko@sntech.de
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/insn.h