Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1627234pxj; Wed, 19 May 2021 10:06:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW3iFY+3raheao9Qzf0bHbo2RCExVvocrxGMTLqtDqRaUJbMNSRCxbjgjMpDHWltnhkCo+ X-Received: by 2002:a17:906:56d1:: with SMTP id an17mr206662ejc.6.1621443971636; Wed, 19 May 2021 10:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621443971; cv=none; d=google.com; s=arc-20160816; b=y2/nUVNmEn9+7LEK8u+Jj9ba1ZF7lNiB42I8BzOAEU2lL2E1m8MzzZXD4LWh7Mzph1 LGsMjWsPf91jPVgTS6sP84a7mc1EhDPzysejIkkJ9hGOTKc5iWn9P7bs/1rxvGnmU0Sf wSeQ1YDLDl2ECwARhAyLJmTCWjL0reVbM1I5JZhpMtNSg3NMcyTOBaruYUyd7myXHfDV xUlu0bEvFxZw1+35u350IZKqtnkFbZdoKwh+tO+tOqhTAdmWfY94SlzM3lKfvEBp7pXu VqZ+g6LMCoGfDbxhR+88KD6k/8bYrKI+BrTFukm21V5CqSodhQT/h9KdcGzztRd+fUGl DanQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=jkLUPrO9fOIDwz/xJAj76zMEpZH0kSIquP+QkE4DcBo=; b=t8pF6D9fDqvKMlD10e/AsXTRCENDZnNog3rpTMo0SX5V9Xb9A6WgwTbBBiIBpfGt/M fOvTSpOYKgP2OIRM/VMEbkpDAlfIhoqh270AmILLkWdsE5iP3Z8R5cBWs0UqsAZq7/to Mlb0qTlQFRVq+dx6fIp2/ggl7lMPX7RRKHaa/tkEouTM1iHP1mL9oOgGE1a4y7FqjRhw bLlnEtsWzMpDPywHg03HCacdjtNbnlsDTgziIqc3C8nwnEKybu8Aq8XYnXm7LgwRw6rP dqlUMhdixvoF8DiaoTpa75regR01BJxrDBzl0QZCVn1b3XbErdbdBvIBuv3nr801AXqT VKeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si9568527eda.462.2021.05.19.10.05.47; Wed, 19 May 2021 10:06:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347608AbhERI55 (ORCPT + 99 others); Tue, 18 May 2021 04:57:57 -0400 Received: from mail.loongson.cn ([114.242.206.163]:55208 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241286AbhERI5t (ORCPT ); Tue, 18 May 2021 04:57:49 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxjcgrgaNg88wYAA--.4224S2; Tue, 18 May 2021 16:56:11 +0800 (CST) From: Tiezhu Yang To: Daniel Borkmann , Alexei Starovoitov , Zi Shen Lim , Catalin Marinas , Will Deacon , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Xuefeng Li Subject: [PATCH bpf-next] bpf, arm64: Remove redundant switch case about BPF_DIV and BPF_MOD Date: Tue, 18 May 2021 16:56:10 +0800 Message-Id: <1621328170-17583-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf9Axj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0JU4a0PUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After commit 96a71005bdcb ("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: Tiezhu Yang --- arch/arm64/net/bpf_jit_comp.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 9785026..be873a7 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -485,17 +485,12 @@ 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: + emit(A64_UDIV(is64, dst, dst, src), ctx); + break; 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: - emit(A64_UDIV(is64, tmp, dst, src), ctx); - emit(A64_MSUB(is64, dst, dst, tmp, src), ctx); - break; - } + emit(A64_UDIV(is64, tmp, dst, src), ctx); + emit(A64_MSUB(is64, dst, dst, tmp, src), ctx); break; case BPF_ALU | BPF_LSH | BPF_X: case BPF_ALU64 | BPF_LSH | BPF_X: -- 2.1.0