From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51357C4361B for ; Fri, 11 Dec 2020 04:27:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EEA3623ED2 for ; Fri, 11 Dec 2020 04:27:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEA3623ED2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kna1Q-00020b-TR for qemu-devel@archiver.kernel.org; Thu, 10 Dec 2020 23:27:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knZq9-0005da-S4; Thu, 10 Dec 2020 23:15:33 -0500 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:33781 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knZq6-0000kG-Qf; Thu, 10 Dec 2020 23:15:33 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4Cscrb6qccz9sWw; Fri, 11 Dec 2020 15:15:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1607660111; bh=O7Iod8ha/UKbiX0jn4dxF+eTwrAB9Z9FYv3hOWjC50A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DYpyzEWqnAv5HO8+Jda/h3PLyW0r5Zc4hWk3OlB4/eES93iQfU6RskC51KzRrjnbP 9w2Mh/neYzpOxZD9wbJZyqa8G9aDQ0rfQC1Sb9x51lnz1qLCvNRc+wLwjkA4PWP4Po jKPsZIJrBO8ebSTZW1mzXbON1pjb1wmFXPxbxFxg= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 12/30] ppc/translate: Delay NaN checking after comparison Date: Fri, 11 Dec 2020 15:14:49 +1100 Message-Id: <20201211041507.425378-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201211041507.425378-1-david@gibson.dropbear.id.au> References: <20201211041507.425378-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2401:3900:2:1::2; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no 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: LemonBoy , Richard Henderson , qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: LemonBoy Since we always perform a comparison between the two operands avoid checking for NaN unless the result states they're unordered. Suggested-by: Richard Henderson Signed-off-by: Giuseppe Musacchio Reviewed-by: Richard Henderson Message-Id: <20201112230130.65262-4-thatlemon@gmail.com> Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 80 +++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 34f5bc1f3c..f5a4be595a 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2475,25 +2475,6 @@ static inline void do_scalar_cmp(CPUPPCState *env, ppc_vsr_t *xa, ppc_vsr_t *xb, helper_reset_fpstatus(env); - if (float64_is_signaling_nan(xa->VsrD(0), &env->fp_status) || - float64_is_signaling_nan(xb->VsrD(0), &env->fp_status)) { - vxsnan_flag = true; - if (fpscr_ve == 0 && ordered) { - vxvc_flag = true; - } - } else if (float64_is_quiet_nan(xa->VsrD(0), &env->fp_status) || - float64_is_quiet_nan(xb->VsrD(0), &env->fp_status)) { - if (ordered) { - vxvc_flag = true; - } - } - if (vxsnan_flag) { - float_invalid_op_vxsnan(env, GETPC()); - } - if (vxvc_flag) { - float_invalid_op_vxvc(env, 0, GETPC()); - } - switch (float64_compare(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) { case float_relation_less: cc = CRF_LT; @@ -2506,6 +2487,27 @@ static inline void do_scalar_cmp(CPUPPCState *env, ppc_vsr_t *xa, ppc_vsr_t *xb, break; case float_relation_unordered: cc = CRF_SO; + + if (float64_is_signaling_nan(xa->VsrD(0), &env->fp_status) || + float64_is_signaling_nan(xb->VsrD(0), &env->fp_status)) { + vxsnan_flag = true; + if (fpscr_ve == 0 && ordered) { + vxvc_flag = true; + } + } else if (float64_is_quiet_nan(xa->VsrD(0), &env->fp_status) || + float64_is_quiet_nan(xb->VsrD(0), &env->fp_status)) { + if (ordered) { + vxvc_flag = true; + } + } + + if (vxsnan_flag) { + float_invalid_op_vxsnan(env, GETPC()); + } + if (vxvc_flag) { + float_invalid_op_vxvc(env, 0, GETPC()); + } + break; default: g_assert_not_reached(); @@ -2538,25 +2540,6 @@ static inline void do_scalar_cmpq(CPUPPCState *env, ppc_vsr_t *xa, helper_reset_fpstatus(env); - if (float128_is_signaling_nan(xa->f128, &env->fp_status) || - float128_is_signaling_nan(xb->f128, &env->fp_status)) { - vxsnan_flag = true; - if (fpscr_ve == 0 && ordered) { - vxvc_flag = true; - } - } else if (float128_is_quiet_nan(xa->f128, &env->fp_status) || - float128_is_quiet_nan(xb->f128, &env->fp_status)) { - if (ordered) { - vxvc_flag = true; - } - } - if (vxsnan_flag) { - float_invalid_op_vxsnan(env, GETPC()); - } - if (vxvc_flag) { - float_invalid_op_vxvc(env, 0, GETPC()); - } - switch (float128_compare(xa->f128, xb->f128, &env->fp_status)) { case float_relation_less: cc = CRF_LT; @@ -2569,6 +2552,27 @@ static inline void do_scalar_cmpq(CPUPPCState *env, ppc_vsr_t *xa, break; case float_relation_unordered: cc = CRF_SO; + + if (float128_is_signaling_nan(xa->f128, &env->fp_status) || + float128_is_signaling_nan(xb->f128, &env->fp_status)) { + vxsnan_flag = true; + if (fpscr_ve == 0 && ordered) { + vxvc_flag = true; + } + } else if (float128_is_quiet_nan(xa->f128, &env->fp_status) || + float128_is_quiet_nan(xb->f128, &env->fp_status)) { + if (ordered) { + vxvc_flag = true; + } + } + + if (vxsnan_flag) { + float_invalid_op_vxsnan(env, GETPC()); + } + if (vxvc_flag) { + float_invalid_op_vxvc(env, 0, GETPC()); + } + break; default: g_assert_not_reached(); -- 2.29.2