From nobody Wed Feb 11 02:14:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=univ-grenoble-alpes.fr Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1638109166231186.05762445953053; Sun, 28 Nov 2021 06:19:26 -0800 (PST) Received: from localhost ([::1]:39058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrL1Y-0004Cc-P9 for importer@patchew.org; Sun, 28 Nov 2021 09:19:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrKhC-0006HU-Dj; Sun, 28 Nov 2021 08:58:22 -0500 Received: from zm-mta-out-3.u-ga.fr ([152.77.200.56]:34528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrKh5-0004fn-TA; Sun, 28 Nov 2021 08:58:22 -0500 Received: from mailhost.u-ga.fr (mailhost1.u-ga.fr [152.77.1.10]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id 2E669402A3; Sun, 28 Nov 2021 14:57:49 +0100 (CET) Received: from smtps.univ-grenoble-alpes.fr (smtps3.u-ga.fr [195.83.24.62]) by mailhost.u-ga.fr (Postfix) with ESMTP id 1A38860067; Sun, 28 Nov 2021 14:57:49 +0100 (CET) Received: from palmier.tima.u-ga.fr (35.201.90.79.rev.sfr.net [79.90.201.35]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: petrotf@univ-grenoble-alpes.fr) by smtps.univ-grenoble-alpes.fr (Postfix) with ESMTPSA id E178C4006D; Sun, 28 Nov 2021 14:57:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=univ-grenoble-alpes.fr; s=2020; t=1638107869; bh=/MG8k/oZx0X3FysG77S24ipnJB9/Bz0zvVsRvmYxPnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AtqsA51xI9Wmfam7+ZI8QaEDSMyVXb3yi+AGXvqMRhXUKaIHAfgp32a8lTBaxUEBf 19VOqma6gjrKxiVV8IHriDktCb2Tem83DabvLWF7Xgh6Gl0y9EJzzaHfux4i6aGQ/F SEczrSd2DXL5LYw7P9L2HYKhwXx2p0N2CAYjqGRTi6HP2ZH21Z068Sbi91iHKi0m+m 3pk09vY0jggsJSbiPZW7M+/3nq1t5tBUDIkdqgkiXOPA15tMrhb+9qoIftAu/Bph9+ vif6A1JyiLmQVwN9ilgMhIj4YqpYBfiBFdNKVeDKNb6BjTMY5LHa4k+dVlMntxWC/l 9AdfxqWMoI9mQ== From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9trot?= To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v6 11/18] target/riscv: support for 128-bit U-type instructions Date: Sun, 28 Nov 2021 14:57:12 +0100 Message-Id: <20211128135719.50444-12-frederic.petrot@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211128135719.50444-1-frederic.petrot@univ-grenoble-alpes.fr> References: <20211128135719.50444-1-frederic.petrot@univ-grenoble-alpes.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Greylist: Whitelist-UGA SMTP Authentifie (petrotf@univ-grenoble-alpes.fr) via submission-587 ACL (41) X-Greylist: Whitelist-UGA MAILHOST (SMTP non authentifie) depuis 195.83.24.62 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=152.77.200.56; envelope-from=frederic.petrot@univ-grenoble-alpes.fr; helo=zm-mta-out-3.u-ga.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bin.meng@windriver.com, richard.henderson@linaro.org, alistair.francis@wdc.com, fabien.portas@grenoble-inp.org, palmer@dabbelt.com, =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9trot?= , philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1638109168421100001 Adding the 128-bit version of lui and auipc, and introducing to that end a "set register with immediat" function to handle extension on 128 bits. Signed-off-by: Fr=C3=A9d=C3=A9ric P=C3=A9trot Co-authored-by: Fabien Portas Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis --- target/riscv/translate.c | 21 +++++++++++++++++++++ target/riscv/insn_trans/trans_rvi.c.inc | 8 ++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 4790dc0cb4..0b87312dda 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -289,6 +289,27 @@ static void gen_set_gpr(DisasContext *ctx, int reg_num= , TCGv t) } } =20 +static void gen_set_gpri(DisasContext *ctx, int reg_num, target_long imm) +{ + if (reg_num !=3D 0) { + switch (get_ol(ctx)) { + case MXL_RV32: + tcg_gen_movi_tl(cpu_gpr[reg_num], (int32_t)imm); + break; + case MXL_RV64: + case MXL_RV128: + tcg_gen_movi_tl(cpu_gpr[reg_num], imm); + break; + default: + g_assert_not_reached(); + } + + if (get_xl_max(ctx) =3D=3D MXL_RV128) { + tcg_gen_movi_tl(cpu_gprh[reg_num], -(imm < 0)); + } + } +} + static void gen_set_gpr128(DisasContext *ctx, int reg_num, TCGv rl, TCGv r= h) { assert(get_ol(ctx) =3D=3D MXL_RV128); diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_tr= ans/trans_rvi.c.inc index e572976e88..6113acc669 100644 --- a/target/riscv/insn_trans/trans_rvi.c.inc +++ b/target/riscv/insn_trans/trans_rvi.c.inc @@ -26,14 +26,14 @@ static bool trans_illegal(DisasContext *ctx, arg_empty = *a) =20 static bool trans_c64_illegal(DisasContext *ctx, arg_empty *a) { - REQUIRE_64BIT(ctx); - return trans_illegal(ctx, a); + REQUIRE_64_OR_128BIT(ctx); + return trans_illegal(ctx, a); } =20 static bool trans_lui(DisasContext *ctx, arg_lui *a) { if (a->rd !=3D 0) { - tcg_gen_movi_tl(cpu_gpr[a->rd], a->imm); + gen_set_gpri(ctx, a->rd, a->imm); } return true; } @@ -41,7 +41,7 @@ static bool trans_lui(DisasContext *ctx, arg_lui *a) static bool trans_auipc(DisasContext *ctx, arg_auipc *a) { if (a->rd !=3D 0) { - tcg_gen_movi_tl(cpu_gpr[a->rd], a->imm + ctx->base.pc_next); + gen_set_gpri(ctx, a->rd, a->imm + ctx->base.pc_next); } return true; } --=20 2.34.0