summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiezhu Yang <yangtiezhu@loongson.cn>2026-08-17 22:07:24 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2026-08-17 22:07:24 +0800
commit252ae40ba91c5da3a792bba7e3dc46b106dec86c (patch)
treea420e2dcb9d5830fa2ff9f7e1e96405898deb81c
parent32a5e3eaa086c64c2ca9a4611769faae60716ae7 (diff)
LoongArch: BPF: Remove dead move_imm() call in BPF_NEG path
The BPF_NEG operation is a unary operator that performs `dst = -dst`. The current code unconditionally executes a move_imm() call before the subtraction, generating useless JITted instructions to load data into the temporary register `t1`. This `t1` register is never used anywhere else in the entire BPF_NEG path. Remove this dead `move_imm()` call to avoid useless instructions. Acked-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
-rw-r--r--arch/loongarch/net/bpf_jit.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c
index f9ba7b961b04..a5e902eb646c 100644
--- a/arch/loongarch/net/bpf_jit.c
+++ b/arch/loongarch/net/bpf_jit.c
@@ -869,7 +869,6 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
/* dst = -dst */
case BPF_ALU | BPF_NEG:
case BPF_ALU64 | BPF_NEG:
- move_imm(ctx, t1, imm, is32);
emit_insn(ctx, subd, dst, LOONGARCH_GPR_ZERO, dst);
emit_zext_32(ctx, dst, is32);
break;