From patchwork Tue Aug 9 02:52:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 12939307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB7E3C25B0D for ; Tue, 9 Aug 2022 02:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231574AbiHICxR (ORCPT ); Mon, 8 Aug 2022 22:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232010AbiHICxN (ORCPT ); Mon, 8 Aug 2022 22:53:13 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 157D11E3E6 for ; Mon, 8 Aug 2022 19:53:11 -0700 (PDT) Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxvyMNzPFiwLAKAA--.4926S3; Tue, 09 Aug 2022 10:53:03 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: bpf@vger.kernel.org, loongarch@lists.linux.dev Subject: [RFC PATCH 1/5] LoongArch: Fix some instruction formats Date: Tue, 9 Aug 2022 10:52:56 +0800 Message-Id: <1660013580-19053-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1660013580-19053-1-git-send-email-yangtiezhu@loongson.cn> References: <1660013580-19053-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9DxvyMNzPFiwLAKAA--.4926S3 X-Coremail-Antispam: 1UD129KBjvJXoW7urW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UUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-State: RFC struct reg2i12_format is used to generate the instruction lu52id in larch_insn_gen_lu52id(), according to the instruction format of lu52id in LoongArch Reference Manual [1], the type of field "immediate" should be "signed int" rather than "unsigned int". There are similar problems in the other structs reg0i26_format, reg1i20_format, reg1i21_format and reg2i16_format, fix them. [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_lu12i_w_lu32i_d_lu52i_d Fixes: b738c106f735 ("LoongArch: Add other common headers") Signed-off-by: Tiezhu Yang --- arch/loongarch/include/asm/inst.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/loongarch/include/asm/inst.h b/arch/loongarch/include/asm/inst.h index 7b07cbb..ff51481 100644 --- a/arch/loongarch/include/asm/inst.h +++ b/arch/loongarch/include/asm/inst.h @@ -53,35 +53,35 @@ enum reg2i16_op { }; struct reg0i26_format { - unsigned int immediate_h : 10; - unsigned int immediate_l : 16; + signed int immediate_h : 10; + signed int immediate_l : 16; unsigned int opcode : 6; }; struct reg1i20_format { unsigned int rd : 5; - unsigned int immediate : 20; + signed int immediate : 20; unsigned int opcode : 7; }; struct reg1i21_format { - unsigned int immediate_h : 5; + signed int immediate_h : 5; unsigned int rj : 5; - unsigned int immediate_l : 16; + signed int immediate_l : 16; unsigned int opcode : 6; }; struct reg2i12_format { unsigned int rd : 5; unsigned int rj : 5; - unsigned int immediate : 12; + signed int immediate : 12; unsigned int opcode : 10; }; struct reg2i16_format { unsigned int rd : 5; unsigned int rj : 5; - unsigned int immediate : 16; + signed int immediate : 16; unsigned int opcode : 6; };