From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: bpf@vger.kernel.org
Cc: Yonghong Song <yonghong.song@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>
Subject: Re: Register constraint in NEG instructions
Date: Wed, 26 Jul 2023 11:16:56 +0200 [thread overview]
Message-ID: <87y1j36nhz.fsf@oracle.com> (raw)
In-Reply-To: <878rb3842z.fsf@oracle.com> (Jose E. Marchesi's message of "Wed, 26 Jul 2023 10:33:24 +0200")
I see this in the verifier (bpf-next):
if (opcode == BPF_NEG) {
if (BPF_SRC(insn->code) != BPF_K ||
insn->src_reg != BPF_REG_0 ||
insn->off != 0 || insn->imm != 0) {
verbose(env, "BPF_NEG uses reserved fields\n");
return -EINVAL;
}
And along this llvm assembler test:
|
v
// CHECK: 84 01 00 00 00 00 00 00 w1 = -w1
w1 = -w1
Is enough evidence that NEG is supposed to use only dst and not src. I
am sending a fix for standarization/instruction-set.rst.
> Hello.
>
> The neg (and neg32) instructions are documented to use (and encode) both
> src and dst register operands in standarization/instruction-set.rst:
>
> BPF_NEG 0x80 dst = -src
>
> However, in llvm's BPFAsmParser::PreMatchCheck, it is checked that both
> source and destination registers refer to the same register. If they
> are not, an error is raised.
>
> Is this to speed up JIT to different architectures, some like x86
> featuring `NEG reg' and others like aarch64 featuring `NEG reg1,reg2'?
>
> Should I send a patch for instruction-set.rst documenting the
> requirement?
>
> Thanks.
next prev parent reply other threads:[~2023-07-26 9:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 8:33 Register constraint in NEG instructions Jose E. Marchesi
2023-07-26 9:16 ` Jose E. Marchesi [this message]
2023-07-26 13:30 ` Dave Thaler
2023-07-26 13:30 ` [Bpf] " Dave Thaler
2023-07-27 4:41 ` Yonghong Song
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=87y1j36nhz.fsf@oracle.com \
--to=jose.marchesi@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=yonghong.song@linux.dev \
/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