Re: [PATCH v1 2/3] LoongArch: BPF: Remove dead move_imm() call in BPF_NEG path
Hengqi Chen <[email protected]> Sun, 26 Jul 2026 16:36:47 +0800
| Newsgroups | dev.linux.lists.loongarch,org.kernel.vger.bpf,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAEyhmHRcGHgG5Xyd7hDzUpwTwNKDKcwsABcEZ5TH5xaKAzmabw@mail.gmail.com> |
On Sat, Jul 11, 2026 at 6:10=E2=80=AFPM Tiezhu Yang <[email protected]= > wrote: > > The BPF_NEG operation is a unary operator that performs `dst =3D -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. > > Signed-off-by: Tiezhu Yang <[email protected]> > --- > arch/loongarch/net/bpf_jit.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c > index 2738b4db1165..5f32b205a6ac 100644 > --- a/arch/loongarch/net/bpf_jit.c > +++ b/arch/loongarch/net/bpf_jit.c > @@ -894,7 +894,6 @@ static int build_insn(const struct bpf_insn *insn, st= ruct jit_ctx *ctx, bool ext > /* dst =3D -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; > -- Acked-by: Hengqi Chen <[email protected]> > 2.42.0 >