diff options
author | Artem Savkov <[email protected]> | 2024-05-17 09:56:49 +0200 |
---|---|---|
committer | Michael Ellerman <[email protected]> | 2024-07-11 15:40:21 +1000 |
commit | 597b1710982d10b8629697e4a548b30d0d93eeed (patch) | |
tree | f705f2a02c67746b5d15f95c5297afcc64f2ee8b | |
parent | 717756c9c8ddad9f28389185bfb161d4d88e01a4 (diff) |
powerpc64/bpf: jit support for sign extended mov
Add jit support for sign extended mov. Tested using test_bpf module.
Signed-off-by: Artem Savkov <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
-rw-r--r-- | arch/powerpc/net/bpf_jit_comp64.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c index ca3ca6e01db2..063e5e92f01e 100644 --- a/arch/powerpc/net/bpf_jit_comp64.c +++ b/arch/powerpc/net/bpf_jit_comp64.c @@ -676,8 +676,14 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code /* special mov32 for zext */ EMIT(PPC_RAW_RLWINM(dst_reg, dst_reg, 0, 0, 31)); break; - } - EMIT(PPC_RAW_MR(dst_reg, src_reg)); + } else if (off == 8) { + EMIT(PPC_RAW_EXTSB(dst_reg, src_reg)); + } else if (off == 16) { + EMIT(PPC_RAW_EXTSH(dst_reg, src_reg)); + } else if (off == 32) { + EMIT(PPC_RAW_EXTSW(dst_reg, src_reg)); + } else if (dst_reg != src_reg) + EMIT(PPC_RAW_MR(dst_reg, src_reg)); goto bpf_alu32_trunc; case BPF_ALU | BPF_MOV | BPF_K: /* (u32) dst = imm */ case BPF_ALU64 | BPF_MOV | BPF_K: /* dst = (s64) imm */ |