From nobody Tue Nov 18 06:04:48 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1607922356; cv=none; d=zohomail.com; s=zohoarc; b=EL9Y4Wh92adczcI3tAGSC0alRnIQodn9RmomexJswlQORFJb3vr6/taseyVpYE7ZpU3k+efdaKCZvBIjyuQbMmcie6U5sbX4Z+h1EjWbNf1wSBfc4IGKHKn6ugtXBUdjxWUCOLH+LDKu+kXC/DxSUdNVEYW/3p1UkgkToXgQ9Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607922356; 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=YMZHekwSCN4pb5v2Ola0cc5bqH7pxCOvKcwtiCxi+ho=; b=LhotE0Zxcr3q/dhkdu3wwxil8FcTLHHjt9q0+uneYQp0m/qwyqzWaH2dQKlQ0P3022mZImy+ewb+h8hdSYhcslKw0q5L4eBha7vVOpscfkm7azo8gbS1b/uigspvaOrgJLY9NW9v57pt5k+nT7pyRGSBmwG60ywKTvlK/bWfaRU= ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607922356404612.025661555346; Sun, 13 Dec 2020 21:05:56 -0800 (PST) Received: from localhost ([::1]:58098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kog3W-0005i3-8I for importer@patchew.org; Mon, 14 Dec 2020 00:05:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kofwR-0005CY-0C; Sun, 13 Dec 2020 23:58:35 -0500 Received: from bilbo.ozlabs.org ([203.11.71.1]:57739 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 1kofwP-0004qm-Aa; Sun, 13 Dec 2020 23:58:34 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4CvTfr2vgYz9sVk; Mon, 14 Dec 2020 15:58:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1607921892; bh=3JVdTeH5BbP9PRGmgWSQ2YWdV3mfkz8TZugSjge2suk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czK/Gocie9wejiqSAcp8dhGRTzw0YkUX6mH+tg1bNK5CZDoRrzV+k/esfQQd3wv5m S4kSouq3n6WS6eWSaicUFzcoFIWOEUunVoOGRqg2y2zTETvfOHL48TLT7QWOdn3lJ0 VHtQQfM/2vqVPjk8JaJaww1IsAZm4Db4fIQI7RlE= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 10/30] ppc/translate: Fix unordered f64/f128 comparisons Date: Mon, 14 Dec 2020 15:57:47 +1100 Message-Id: <20201214045807.41003-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201214045807.41003-1-david@gibson.dropbear.id.au> References: <20201214045807.41003-1-david@gibson.dropbear.id.au> 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: pass client-ip=203.11.71.1; 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.249, 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: Giuseppe Musacchio , David Gibson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, groug@kaod.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Giuseppe Musacchio According to the PowerISA v3.1 reference, Table 68 "Actions for xscmpudp - Part 1: Compare Unordered", whenever one of the two operands is a NaN the SO bit is set while the other three bits are cleared. Apply the same change to xscmpuqp. The respective ordered counterparts are unaffected. Signed-off-by: Giuseppe Musacchio Message-Id: <20201112230130.65262-2-thatlemon@gmail.com> Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 32a9a8a0f8..6d3648f5b1 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2479,13 +2479,11 @@ void helper_##op(CPUPPCState *env, uint32_t opcode,= \ if (float64_is_signaling_nan(xa->VsrD(0), &env->fp_status) || \ float64_is_signaling_nan(xb->VsrD(0), &env->fp_status)) { \ vxsnan_flag =3D true; = \ - cc =3D CRF_SO; = \ if (fpscr_ve =3D=3D 0 && ordered) { = \ vxvc_flag =3D true; = \ } \ } else if (float64_is_quiet_nan(xa->VsrD(0), &env->fp_status) || \ float64_is_quiet_nan(xb->VsrD(0), &env->fp_status)) { \ - cc =3D CRF_SO; = \ if (ordered) { \ vxvc_flag =3D true; = \ } \ @@ -2497,12 +2495,19 @@ void helper_##op(CPUPPCState *env, uint32_t opcode,= \ float_invalid_op_vxvc(env, 0, GETPC()); \ } \ \ - if (float64_lt(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) { \ + switch (float64_compare(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) {\ + case float_relation_less: \ cc |=3D CRF_LT; = \ - } else if (!float64_le(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) { \ - cc |=3D CRF_GT; = \ - } else { \ + break; \ + case float_relation_equal: \ cc |=3D CRF_EQ; = \ + break; \ + case float_relation_greater: \ + cc |=3D CRF_GT; = \ + break; \ + case float_relation_unordered: \ + cc |=3D CRF_SO; = \ + break; \ } \ \ env->fpscr &=3D ~FP_FPCC; = \ @@ -2545,12 +2550,19 @@ void helper_##op(CPUPPCState *env, uint32_t opcode,= \ float_invalid_op_vxvc(env, 0, GETPC()); \ } \ \ - if (float128_lt(xa->f128, xb->f128, &env->fp_status)) { \ + switch (float128_compare(xa->f128, xb->f128, &env->fp_status)) { \ + case float_relation_less: \ cc |=3D CRF_LT; \ - } else if (!float128_le(xa->f128, xb->f128, &env->fp_status)) { \ - cc |=3D CRF_GT; \ - } else { \ + break; \ + case float_relation_equal: \ cc |=3D CRF_EQ; \ + break; \ + case float_relation_greater: \ + cc |=3D CRF_GT; \ + break; \ + case float_relation_unordered: \ + cc |=3D CRF_SO; \ + break; \ } \ \ env->fpscr &=3D ~FP_FPCC; \ --=20 2.29.2