From patchwork Fri Nov 19 16:04:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519262 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp2739094imj; Fri, 19 Nov 2021 08:22:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJziUDWKNFrDe5m/P/KNXy0tbnSkF9lnvhP9oqa5jZjQTLhyrwTOBmqSnq3oTyonpkU18xKt X-Received: by 2002:ac8:5991:: with SMTP id e17mr7515741qte.344.1637338947916; Fri, 19 Nov 2021 08:22:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637338947; cv=none; d=google.com; s=arc-20160816; b=Ga6UrOelEqall0XfwaeYW0ZMKRJ9Z0YbnvZLyAYqyragrMfqXf0lXSzSjws3xzBa9a 2hsgrLzPVDx9uPNiLOlNDCIqfBjew/QrBuE3hxmKwCEPSUasDfhAM2anWHYpXLYynVgf fF0HpKSZd13spw5r6oxxAHwr07R0mZl3ABlRsgbSvLJuFk1iTPH2fubxbO39DyqfuXUs vHMiULcpIomrfb9D6IqivU0rYsNtJ1kwJ5UihvhwVkVEq1hQ4IENhDPgI7avyP3tuSBJ ytyGV/Pot8pjFexM03VJlsK9cUkEnSsra1mSqoMYdanCnuaqxrk1MRClwqOw1z656cG3 5KTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wryGVpZb06m25zx5Ni2rv3/SjWRLXHAAknrwCXzqExE=; b=VqiuViwNEdFn0sPKOFU8yew20qgjy7aun3hy5fGA/z+emLF52Y5qEt3b285YGx5CAh 5GOARoNmbD1FEM7EPpDT98//Eoy3KUdhYcwZ3SngLVxKZFj0pBhO2KD3sJY1EXXUfQix xEMI+iR3JiNukDI7+ciSyC8qP0g/MML9mbJ/OLsQ03/ZOZcx3lMnUj120qDetkg6jE09 /JVtJiNgETtwpRx1szMyCL/EA2k5z12/9DnqCzi6XqyfdN/KTYYwf+XK9XOeoOlLTZNg OUmOyuWuxrwtcdIyLr4EKN78OppfLX1jgCRk4Ez5q/HZsHdqBo3TvQ7yWit3O+KZ/vSK sayw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=T7y43h8y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b28si567935vsh.382.2021.11.19.08.22.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Nov 2021 08:22:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=T7y43h8y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo6eh-00013R-Ce for patch@linaro.org; Fri, 19 Nov 2021 11:22:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo6Of-0005c1-CZ for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:05:53 -0500 Received: from [2a00:1450:4864:20::334] (port=50927 helo=mail-wm1-x334.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mo6Od-0004Iz-L1 for qemu-devel@nongnu.org; Fri, 19 Nov 2021 11:05:53 -0500 Received: by mail-wm1-x334.google.com with SMTP id 133so9006387wme.0 for ; Fri, 19 Nov 2021 08:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wryGVpZb06m25zx5Ni2rv3/SjWRLXHAAknrwCXzqExE=; b=T7y43h8yTZU7KC2hbppEPJzpQE0AFnfnWnxTwKwsaefnR0ZRSXDQgw+HLB2ny7pKUv TW1MEjECrdpjuSiuagpw8zpJsTMqctO6Plg/ZNVl4dGxt8zsv0qlSreQATNaXnvSquLk DIP3f2PhLfaoZLndLDhtnP9TMB+VlDo+jq0/Nvk1yTv0/1TctswR1GqYoIbd0X0ifw8V IGy0DHGP6/u7nDZCTz+ITsMBavkhP76+g9KPiS/4I1jnR+ekbxX4YbACWTE4CLfjkB5l aa/jnxUIYnT6XYh2ZD6qQseGfLqHQz3H+6Xnb2tqjvyQzvyifx5n46kITL9oFNT3jSNV d/XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wryGVpZb06m25zx5Ni2rv3/SjWRLXHAAknrwCXzqExE=; b=HDIaFr5mciMLyydbaGKuaAaEgv7VysUCNEeX/Ka85FlFRW9OHU4jS59FgxrWTx4Jdp Ya9XWOrgFOtCLDR3EkCz8pCJ+ge3mfIztynaSYQnyEwkBjuw/WfFoCP63/vFAinpHsa0 k0PgaUZd7ubO4gqPsYjjGT2BwG7OKlFHAXg1HWQhmBVTJBIIf83V/1hi6fquRfN/fF5n gPPqWRmLMzfb+Nal/uY0EEfli/J0Ss5EKhrfsTVitl+bORCXJv2T2Vxo7ljVQfNCJcFD 1rZzwJNQfp2/h2FnlyZ7wsMNJZP6TViXJudtVDfes0T7jCHPTK+1ocpPRdFLNa8VrJpm EKyg== X-Gm-Message-State: AOAM530+yXd31O2UMoMrpgIDE8eRLaCKKc57agyThwxPWOvdg7s+H/Be 1rWUkCC4baquQ+0LoLawe5rq3GbffvPJUvclB2M= X-Received: by 2002:a1c:448b:: with SMTP id r133mr877343wma.85.1637337949255; Fri, 19 Nov 2021 08:05:49 -0800 (PST) Received: from localhost.localdomain (165.red-37-158-79.dynamicip.rima-tde.net. [37.158.79.165]) by smtp.gmail.com with ESMTPSA id q84sm14044877wme.3.2021.11.19.08.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:05:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 17/35] target/ppc: Clean up do_fri Date: Fri, 19 Nov 2021 17:04:44 +0100 Message-Id: <20211119160502.17432-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119160502.17432-1-richard.henderson@linaro.org> References: <20211119160502.17432-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::334 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, alex.bennee@linaro.org, clg@kaod.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Let float64_round_to_int detect and silence snans. Signed-off-by: Richard Henderson --- target/ppc/fpu_helper.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index ec0288df01..3a462e5596 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -596,25 +596,23 @@ FPU_FCFI(fcfidus, uint64_to_float32, 1) static uint64_t do_fri(CPUPPCState *env, uint64_t arg, FloatRoundMode rounding_mode) { - CPU_DoubleU farg; FloatRoundMode old_rounding_mode = get_float_rounding_mode(&env->fp_status); + int flags; - farg.ll = arg; + set_float_rounding_mode(rounding_mode, &env->fp_status); + arg = float64_round_to_int(arg, &env->fp_status); + set_float_rounding_mode(old_rounding_mode, &env->fp_status); - if (unlikely(float64_is_signaling_nan(farg.d, &env->fp_status))) { - /* sNaN round */ + flags = get_float_exception_flags(&env->fp_status); + if (flags & float_flag_invalid_snan) { float_invalid_op_vxsnan(env, GETPC()); - farg.ll = arg | 0x0008000000000000ULL; - } else { - set_float_rounding_mode(rounding_mode, &env->fp_status); - farg.ll = float64_round_to_int(farg.d, &env->fp_status); - set_float_rounding_mode(old_rounding_mode, &env->fp_status); - - /* fri* does not set FPSCR[XX] */ - env->fp_status.float_exception_flags &= ~float_flag_inexact; } + + /* fri* does not set FPSCR[XX] */ + set_float_exception_flags(flags & ~float_flag_inexact, &env->fp_status); do_float_check_status(env, GETPC()); - return farg.ll; + + return arg; } uint64_t helper_frin(CPUPPCState *env, uint64_t arg)