From nobody Thu May 2 07:17:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=mail.uni-paderborn.de Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552659424578307.46396503741494; Fri, 15 Mar 2019 07:17:04 -0700 (PDT) Received: from localhost ([127.0.0.1]:55913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4ndp-0004kY-6f for importer@patchew.org; Fri, 15 Mar 2019 10:16:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4nSq-0002zU-VP for qemu-devel@nongnu.org; Fri, 15 Mar 2019 10:05:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4nFn-0000uV-9l for qemu-devel@nongnu.org; Fri, 15 Mar 2019 09:52:08 -0400 Received: from mail.uni-paderborn.de ([131.234.142.9]:43052) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4nFj-0000jN-RI; Fri, 15 Mar 2019 09:52:04 -0400 Received: from pova.uni-paderborn.de ([131.234.189.23] helo=localhost.localdomain) by mail.uni-paderborn.de with esmtp (Exim 4.89 nylar) id 1h4nFR-0003FZ-OO; Fri, 15 Mar 2019 14:51:45 +0100 Received: from mail.uni-paderborn.de by pova with queue id 3209400-2; Fri, 15 Mar 2019 13:51:44 GMT X-Envelope-From: From: Bastian Koppelmann To: Alistair.Francis@wdc.com, sagark@eecs.berkeley.edu, palmer@sifive.com, kbastian@mail.uni-paderborn.de Date: Fri, 15 Mar 2019 14:51:40 +0100 Message-Id: <20190315135140.10507-1-kbastian@mail.uni-paderborn.de> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-PMX-Version: 6.4.6.2792898, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2019.3.15.134216, AntiVirus-Engine: 5.58.0, AntiVirus-Data: 2019.2.22.5580002 X-IMT-Spam-Score: 0.0 () X-IMT-Authenticated-Sender: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 131.234.142.9 Subject: [Qemu-devel] [PATCH] target/riscv: Fix manually parsed 16 bit insn X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" during the refactor to decodetree we removed the manual decoding that is necessary for c.jal/c.addiw and removed the translation of c.flw/c.ld and c.fsw/c.sd. This reintroduces the manual parsing and the omited implementation. Signed-off-by: Bastian Koppelmann Reviewed-by: Alistair Francis Tested-by: Alistair Francis --- target/riscv/insn_trans/trans_rvc.inc.c | 30 ++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvc.inc.c b/target/riscv/insn_tr= ans/trans_rvc.inc.c index bcdf64d3b7..5819f53f90 100644 --- a/target/riscv/insn_trans/trans_rvc.inc.c +++ b/target/riscv/insn_trans/trans_rvc.inc.c @@ -44,10 +44,19 @@ static bool trans_c_flw_ld(DisasContext *ctx, arg_c_flw= _ld *a) { #ifdef TARGET_RISCV32 /* C.FLW ( RV32FC-only ) */ - return false; + REQUIRE_FPU; + REQUIRE_EXT(ctx, RVF); + + arg_c_lw tmp; + decode_insn16_extract_cl_w(&tmp, ctx->opcode); + arg_flw arg =3D { .rd =3D tmp.rd, .rs1 =3D tmp.rs1, .imm =3D tmp.uimm = }; + return trans_flw(ctx, &arg); #else /* C.LD ( RV64C/RV128C-only ) */ - return false; + arg_c_fld tmp; + decode_insn16_extract_cl_d(&tmp, ctx->opcode); + arg_ld arg =3D { .rd =3D tmp.rd, .rs1 =3D tmp.rs1, .imm =3D tmp.uimm }; + return trans_ld(ctx, &arg); #endif } =20 @@ -67,10 +76,19 @@ static bool trans_c_fsw_sd(DisasContext *ctx, arg_c_fsw= _sd *a) { #ifdef TARGET_RISCV32 /* C.FSW ( RV32FC-only ) */ - return false; + REQUIRE_FPU; + REQUIRE_EXT(ctx, RVF); + + arg_c_sw tmp; + decode_insn16_extract_cs_w(&tmp, ctx->opcode); + arg_fsw arg =3D { .rs1 =3D tmp.rs1, .rs2 =3D tmp.rs2, .imm =3D tmp.uim= m }; + return trans_fsw(ctx, &arg); #else /* C.SD ( RV64C/RV128C-only ) */ - return false; + arg_c_fsd tmp; + decode_insn16_extract_cs_d(&tmp, ctx->opcode); + arg_sd arg =3D { .rs1 =3D tmp.rs1, .rs2 =3D tmp.rs2, .imm =3D tmp.uimm= }; + return trans_sd(ctx, &arg); #endif } =20 @@ -88,7 +106,9 @@ static bool trans_c_jal_addiw(DisasContext *ctx, arg_c_j= al_addiw *a) { #ifdef TARGET_RISCV32 /* C.JAL */ - arg_jal arg =3D { .rd =3D 1, .imm =3D a->imm }; + arg_c_j tmp; + decode_insn16_extract_cj(&tmp, ctx->opcode); + arg_jal arg =3D { .rd =3D 1, .imm =3D tmp.imm }; return trans_jal(ctx, &arg); #else /* C.ADDIW */ --=20 2.21.0