Commit 119220d8 authored by Tiezhu Yang's avatar Tiezhu Yang Committed by Daniel Borkmann
Browse files

bpf, arm64: Remove redundant switch case about BPF_DIV and BPF_MOD



After commit 96a71005 ("bpf, arm64: remove obsolete exception handling
from div/mod"), there is no need to check twice about BPF_DIV and BPF_MOD,
remove the redundant switch case.

Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/1621328170-17583-1-git-send-email-yangtiezhu@loongson.cn
parent f18ba26d
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -485,18 +485,13 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
		break;
	case BPF_ALU | BPF_DIV | BPF_X:
	case BPF_ALU64 | BPF_DIV | BPF_X:
	case BPF_ALU | BPF_MOD | BPF_X:
	case BPF_ALU64 | BPF_MOD | BPF_X:
		switch (BPF_OP(code)) {
		case BPF_DIV:
		emit(A64_UDIV(is64, dst, dst, src), ctx);
		break;
		case BPF_MOD:
	case BPF_ALU | BPF_MOD | BPF_X:
	case BPF_ALU64 | BPF_MOD | BPF_X:
		emit(A64_UDIV(is64, tmp, dst, src), ctx);
		emit(A64_MSUB(is64, dst, dst, tmp, src), ctx);
		break;
		}
		break;
	case BPF_ALU | BPF_LSH | BPF_X:
	case BPF_ALU64 | BPF_LSH | BPF_X:
		emit(A64_LSLV(is64, dst, dst, src), ctx);