mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
riscv, bpf: Unify 32-bit sign-extension to emit_sextw
For code unification, add emit_sextw wrapper to unify all the 32-bit sign-extension operations. Signed-off-by: Pu Lehui <pulehui@huawei.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Tested-by: Björn Töpel <bjorn@rivosinc.com> Acked-by: Björn Töpel <bjorn@kernel.org> Link: https://lore.kernel.org/bpf/20240115131235.2914289-2-pulehui@huaweicloud.com
This commit is contained in:
committed by
Daniel Borkmann
parent
ad57654053
commit
e33758f749
@@ -1087,6 +1087,11 @@ static inline void emit_subw(u8 rd, u8 rs1, u8 rs2, struct rv_jit_context *ctx)
|
||||
emit(rv_subw(rd, rs1, rs2), ctx);
|
||||
}
|
||||
|
||||
static inline void emit_sextw(u8 rd, u8 rs, struct rv_jit_context *ctx)
|
||||
{
|
||||
emit_addiw(rd, rs, 0, ctx);
|
||||
}
|
||||
|
||||
#endif /* __riscv_xlen == 64 */
|
||||
|
||||
void bpf_jit_build_prologue(struct rv_jit_context *ctx);
|
||||
|
||||
Reference in New Issue
Block a user