From nobody Mon May 20 21:31:20 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664263207148661.1974863540295; Tue, 27 Sep 2022 00:20:07 -0700 (PDT) Received: from localhost ([::1]:58614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od4sv-00010T-Up for importer@patchew.org; Tue, 27 Sep 2022 03:20:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1od4Oh-0002za-7R for qemu-devel@nongnu.org; Tue, 27 Sep 2022 02:48:54 -0400 Received: from mail.loongson.cn ([114.242.206.163]:47476 helo=loongson.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od4OY-0003pq-HU for qemu-devel@nongnu.org; Tue, 27 Sep 2022 02:48:45 -0400 Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxPGvGnDJj8aEiAA--.2457S3; Tue, 27 Sep 2022 14:48:38 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, yangxiaojuan@loongson.cn, huqi@loongson.cn, peter.maydell@linaro.org, alex.bennee@linaro.org, maobibo@loongson.cn Subject: [PATCH v2 1/4] target/loongarch: ftint_xxx insns set the result high 32bit 0xffffffff Date: Tue, 27 Sep 2022 14:48:35 +0800 Message-Id: <20220927064838.3570928-2-gaosong@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220927064838.3570928-1-gaosong@loongson.cn> References: <20220927064838.3570928-1-gaosong@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf8DxPGvGnDJj8aEiAA--.2457S3 X-Coremail-Antispam: 1UD129KBjvJXoWxAF4xCFy8uFWfZw15Wr4kWFg_yoWruFy3p3 4rGrW3KrWvqFZ5Za4xJ398GF15Xw4UGa4xtr4DWa4SvFsFyws8urW7t3y7ZrWDWFWrZr45 Ja4jyFy3G3Z0qFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ 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=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=loongson.cn 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_PASS=-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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1664263209411100001 Content-Type: text/plain; charset="utf-8" we just set high 32bit 0xffffffff as the other float instructions do. Signed-off-by: Song Gao --- target/loongarch/fpu_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/loongarch/fpu_helper.c b/target/loongarch/fpu_helper.c index 4b9637210a..1a24667eaf 100644 --- a/target/loongarch/fpu_helper.c +++ b/target/loongarch/fpu_helper.c @@ -518,7 +518,7 @@ uint64_t helper_frint_s(CPULoongArchState *env, uint64_= t fj) { uint64_t fd; =20 - fd =3D (uint64_t)(float32_round_to_int((uint32_t)fj, &env->fp_status)); + fd =3D nanbox_s(float32_round_to_int((uint32_t)fj, &env->fp_status)); update_fcsr0(env, GETPC()); return fd; } @@ -574,7 +574,7 @@ uint64_t helper_ftintrm_w_d(CPULoongArchState *env, uin= t64_t fj) FloatRoundMode old_mode =3D get_float_rounding_mode(&env->fp_status); =20 set_float_rounding_mode(float_round_down, &env->fp_status); - fd =3D (uint64_t)float64_to_int32(fj, &env->fp_status); + fd =3D nanbox_s(float64_to_int32(fj, &env->fp_status)); set_float_rounding_mode(old_mode, &env->fp_status); =20 if (get_float_exception_flags(&env->fp_status) & (float_flag_invalid))= { @@ -592,7 +592,7 @@ uint64_t helper_ftintrm_w_s(CPULoongArchState *env, uin= t64_t fj) FloatRoundMode old_mode =3D get_float_rounding_mode(&env->fp_status); =20 set_float_rounding_mode(float_round_down, &env->fp_status); - fd =3D (uint64_t)float32_to_int32((uint32_t)fj, &env->fp_status); + fd =3D nanbox_s(float32_to_int32((uint32_t)fj, &env->fp_status)); set_float_rounding_mode(old_mode, &env->fp_status); =20 if (get_float_exception_flags(&env->fp_status) & (float_flag_invalid))= { @@ -646,7 +646,7 @@ uint64_t helper_ftintrp_w_d(CPULoongArchState *env, uin= t64_t fj) FloatRoundMode old_mode =3D get_float_rounding_mode(&env->fp_status); =20 set_float_rounding_mode(float_round_up, &env->fp_status); - fd =3D (uint64_t)float64_to_int32(fj, &env->fp_status); + fd =3D nanbox_s(float64_to_int32(fj, &env->fp_status)); set_float_rounding_mode(old_mode, &env->fp_status); =20 if (get_float_exception_flags(&env->fp_status) & (float_flag_invalid))= { @@ -664,7 +664,7 @@ uint64_t helper_ftintrp_w_s(CPULoongArchState *env, uin= t64_t fj) FloatRoundMode old_mode =3D get_float_rounding_mode(&env->fp_status); =20 set_float_rounding_mode(float_round_up, &env->fp_status); - fd =3D (uint64_t)float32_to_int32((uint32_t)fj, &env->fp_status); + fd =3D nanbox_s(float32_to_int32((uint32_t)fj, &env->fp_status)); set_float_rounding_mode(old_mode, &env->fp_status); =20 if (get_float_exception_flags(&env->fp_status) & (float_flag_invalid))= { @@ -715,7 +715,7 @@ uint64_t helper_ftintrz_w_d(CPULoongArchState *env, uin= t64_t fj) uint64_t fd; FloatRoundMode old_mode =3D get_float_rounding_mode(&env->fp_status); =20 - fd =3D (uint64_t)float64_to_int32_round_to_zero(fj, &env->fp_status); + fd =3D nanbox_s(float64_to_int32_round_to_zero(fj, &env->fp_status)); set_float_rounding_mode(old_mode, &env->fp_status); =20 if (get_float_exception_flags(&env->fp_status) & (float_flag_invalid))= { @@ -786,7 +786,7 @@ uint64_t helper_ftintrne_w_d(CPULoongArchState *env, ui= nt64_t fj) FloatRoundMode old_mode =3D get_float_rounding_mode(&env->fp_status); =20 set_float_rounding_mode(float_round_nearest_even, &env->fp_status); - fd =3D (uint64_t)float64_to_int32(fj, &env->fp_status); + fd =3D nanbox_s(float64_to_int32(fj, &env->fp_status)); set_float_rounding_mode(old_mode, &env->fp_status); =20 if (get_float_exception_flags(&env->fp_status) & (float_flag_invalid))= { @@ -848,7 +848,7 @@ uint64_t helper_ftint_w_s(CPULoongArchState *env, uint6= 4_t fj) { uint64_t fd; =20 - fd =3D (uint64_t)float32_to_int32((uint32_t)fj, &env->fp_status); + fd =3D nanbox_s(float32_to_int32((uint32_t)fj, &env->fp_status)); if (get_float_exception_flags(&env->fp_status) & (float_flag_invalid))= { if (float32_is_any_nan((uint32_t)fj)) { fd =3D 0; @@ -862,7 +862,7 @@ uint64_t helper_ftint_w_d(CPULoongArchState *env, uint6= 4_t fj) { uint64_t fd; =20 - fd =3D (uint64_t)float64_to_int32(fj, &env->fp_status); + fd =3D nanbox_s(float64_to_int32(fj, &env->fp_status)); if (get_float_exception_flags(&env->fp_status) & (float_flag_invalid))= { if (float64_is_any_nan(fj)) { fd =3D 0; --=20 2.31.1 From nobody Mon May 20 21:31:20 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664265495952863.7861332869675; Tue, 27 Sep 2022 00:58:15 -0700 (PDT) Received: from localhost ([::1]:54826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od5Tq-00067a-V2 for importer@patchew.org; Tue, 27 Sep 2022 03:58:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1od4Oh-0002zb-7o for qemu-devel@nongnu.org; Tue, 27 Sep 2022 02:48:54 -0400 Received: from mail.loongson.cn ([114.242.206.163]:47472 helo=loongson.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od4OY-0003pr-HW for qemu-devel@nongnu.org; Tue, 27 Sep 2022 02:48:46 -0400 Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxPGvGnDJj8aEiAA--.2457S4; Tue, 27 Sep 2022 14:48:38 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, yangxiaojuan@loongson.cn, huqi@loongson.cn, peter.maydell@linaro.org, alex.bennee@linaro.org, maobibo@loongson.cn Subject: [PATCH v2 2/4] target/loongarch: bstrins.w need set dest register EXT_SIGN Date: Tue, 27 Sep 2022 14:48:36 +0800 Message-Id: <20220927064838.3570928-3-gaosong@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220927064838.3570928-1-gaosong@loongson.cn> References: <20220927064838.3570928-1-gaosong@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf8DxPGvGnDJj8aEiAA--.2457S4 X-Coremail-Antispam: 1UD129KBjvJXoW7CrW8AF1Utr48XrWrtr45Awb_yoW8Xry3pF yUCr1UKr4UXr93Zr97Za1DXFnrJFs5Kw47WF4I9345Ca90qry0gr4Ig39Igryrtwn7XrWv yan5u3yjgw4UJ37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ 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=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=loongson.cn 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_PASS=-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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1664265498036100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Song Gao --- target/loongarch/insn_trans/trans_bit.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/loongarch/insn_trans/trans_bit.c.inc b/target/loongarch= /insn_trans/trans_bit.c.inc index 9337714ec4..33e94878fd 100644 --- a/target/loongarch/insn_trans/trans_bit.c.inc +++ b/target/loongarch/insn_trans/trans_bit.c.inc @@ -37,7 +37,7 @@ static bool gen_rr_ms_ls(DisasContext *ctx, arg_rr_ms_ls = *a, DisasExtend src_ext, DisasExtend dst_ext, void (*func)(TCGv, TCGv, unsigned int, unsigned i= nt)) { - TCGv dest =3D gpr_dst(ctx, a->rd, dst_ext); + TCGv dest =3D gpr_dst(ctx, a->rd, EXT_NONE); TCGv src1 =3D gpr_src(ctx, a->rj, src_ext); =20 if (a->ls > a->ms) { @@ -206,7 +206,7 @@ TRANS(maskeqz, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, g= en_maskeqz) TRANS(masknez, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_masknez) TRANS(bytepick_w, gen_rrr_sa, EXT_NONE, EXT_NONE, gen_bytepick_w) TRANS(bytepick_d, gen_rrr_sa, EXT_NONE, EXT_NONE, gen_bytepick_d) -TRANS(bstrins_w, gen_rr_ms_ls, EXT_NONE, EXT_NONE, gen_bstrins) +TRANS(bstrins_w, gen_rr_ms_ls, EXT_NONE, EXT_SIGN, gen_bstrins) TRANS(bstrins_d, gen_rr_ms_ls, EXT_NONE, EXT_NONE, gen_bstrins) TRANS(bstrpick_w, gen_rr_ms_ls, EXT_NONE, EXT_SIGN, tcg_gen_extract_tl) TRANS(bstrpick_d, gen_rr_ms_ls, EXT_NONE, EXT_NONE, tcg_gen_extract_tl) --=20 2.31.1 From nobody Mon May 20 21:31:20 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664264662722206.46775226339548; Tue, 27 Sep 2022 00:44:22 -0700 (PDT) Received: from localhost ([::1]:58940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od5GO-0007DP-JK for importer@patchew.org; Tue, 27 Sep 2022 03:44:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1od4Oh-0002zZ-6U for qemu-devel@nongnu.org; Tue, 27 Sep 2022 02:48:54 -0400 Received: from mail.loongson.cn ([114.242.206.163]:47478 helo=loongson.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od4OY-0003pt-Gz for qemu-devel@nongnu.org; Tue, 27 Sep 2022 02:48:46 -0400 Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxPGvGnDJj8aEiAA--.2457S5; Tue, 27 Sep 2022 14:48:39 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, yangxiaojuan@loongson.cn, huqi@loongson.cn, peter.maydell@linaro.org, alex.bennee@linaro.org, maobibo@loongson.cn Subject: [PATCH v2 3/4] target/loongarch: Fix fnm{sub/add}_{s/d} set wrong flags Date: Tue, 27 Sep 2022 14:48:37 +0800 Message-Id: <20220927064838.3570928-4-gaosong@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220927064838.3570928-1-gaosong@loongson.cn> References: <20220927064838.3570928-1-gaosong@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf8DxPGvGnDJj8aEiAA--.2457S5 X-Coremail-Antispam: 1UD129KBjvJXoW7uryrKrykCFyrAFyxCFy8Zrb_yoW8WrWfpr 17urnrKr4UJay8ZwnFqasFy3s7Xr4qvw10q3Z7tFyYyr4Yqa9F9ayrKayq9FWrZw10grW8 Aa1qk342kws8WFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ 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=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=loongson.cn 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_PASS=-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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1664264663659100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Song Gao Reviewed-by: Richard Henderson --- target/loongarch/insn_trans/trans_farith.c.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/loongarch/insn_trans/trans_farith.c.inc b/target/loonga= rch/insn_trans/trans_farith.c.inc index 65ad2ffab8..7bb3f41aee 100644 --- a/target/loongarch/insn_trans/trans_farith.c.inc +++ b/target/loongarch/insn_trans/trans_farith.c.inc @@ -97,9 +97,9 @@ TRANS(fmadd_s, gen_muladd, gen_helper_fmuladd_s, 0) TRANS(fmadd_d, gen_muladd, gen_helper_fmuladd_d, 0) TRANS(fmsub_s, gen_muladd, gen_helper_fmuladd_s, float_muladd_negate_c) TRANS(fmsub_d, gen_muladd, gen_helper_fmuladd_d, float_muladd_negate_c) -TRANS(fnmadd_s, gen_muladd, gen_helper_fmuladd_s, - float_muladd_negate_product | float_muladd_negate_c) -TRANS(fnmadd_d, gen_muladd, gen_helper_fmuladd_d, - float_muladd_negate_product | float_muladd_negate_c) -TRANS(fnmsub_s, gen_muladd, gen_helper_fmuladd_s, float_muladd_negate_prod= uct) -TRANS(fnmsub_d, gen_muladd, gen_helper_fmuladd_d, float_muladd_negate_prod= uct) +TRANS(fnmadd_s, gen_muladd, gen_helper_fmuladd_s, float_muladd_negate_resu= lt) +TRANS(fnmadd_d, gen_muladd, gen_helper_fmuladd_d, float_muladd_negate_resu= lt) +TRANS(fnmsub_s, gen_muladd, gen_helper_fmuladd_s, + float_muladd_negate_c | float_muladd_negate_result) +TRANS(fnmsub_d, gen_muladd, gen_helper_fmuladd_d, + float_muladd_negate_c | float_muladd_negate_result) --=20 2.31.1 From nobody Mon May 20 21:31:20 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664265299964651.3348689786493; Tue, 27 Sep 2022 00:54:59 -0700 (PDT) Received: from localhost ([::1]:59112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od5Qg-0001qI-B9 for importer@patchew.org; Tue, 27 Sep 2022 03:54:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1od4Oh-0002zc-7u for qemu-devel@nongnu.org; Tue, 27 Sep 2022 02:48:54 -0400 Received: from mail.loongson.cn ([114.242.206.163]:47482 helo=loongson.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od4Oa-0003q6-By for qemu-devel@nongnu.org; Tue, 27 Sep 2022 02:48:48 -0400 Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxPGvGnDJj8aEiAA--.2457S6; Tue, 27 Sep 2022 14:48:39 +0800 (CST) From: Song Gao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, yangxiaojuan@loongson.cn, huqi@loongson.cn, peter.maydell@linaro.org, alex.bennee@linaro.org, maobibo@loongson.cn Subject: [PATCH v2 4/4] target/loongarch: flogb_{s/d} add set float_flag_divbyzero Date: Tue, 27 Sep 2022 14:48:38 +0800 Message-Id: <20220927064838.3570928-5-gaosong@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220927064838.3570928-1-gaosong@loongson.cn> References: <20220927064838.3570928-1-gaosong@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf8DxPGvGnDJj8aEiAA--.2457S6 X-Coremail-Antispam: 1UD129KBjvJXoW7Cw4fuFykCr1kKrWxAF45GFg_yoW8WrW5pr WfuFW3trW8XFZ7Za93A39Yqr45X3y8GrWIvrnav3y5tr4UXr4DCr4fKasFgFy5XryUGr1Y qFsYyrW7GF45X37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_UUUUUUUUU== X-CM-SenderInfo: 5jdr20tqj6z05rqj20fqof0/ 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=114.242.206.163; envelope-from=gaosong@loongson.cn; helo=loongson.cn 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_PASS=-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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1664265301047100001 Content-Type: text/plain; charset="utf-8" if fj =3D=3D0 or fj =3D=3D INT32_MIN/INT64_MIN, LoongArch host set fcsr cau= se exception FP_DIV0, So we need set exception flags float_flagdivbyzero if fj =3D=3D0. Signed-off-by: Song Gao --- target/loongarch/fpu_helper.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/loongarch/fpu_helper.c b/target/loongarch/fpu_helper.c index 1a24667eaf..d40e608bb4 100644 --- a/target/loongarch/fpu_helper.c +++ b/target/loongarch/fpu_helper.c @@ -322,6 +322,13 @@ uint64_t helper_flogb_s(CPULoongArchState *env, uint64= _t fj) fp =3D float32_log2((uint32_t)fj, status); fd =3D nanbox_s(float32_round_to_int(fp, status)); set_float_rounding_mode(old_mode, status); + /* + * LoongArch host if fj =3D=3D 0 or INT32_MIN , set the fcsr cause FP_= DIV0 + * so we need set exception flags float_flag_divbyzero. + */ + if (((uint32_t)fj =3D=3D 0) | ((uint32_t)fj =3D=3D INT32_MIN)) { + set_float_exception_flags(float_flag_divbyzero, status); + } update_fcsr0_mask(env, GETPC(), float_flag_inexact); return fd; } @@ -336,6 +343,13 @@ uint64_t helper_flogb_d(CPULoongArchState *env, uint64= _t fj) fd =3D float64_log2(fj, status); fd =3D float64_round_to_int(fd, status); set_float_rounding_mode(old_mode, status); + /* + * LoongArch host if fj =3D=3D 0 or INT64_MIN , set the fcsr cause FP_= DIV0 + * so we need set exception flags float_flag_divbyzero. + */ + if ((fj =3D=3D 0) | (fj =3D=3D INT64_MIN)) { + set_float_exception_flags(float_flag_divbyzero, status); + } update_fcsr0_mask(env, GETPC(), float_flag_inexact); return fd; } --=20 2.31.1