From patchwork Wed Feb 13 15:53:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 10810257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CE34139A for ; Wed, 13 Feb 2019 16:03:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BAB52DBFC for ; Wed, 13 Feb 2019 16:03:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 600C72DC24; Wed, 13 Feb 2019 16:03:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7E812DBFC for ; Wed, 13 Feb 2019 16:03:33 +0000 (UTC) Received: from localhost ([127.0.0.1]:59177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtx0W-00073Y-Vo for patchwork-qemu-devel@patchwork.kernel.org; Wed, 13 Feb 2019 11:03:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtwtJ-0001t0-CW for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:56:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtwtH-0002nU-D7 for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:56:05 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:32963) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtwtF-0001D9-99 for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:56:01 -0500 Received: by mail-pl1-x62a.google.com with SMTP id y10so1359790plp.0 for ; Wed, 13 Feb 2019 07:54:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=keMqI9a4hazxI6Sn+pZrrOA4+U2MOLh3728gyXkiHuY=; b=em3cQ/iQFXda2aF2mv+Zo5+tKkTn4ztJ/eKaZhtyUDWS7k3pb1On7afg0btTlS2O3O hjRmryX01QUP1aI/KmUDuINpXi7hMpi5CcWzIOszdZYMzK+6kORqIk+hrAXOyLCRs+tB D7b33JzW2EgVWcJjPSeye9A2Ea5UlAv7j1XhJW1+IqckBVAOPzbOVLQR9I8UDN23kIjJ 3pY+/3b3DqOAUWNa8aowtUOZScD0pHPUVM56VkZSYQW6IdJpxcJBDzh0W0102KFu7YlI 8CxNznynj7mvwHdGTaxCXqXAjvKhINs4/ap0Pc8FN/EB/pKEgPt/UxJLQBlI3HUc5a7h solA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=keMqI9a4hazxI6Sn+pZrrOA4+U2MOLh3728gyXkiHuY=; b=pbOxHftyD9dJGSiVSNs4RVugk4y6TKuEIU99NJ30IwlIc04SJogzgvR3sierFG0MCB JpXJNEThTO1n5ChgRiU0mzFB4Art8p4WGAKPEJFCkAwcpx/AHe08/b4M4BcQbazgPUJ8 tAPIN4nPucuYGr6Oj5G7EeCBqffDs+5XA7WM+REJ15JLYag76aALqEgwcAMIzhPnnVp5 HSReR90P7OkozGzG72jtXUT4LMjcfqvVSmhecH+9ReITFoA4xlm+jfOT+xaIAsUABITV 1SNIUyKcnef7qKhPf7ODNvQxqC2hCT/8u64CWq3qBLJ4y5kwKXMvD7zXVRPz0tROPNKa 240w== X-Gm-Message-State: AHQUAuYY9QaA45TizFDH7AbvOWqVdlodLWb1WJMHnH8DRTUV/VxcrbDb 9TKr1PdBMhamADsrEs+d2XwDOMxhI4M= X-Google-Smtp-Source: AHgI3IbT7jgy0o3NVMEH1dwfee1AQLqGmMUeKNLyBogzmP1c7Zhsy1Pn8waqzy0f2BPp+gGqXX/g3Q== X-Received: by 2002:a17:902:bd82:: with SMTP id q2mr1205026pls.156.1550073297818; Wed, 13 Feb 2019 07:54:57 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id c18sm15684353pfc.63.2019.02.13.07.54.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 07:54:57 -0800 (PST) Date: Wed, 13 Feb 2019 07:53:52 -0800 Message-Id: <20190213155414.22285-14-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20190213155414.22285-1-palmer@sifive.com> References: <20190213155414.22285-1-palmer@sifive.com> From: Palmer Dabbelt To: qemu-riscv@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62a Subject: [Qemu-devel] [PATCH v7 13/35] target/riscv: Convert RV64F insns to decodetree 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: Bastian Koppelmann , Peer Adelt , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Bastian Koppelmann Acked-by: Alistair Francis Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32-64.decode | 6 +++ target/riscv/insn_trans/trans_rvf.inc.c | 58 ++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/target/riscv/insn32-64.decode b/target/riscv/insn32-64.decode index 0bee95c9840d..6319f872ac1d 100644 --- a/target/riscv/insn32-64.decode +++ b/target/riscv/insn32-64.decode @@ -56,3 +56,9 @@ amomin_d 10000 . . ..... ..... 011 ..... 0101111 @atom_st amomax_d 10100 . . ..... ..... 011 ..... 0101111 @atom_st amominu_d 11000 . . ..... ..... 011 ..... 0101111 @atom_st amomaxu_d 11100 . . ..... ..... 011 ..... 0101111 @atom_st + +# *** RV64F Standard Extension (in addition to RV32F) *** +fcvt_l_s 1100000 00010 ..... ... ..... 1010011 @r2_rm +fcvt_lu_s 1100000 00011 ..... ... ..... 1010011 @r2_rm +fcvt_s_l 1101000 00010 ..... ... ..... 1010011 @r2_rm +fcvt_s_lu 1101000 00011 ..... ... ..... 1010011 @r2_rm diff --git a/target/riscv/insn_trans/trans_rvf.inc.c b/target/riscv/insn_trans/trans_rvf.inc.c index bce4da0e79e9..3415051ff1c1 100644 --- a/target/riscv/insn_trans/trans_rvf.inc.c +++ b/target/riscv/insn_trans/trans_rvf.inc.c @@ -19,7 +19,7 @@ */ #define REQUIRE_FPU do {\ - if (!(ctx->flags & TB_FLAGS_FP_ENABLE)) \ + if (ctx->mstatus_fs == 0) \ return false; \ } while (0) @@ -351,3 +351,59 @@ static bool trans_fmv_w_x(DisasContext *ctx, arg_fmv_w_x *a) return true; } + +#ifdef TARGET_RISCV64 +static bool trans_fcvt_l_s(DisasContext *ctx, arg_fcvt_l_s *a) +{ + REQUIRE_FPU; + + TCGv t0 = tcg_temp_new(); + gen_set_rm(ctx, a->rm); + gen_helper_fcvt_l_s(t0, cpu_env, cpu_fpr[a->rs1]); + gen_set_gpr(a->rd, t0); + tcg_temp_free(t0); + return true; +} + +static bool trans_fcvt_lu_s(DisasContext *ctx, arg_fcvt_lu_s *a) +{ + REQUIRE_FPU; + + TCGv t0 = tcg_temp_new(); + gen_set_rm(ctx, a->rm); + gen_helper_fcvt_lu_s(t0, cpu_env, cpu_fpr[a->rs1]); + gen_set_gpr(a->rd, t0); + tcg_temp_free(t0); + return true; +} + +static bool trans_fcvt_s_l(DisasContext *ctx, arg_fcvt_s_l *a) +{ + REQUIRE_FPU; + + TCGv t0 = tcg_temp_new(); + gen_get_gpr(t0, a->rs1); + + gen_set_rm(ctx, a->rm); + gen_helper_fcvt_s_l(cpu_fpr[a->rd], cpu_env, t0); + + mark_fs_dirty(ctx); + tcg_temp_free(t0); + return true; +} + +static bool trans_fcvt_s_lu(DisasContext *ctx, arg_fcvt_s_lu *a) +{ + REQUIRE_FPU; + + TCGv t0 = tcg_temp_new(); + gen_get_gpr(t0, a->rs1); + + gen_set_rm(ctx, a->rm); + gen_helper_fcvt_s_lu(cpu_fpr[a->rd], cpu_env, t0); + + mark_fs_dirty(ctx); + tcg_temp_free(t0); + return true; +} +#endif