mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
LoongArch: BPF: Support sign-extension mov instructions
Add support for sign-extension mov instructions. Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
7111afe8fb
commit
f48012f161
1 changed files with 17 additions and 2 deletions
|
@ -472,8 +472,23 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
|
||||||
/* dst = src */
|
/* dst = src */
|
||||||
case BPF_ALU | BPF_MOV | BPF_X:
|
case BPF_ALU | BPF_MOV | BPF_X:
|
||||||
case BPF_ALU64 | BPF_MOV | BPF_X:
|
case BPF_ALU64 | BPF_MOV | BPF_X:
|
||||||
move_reg(ctx, dst, src);
|
switch (off) {
|
||||||
emit_zext_32(ctx, dst, is32);
|
case 0:
|
||||||
|
move_reg(ctx, dst, src);
|
||||||
|
emit_zext_32(ctx, dst, is32);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
move_reg(ctx, t1, src);
|
||||||
|
emit_insn(ctx, extwb, dst, t1);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
move_reg(ctx, t1, src);
|
||||||
|
emit_insn(ctx, extwh, dst, t1);
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
emit_insn(ctx, addw, dst, src, LOONGARCH_GPR_ZERO);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* dst = imm */
|
/* dst = imm */
|
||||||
|
|
Loading…
Add table
Reference in a new issue