[PATCH v4 11/12] RISC-V: add helpers for handling immediates in U-type and I-type pairs
Lad, Prabhakar
prabhakar.csengg at gmail.com
Sun Dec 11 12:45:24 PST 2022
On Wed, Dec 7, 2022 at 6:09 PM Heiko Stuebner <heiko at sntech.de> wrote:
>
> From: Heiko Stuebner <heiko.stuebner at vrull.eu>
>
> Used together U-type and I-type instructions can for example be used to
> generate bigger jumps (i.e. in auipc+jalr pairs) by splitting the value
> into an upper immediate (i.e. auipc) and a 12bit immediate (i.e. jalr).
>
> Due to both immediates being considered signed this creates some corner
> cases, so add some helper to prevent this from getting duplicated in
> different places.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner at vrull.eu>
> ---
> arch/riscv/include/asm/insn.h | 47 +++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>
Cheers,
Prabhakar
More information about the linux-riscv
mailing list