Skip to content

Commit de39d2c

Browse files
Pu Lehuiborkmann
authored andcommitted
riscv, bpf: Add Zacas instructions
Add Zacas instructions introduced by [0] to reduce code size and improve performance of RV64 JIT. Signed-off-by: Pu Lehui <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Björn Töpel <[email protected]> Reviewed-by: Björn Töpel <[email protected]> Acked-by: Björn Töpel <[email protected]> Link: https://github.com/riscvarchive/riscv-zacas/releases/download/v1.0/riscv-zacas.pdf [0] Link: https://lore.kernel.org/bpf/[email protected]
1 parent 5090b33 commit de39d2c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/riscv/net/bpf_jit.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,17 @@ static inline u16 rvc_swsp(u32 imm8, u8 rs2)
751751
return rv_css_insn(0x6, imm, rs2, 0x2);
752752
}
753753

754+
/* RVZACAS instructions. */
755+
static inline u32 rvzacas_amocas_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl)
756+
{
757+
return rv_amo_insn(0x5, aq, rl, rs2, rs1, 2, rd, 0x2f);
758+
}
759+
760+
static inline u32 rvzacas_amocas_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl)
761+
{
762+
return rv_amo_insn(0x5, aq, rl, rs2, rs1, 3, rd, 0x2f);
763+
}
764+
754765
/* RVZBA instructions. */
755766
static inline u32 rvzba_sh2add(u8 rd, u8 rs1, u8 rs2)
756767
{

0 commit comments

Comments
 (0)