BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tiezhu Yang" <yangtiezhu@loongson.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] LoongArch: BPF: Optimize doubleword loads with ld.d and ldptr.d
Date: Wed, 18 Nov 2026 08:22:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-220432@kernel.org> (raw)
In-Reply-To: <20261118081201.10498-1-yangtiezhu@loongson.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] loongarch: bpf: call to undeclared is_aligned_signed_imm16() in
  build_insn()
--

commit 6d9b52d1b981a940a37fd81d368c20f9bfdc04fb
Author: Tiezhu Yang <yangtiezhu@loongson.cn>

LoongArch: BPF: Optimize doubleword loads with ld.d and ldptr.d

This commit optimizes 64-bit BPF doubleword loads in the LoongArch JIT by
emitting ld.d or ldptr.d when the offset fits in a signed 12-bit or aligned
signed 16-bit immediate.

> diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c
> index 15af1abb5cb69..15f40b570b9af 100644
> --- a/arch/loongarch/net/bpf_jit.c
> +++ b/arch/loongarch/net/bpf_jit.c
> @@ -1352,8 +1352,14 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
>  			}
>  			break;
>  		case BPF_DW:
> -			move_imm(ctx, t1, off);
> -			emit_insn(ctx, ldxd, dst, src, t1);
> +			if (is_signed_imm12(off)) {
> +				emit_insn(ctx, ldd, dst, src, off);
> +			} else if (is_aligned_signed_imm16(off)) {
> +				emit_insn(ctx, ldptrd, dst, src, off >> 2);

[Severity: High]
Does this break the build when CONFIG_BPF_JIT is enabled because
is_aligned_signed_imm16() is not defined in arch/loongarch/net/bpf_jit.h?
The prerequisite commit "LoongArch: BPF: Fix the offset of stptr.w and
stptr.d stores" noted below the --- separator is not applied in this tree.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118081201.10498-1-yangtiezhu@loongson.cn?part=1

      reply	other threads:[~2026-11-18  8:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  8:12 [PATCH] LoongArch: BPF: Optimize doubleword loads with ld.d and ldptr.d Tiezhu Yang
2026-11-18  8:22 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-220432@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox