From nobody Wed Feb 11 00:58:57 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1593205474; cv=none; d=zohomail.com; s=zohoarc; b=CkvZbEReU6TW9liROqtUuF7JV/1fQHgRIib6fPGwyxNi8AhUtt66oqOdPOFfvVgKsgjEkOTcIXj/+qSC2VQxbktsX33H0ixcrpvjY4+GjOkyD6zG6FjhbKv90z4sxVcYyP/jmATL6THVSF0fCmVyCZPh7HFkI0Hhkz0ZeXkfIPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593205474; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F6032NPOww110wIe6Kist7n2CuLmKJJoSo9mbHHuRI0=; b=Tr2C3o2VeG9qLd0uDCiY7vyKM6BwEy+gbjBn+IXL+v7Dnv9nT3NFNKUfYc+JSuYN5dGXsYMj4lF9GTqo6GITSXNBvHov67Bqn5o4RAQQ5CUVvkz235SHMSotQYceva1mrahG2AYPoO8q8Ch65PhVPyUXr3zauHhU+FpfKyv/E50= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593205474970648.1787615949186; Fri, 26 Jun 2020 14:04:34 -0700 (PDT) Received: from localhost ([::1]:48690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jovWT-0002pX-K9 for importer@patchew.org; Fri, 26 Jun 2020 17:04:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jovVa-0002Md-83; Fri, 26 Jun 2020 17:03:38 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:47820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jovVW-0003p7-Ct; Fri, 26 Jun 2020 17:03:37 -0400 Received: from L-PF1D6DP4-1208.hz.ali.com(mailfrom:zhiwei_liu@c-sky.com fp:SMTPD_---.Ht2835v_1593205407) by smtp.aliyun-inc.com(10.147.42.16); Sat, 27 Jun 2020 05:03:27 +0800 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.07436282|-1; CH=green; DM=|CONTINUE|false|; DS=CONTINUE|ham_alarm|0.123083-0.000330356-0.876587; FP=0|0|0|0|0|-1|-1|-1; HT=e01l07381; MF=zhiwei_liu@c-sky.com; NM=1; PH=DS; RN=9; RT=9; SR=0; TI=SMTPD_---.Ht2835v_1593205407; From: LIU Zhiwei To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH 2/6] target/riscv: NaN-boxing compute, sign-injection and convert instructions. Date: Sat, 27 Jun 2020 04:59:13 +0800 Message-Id: <20200626205917.4545-3-zhiwei_liu@c-sky.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200626205917.4545-1-zhiwei_liu@c-sky.com> References: <20200626205917.4545-1-zhiwei_liu@c-sky.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=121.197.200.217; envelope-from=zhiwei_liu@c-sky.com; helo=smtp2200-217.mail.aliyun.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/26 16:59:26 X-ACL-Warn: Detected OS = Linux 3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001, UNPARSEABLE_RELAY=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, wxy194768@alibaba-inc.com, wenmeng_zhang@c-sky.com, Alistair.Francis@wdc.com, palmer@dabbelt.com, LIU Zhiwei , ianjiang.ict@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" An n-bit foating-point result is written to the n least-significant bits of the destination f register, with all 1s written to the uppermost FLEN - n bits to yield a legal NaN-boxed value Signed-off-by: LIU Zhiwei Reviewed-by: Richard Henderson --- target/riscv/insn_trans/trans_rvd.inc.c | 1 + target/riscv/insn_trans/trans_rvf.inc.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/target/riscv/insn_trans/trans_rvd.inc.c b/target/riscv/insn_tr= ans/trans_rvd.inc.c index ea1044f13b..cd73a326f4 100644 --- a/target/riscv/insn_trans/trans_rvd.inc.c +++ b/target/riscv/insn_trans/trans_rvd.inc.c @@ -230,6 +230,7 @@ static bool trans_fcvt_s_d(DisasContext *ctx, arg_fcvt_= s_d *a) =20 gen_set_rm(ctx, a->rm); gen_helper_fcvt_s_d(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1]); + gen_nanbox_fpr(ctx, a->rd); =20 mark_fs_dirty(ctx); return true; diff --git a/target/riscv/insn_trans/trans_rvf.inc.c b/target/riscv/insn_tr= ans/trans_rvf.inc.c index 0d5ce373cb..a3d74dd83d 100644 --- a/target/riscv/insn_trans/trans_rvf.inc.c +++ b/target/riscv/insn_trans/trans_rvf.inc.c @@ -61,6 +61,7 @@ static bool trans_fmadd_s(DisasContext *ctx, arg_fmadd_s = *a) gen_set_rm(ctx, a->rm); gen_helper_fmadd_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2], cpu_fpr[a->rs3]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -72,6 +73,7 @@ static bool trans_fmsub_s(DisasContext *ctx, arg_fmsub_s = *a) gen_set_rm(ctx, a->rm); gen_helper_fmsub_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2], cpu_fpr[a->rs3]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -83,6 +85,7 @@ static bool trans_fnmsub_s(DisasContext *ctx, arg_fnmsub_= s *a) gen_set_rm(ctx, a->rm); gen_helper_fnmsub_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2], cpu_fpr[a->rs3]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -95,6 +98,7 @@ static bool trans_fnmadd_s(DisasContext *ctx, arg_fnmadd_= s *a) gen_helper_fnmadd_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2], cpu_fpr[a->rs3]); mark_fs_dirty(ctx); + gen_nanbox_fpr(ctx, a->rd); return true; } =20 @@ -106,6 +110,7 @@ static bool trans_fadd_s(DisasContext *ctx, arg_fadd_s = *a) gen_set_rm(ctx, a->rm); gen_helper_fadd_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -118,6 +123,7 @@ static bool trans_fsub_s(DisasContext *ctx, arg_fsub_s = *a) gen_set_rm(ctx, a->rm); gen_helper_fsub_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -130,6 +136,7 @@ static bool trans_fmul_s(DisasContext *ctx, arg_fmul_s = *a) gen_set_rm(ctx, a->rm); gen_helper_fmul_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -142,6 +149,7 @@ static bool trans_fdiv_s(DisasContext *ctx, arg_fdiv_s = *a) gen_set_rm(ctx, a->rm); gen_helper_fdiv_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -153,6 +161,7 @@ static bool trans_fsqrt_s(DisasContext *ctx, arg_fsqrt_= s *a) =20 gen_set_rm(ctx, a->rm); gen_helper_fsqrt_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -167,6 +176,7 @@ static bool trans_fsgnj_s(DisasContext *ctx, arg_fsgnj_= s *a) tcg_gen_deposit_i64(cpu_fpr[a->rd], cpu_fpr[a->rs2], cpu_fpr[a->rs= 1], 0, 31); } + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -183,6 +193,7 @@ static bool trans_fsgnjn_s(DisasContext *ctx, arg_fsgnj= n_s *a) tcg_gen_deposit_i64(cpu_fpr[a->rd], t0, cpu_fpr[a->rs1], 0, 31); tcg_temp_free_i64(t0); } + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -199,6 +210,7 @@ static bool trans_fsgnjx_s(DisasContext *ctx, arg_fsgnj= x_s *a) tcg_gen_xor_i64(cpu_fpr[a->rd], cpu_fpr[a->rs1], t0); tcg_temp_free_i64(t0); } + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -210,6 +222,7 @@ static bool trans_fmin_s(DisasContext *ctx, arg_fmin_s = *a) =20 gen_helper_fmin_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -221,6 +234,7 @@ static bool trans_fmax_s(DisasContext *ctx, arg_fmax_s = *a) =20 gen_helper_fmax_s(cpu_fpr[a->rd], cpu_env, cpu_fpr[a->rs1], cpu_fpr[a->rs2]); + gen_nanbox_fpr(ctx, a->rd); mark_fs_dirty(ctx); return true; } @@ -331,6 +345,7 @@ static bool trans_fcvt_s_w(DisasContext *ctx, arg_fcvt_= s_w *a) =20 gen_set_rm(ctx, a->rm); gen_helper_fcvt_s_w(cpu_fpr[a->rd], cpu_env, t0); + gen_nanbox_fpr(ctx, a->rd); =20 mark_fs_dirty(ctx); tcg_temp_free(t0); @@ -348,6 +363,7 @@ static bool trans_fcvt_s_wu(DisasContext *ctx, arg_fcvt= _s_wu *a) =20 gen_set_rm(ctx, a->rm); gen_helper_fcvt_s_wu(cpu_fpr[a->rd], cpu_env, t0); + gen_nanbox_fpr(ctx, a->rd); =20 mark_fs_dirty(ctx); tcg_temp_free(t0); @@ -369,6 +385,7 @@ static bool trans_fmv_w_x(DisasContext *ctx, arg_fmv_w_= x *a) #else tcg_gen_extu_i32_i64(cpu_fpr[a->rd], t0); #endif + gen_nanbox_fpr(ctx, a->rd); =20 mark_fs_dirty(ctx); tcg_temp_free(t0); @@ -413,6 +430,7 @@ static bool trans_fcvt_s_l(DisasContext *ctx, arg_fcvt_= s_l *a) =20 gen_set_rm(ctx, a->rm); gen_helper_fcvt_s_l(cpu_fpr[a->rd], cpu_env, t0); + gen_nanbox_fpr(ctx, a->rd); =20 mark_fs_dirty(ctx); tcg_temp_free(t0); @@ -429,6 +447,7 @@ static bool trans_fcvt_s_lu(DisasContext *ctx, arg_fcvt= _s_lu *a) =20 gen_set_rm(ctx, a->rm); gen_helper_fcvt_s_lu(cpu_fpr[a->rd], cpu_env, t0); + gen_nanbox_fpr(ctx, a->rd); =20 mark_fs_dirty(ctx); tcg_temp_free(t0); --=20 2.23.0