From patchwork Thu May 27 04:14:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448826 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp162204jac; Wed, 26 May 2021 21:22:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnZ/9qiKk1isuBkKCUVk7SLAtZc1NwNV1wMOWJ8JuICAj5qF22CKiQkfzlQKYGs0eoh6JX X-Received: by 2002:a25:a226:: with SMTP id b35mr1850060ybi.275.1622089346011; Wed, 26 May 2021 21:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622089346; cv=none; d=google.com; s=arc-20160816; b=yjb1mS28T/P+4xe+4JwUk8wp0MTsEXCrKdyrCJlmWYjlBfm2/fArT/OYDCtE90uYxT HT3Yr161/vvtTmhk+ksbRhpVoXsdAeDduLSG9l44Pu11lr2K3lRm56W7FbAZwohUdhBC yEqTC+uKYz//WJX14ADOqg+MW+6k4t/pXELKXoThoWsjTm7Aa/iP9tCmi09C7m4W3s+J xa12oyGaYqub5yo5HDC8wXlOgJ3XojrrMfGAqri1Nzj20F6NAx5e5bDJmVDiyljU3LL0 oH7eWpiWLDBFY6QpKf5UcuvfFfMbMjM6CAyjk+KMwHj4poHb8heKM3DMItONKz8BROZ6 JZ1g== 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=fxhT5T2jN/8rQ+o7wJeAhpV/9V3uAlnXkzPAEXr9qP0=; b=qkwdfCkjQfSPBMutc5XjSThfQQXkzuMuz/t5GXO5sPMXFmdAp8QsjxBxw5NtPjBLsX lskykjnWQBdaQHRqY4wVYjDovj3rqmBwvJvpad2p/jaEBR5e7L0MihzcbxFNFxXxTEcP DdQDFZzc7c1tEhYYWRlqttbRcJFCzRyK2JlTL5gU5He3v3Ms/H13Z0c7ww8zVeMlm5eg Dzf5yoq5n30Tek1OkNV5SY2u9WcDoPVLl6GEMiLYkiUfuOSw8/ZDM94f6EMQD0fxRVvm wscZnFzHzH8K81GyBWUJefdyjWdP3UFbLuXnTMYimRtwxii7PaRfPFRvtFQjQrc1nWGn Plgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DHI9VWea; 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 i3si891761ybk.490.2021.05.26.21.22.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 21:22:25 -0700 (PDT) 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=DHI9VWea; 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]:32798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm7XN-00015g-Gi for patch@linaro.org; Thu, 27 May 2021 00:22:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm7PZ-0001cr-07 for qemu-devel@nongnu.org; Thu, 27 May 2021 00:14:22 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:37663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm7PS-0007Es-9c for qemu-devel@nongnu.org; Thu, 27 May 2021 00:14:20 -0400 Received: by mail-pg1-x535.google.com with SMTP id t193so2728299pgb.4 for ; Wed, 26 May 2021 21:14:13 -0700 (PDT) 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=fxhT5T2jN/8rQ+o7wJeAhpV/9V3uAlnXkzPAEXr9qP0=; b=DHI9VWeaQcvvzr+boGdZjn0q24hRoQP9IM8EiaiiCMf+AnpvOsc8r4VlwPWwSTSI3j NrP8QJVITUXpt1S0BHuUMtDiHjXBFdItRB2YBxXCBe7f4WScY3eBs73mBgxPDBIdMk9F 6lFc7GzjMJeLJImnzRyhmMYb29Nvh0qRgcS2vGSStMNQywYeAlPBbvu6NOIdatIqorpq QliEQAxB8BzteYsoxt5+HwQsVK45rR7KbHp3jq8Or+O57MzRi8s4EefLjOk6VMVCfa9t 63wyQ11G4oGFL0O0IG2HC1Mr8LjZRsX+mNe0nrK7udI9RafYqnIOLhJJxTBHssonTn+A UrBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fxhT5T2jN/8rQ+o7wJeAhpV/9V3uAlnXkzPAEXr9qP0=; b=NtAAlRfBYis2hmbwXY9tfLsxRMzAKB/jKs24Qn684XmWcAFak7YW2KpOOCJgmoz4Nj Re5bd4ELgZBSXp2oNl3TkgvT8zVDuITsaAcxZWRQUFoq3nC1owitSyxCpDe2ZBf+Kkj8 ZLmwY1EtO5TzZnyICgF5kjz4z/9KFsl//DXxaVxiV5b1vO7GJJPbGM/ovqU0t6Cpiwvf zNpnNY8XSd2HVVDylUzEIHIomTfs20frdCyjavB7tUk3BXBtla7hrALbudN3oiJbbRBH h2xSZddTDdtsRPIT9eJ0huksoxntqj1awKdGjst5Ar3DNOc9HCjGG+JnOBHI2Bq1yiyN UsgA== X-Gm-Message-State: AOAM530anAq3o6I+TxpWheBy9GT9UQKgPa8ni8ZCjK9H8nj7Qx1g7mCn q5WPwXd9gTEbV9phcXO4UJvoEhfC0yaC3A== X-Received: by 2002:a62:2a14:0:b029:263:20c5:6d8c with SMTP id q20-20020a622a140000b029026320c56d8cmr1449434pfq.23.1622088852973; Wed, 26 May 2021 21:14:12 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id s1sm605959pfc.6.2021.05.26.21.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 21:14:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/11] target/mips: Drop denormal operand to update_msacsr Date: Wed, 26 May 2021 21:14:05 -0700 Message-Id: <20210527041405.391567-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210527041405.391567-1-richard.henderson@linaro.org> References: <20210527041405.391567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, Yongbok Kim , mmorrell@tachyum.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The comment about not signaling all underflow cases is almost certainly incorrect. It has been there since the initial commit of the file. There is a bit of code below that sets underflow with float_flag_oflush_denormal, which is probably the fix for whatever the original case may have been. Cc: Yongbok Kim Cc: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/mips/tcg/msa_helper.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c index ffe6e630ed..b752373bce 100644 --- a/target/mips/tcg/msa_helper.c +++ b/target/mips/tcg/msa_helper.c @@ -6205,7 +6205,7 @@ static int ieee_to_mips_xcpt_msa(int ieee_xcpt) return mips_xcpt; } -static int update_msacsr(CPUMIPSState *env, int action, int denormal) +static int update_msacsr(CPUMIPSState *env, int action) { int ieee_exception_flags; int mips_exception_flags = 0; @@ -6215,10 +6215,6 @@ static int update_msacsr(CPUMIPSState *env, int action, int denormal) ieee_exception_flags = get_float_exception_flags( &env->active_tc.msa_fp_status); - /* QEMU softfloat does not signal all underflow cases */ - if (denormal) { - ieee_exception_flags |= float_flag_underflow; - } if (ieee_exception_flags) { mips_exception_flags = ieee_to_mips_xcpt_msa(ieee_exception_flags); } @@ -6469,7 +6465,7 @@ static int32_t float64_to_q32(float64 a, float_status *status) cond = float ## BITS ## _ ## OP ## _quiet(ARG1, ARG2, status); \ } \ DEST = cond ? M_MAX_UINT(BITS) : 0; \ - c = update_msacsr(env, CLEAR_IS_INEXACT, 0); \ + c = update_msacsr(env, CLEAR_IS_INEXACT); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \ @@ -7043,13 +7039,6 @@ void helper_msa_fsne_df(CPUMIPSState *env, uint32_t df, uint32_t wd, compare_ne(env, pwd, pws, pwt, df, 0, GETPC()); } -#define float16_is_zero(ARG) 0 -#define float16_is_zero_or_denormal(ARG) 0 - -#define IS_DENORMAL(ARG, BITS) \ - (!float ## BITS ## _is_zero(ARG) \ - && float ## BITS ## _is_zero_or_denormal(ARG)) - #define MSA_FLOAT_BINOP(DEST, OP, ARG1, ARG2, BITS) \ do { \ float_status *status = &env->active_tc.msa_fp_status; \ @@ -7057,7 +7046,7 @@ void helper_msa_fsne_df(CPUMIPSState *env, uint32_t df, uint32_t wd, \ set_float_exception_flags(0, status); \ DEST = float ## BITS ## _ ## OP(ARG1, ARG2, status); \ - c = update_msacsr(env, 0, IS_DENORMAL(DEST, BITS)); \ + c = update_msacsr(env, 0); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \ @@ -7193,7 +7182,7 @@ void helper_msa_fdiv_df(CPUMIPSState *env, uint32_t df, uint32_t wd, \ set_float_exception_flags(0, status); \ DEST = float ## BITS ## _muladd(ARG2, ARG3, ARG1, NEGATE, status); \ - c = update_msacsr(env, 0, IS_DENORMAL(DEST, BITS)); \ + c = update_msacsr(env, 0); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \ @@ -7312,7 +7301,7 @@ void helper_msa_fexp2_df(CPUMIPSState *env, uint32_t df, uint32_t wd, \ set_float_exception_flags(0, status); \ DEST = float ## BITS ## _ ## OP(ARG, status); \ - c = update_msacsr(env, 0, IS_DENORMAL(DEST, BITS)); \ + c = update_msacsr(env, 0); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \ @@ -7365,7 +7354,7 @@ void helper_msa_fexdo_df(CPUMIPSState *env, uint32_t df, uint32_t wd, \ set_float_exception_flags(0, status); \ DEST = float ## BITS ## _ ## OP(ARG, status); \ - c = update_msacsr(env, CLEAR_FS_UNDERFLOW, 0); \ + c = update_msacsr(env, CLEAR_FS_UNDERFLOW); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## XBITS(status) >> 6) << 6) | c; \ @@ -7416,7 +7405,7 @@ void helper_msa_ftq_df(CPUMIPSState *env, uint32_t df, uint32_t wd, \ set_float_exception_flags(0, status); \ DEST = float ## BITS ## _ ## OP(ARG1, ARG2, status); \ - c = update_msacsr(env, 0, 0); \ + c = update_msacsr(env, 0); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \ @@ -7672,7 +7661,7 @@ void helper_msa_fclass_df(CPUMIPSState *env, uint32_t df, \ set_float_exception_flags(0, status); \ DEST = float ## BITS ## _ ## OP(ARG, status); \ - c = update_msacsr(env, CLEAR_FS_UNDERFLOW, 0); \ + c = update_msacsr(env, CLEAR_FS_UNDERFLOW); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \ @@ -7780,8 +7769,7 @@ void helper_msa_fsqrt_df(CPUMIPSState *env, uint32_t df, uint32_t wd, DEST = float ## BITS ## _ ## div(FLOAT_ONE ## BITS, ARG, status); \ c = update_msacsr(env, float ## BITS ## _is_infinity(ARG) || \ float ## BITS ## _is_quiet_nan(DEST, status) ? \ - 0 : RECIPROCAL_INEXACT, \ - IS_DENORMAL(DEST, BITS)); \ + 0 : RECIPROCAL_INEXACT); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \ @@ -7897,7 +7885,7 @@ void helper_msa_frint_df(CPUMIPSState *env, uint32_t df, uint32_t wd, (~float_flag_inexact), \ status); \ \ - c = update_msacsr(env, 0, IS_DENORMAL(DEST, BITS)); \ + c = update_msacsr(env, 0); \ \ if (get_enabled_exceptions(env, c)) { \ DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \