From patchwork Sat May 8 01:47:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 432543 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp850827jao; Fri, 7 May 2021 19:08:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJGsJ/LeAb9hGhFYuG2YQ6ztFnoV0qp8C9gyg44LW1FIhuT03t0mVS+1H1vPTWX9+VSd88 X-Received: by 2002:a05:620a:1265:: with SMTP id b5mr13095698qkl.208.1620439691916; Fri, 07 May 2021 19:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620439691; cv=none; d=google.com; s=arc-20160816; b=TUQvzWmgvhfr0cGDLo9O+kq9c5fmNpa4PMTSuldicZgftdbOmJFICzuRQfk/dmf8q3 rcYVqno5paixaQtwtem/nq7iC340Fsz0JpZJgaeimrPcK1ofAZeo9Ng0L6I9gVNeUhgq dzXFjNVFXpfe5L70QAgy2K4Wl//jpv5KN2U2rsjEWZ/b5qkb/Kgbp5PghMML5FZlt5k/ wi0msODnzvykW9xUxM7ysp1y1vSPIzqnRNDXkpOuxUwCxCOrwvsWJHt1VIPjsAQb5fGq J4P3khzr/t+J9S5Cb0UR5mXfZvhsg7poBKcpN9nTAlxaHe4DC8rHQy9+UGGDSUBoZJom JPvg== 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=7MJgtQMBS2ngXY709lmeRGrslyeOuJRTB/k5dCBY0b0=; b=J/KHS5aETYGo1hN0swmkAUbI57OsrdlCBMyY6LdgCiAR2XxBPnZMQsN5if50fGYw59 LiMUXxMzh/pYiRlr1kO2A5JSyJKnb8aI4R2U72/AE62+THVNX+jyzgHCOWvajQOM5Czs abX/Pv9rIhEYmcLNa46WKOwEotlKbPOtKQgMshNmxAWlY11IyCVCZBkA+g0FfVeS6UB3 zPkyVed55e2PbRE93CTLgx/BeSkUT3+z2lq4rrNuGzOAJFvU4CEV0/E+TViyM1v1C4d3 zfcgvfNXTV6zDfLb9INUtMe2oQ6sq0/iZx8FvV8AFw1VgPPJRuCICg/8qiRLnb0tC5O+ nvFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZEzQ62fu; 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 g18si5215373qvl.116.2021.05.07.19.08.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 May 2021 19:08:11 -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=ZEzQ62fu; 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]:38744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfCO3-0005Zk-Am for patch@linaro.org; Fri, 07 May 2021 22:08:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfC53-0004GW-6r for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:35 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:41898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfC4r-0003dA-I6 for qemu-devel@nongnu.org; Fri, 07 May 2021 21:48:32 -0400 Received: by mail-pl1-x635.google.com with SMTP id z18so2556712plg.8 for ; Fri, 07 May 2021 18:48:20 -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=7MJgtQMBS2ngXY709lmeRGrslyeOuJRTB/k5dCBY0b0=; b=ZEzQ62fuZL23i3KzUSjzVnFtRoMPgOLRz60W8vDr/iS/hpaEKguU9nNJbtqx7fos+j UakYvqmu3lgKRABCV3KAi8ie9klJvm0KW6lekdVZ97b+w+gFKDB/w2ztwMVbsty0Y1o1 kapRnJcqpxNGUrHEY7IUYScIqtbrH1Bq4fM7KWMg4hCdISa8I7AFeyMxUdvg1TUE7Jej T2hZyhKHrQlf6NngHDQG+tZ+qmMO7f1WTntO50v1J4hwXR6N9GEGNHp58CcZ4PMtDP4Q /pvWJpVelHzh25NIcy+etZRJHOlm4DCwnRMLFhDfwSWGqUiDtKJNGhogQKSxVxO+KK20 Pzrg== 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=7MJgtQMBS2ngXY709lmeRGrslyeOuJRTB/k5dCBY0b0=; b=BMQRvuV7VvUp4R9aaOmK6azY+5R+gBc0VZqCY+dqHe+DYWvFhgJ6KDYTOodan0K8FP v5wZPDogmfcB5Z38bKGeWRwan/Vut0FQ5d/ckhdgtMCW+VcWYg24d5Nc0fY8lDExuPj1 Em1GNFtcDZgRqvi0plZr1pH/McCFnBXSqqEBhEVyXL1H1XSdx/wL8EP5sf+5ROPmg/+K +QHPdUM+1gR3rXfR8WV82AZ5eAN6iboH1oPVK/wN6ED6xZQeR5EQwl/EoQftMLZVZnJF AxbKDasdWD+I9aBNt47mjnThpP81EHTNU/k0VhBmPXdrp6U+jC1jYR+QMywUR/Tj15q7 h2Kw== X-Gm-Message-State: AOAM530tVDyHr+BvmDNumAyxfL6fMGq/TVrC14o8WOG/iUUFtBhEpzQf 1JMngnKJKW3zoccw3gfq4/7Uz9WKA6+pnQ== X-Received: by 2002:a17:90a:6289:: with SMTP id d9mr13725072pjj.84.1620438499617; Fri, 07 May 2021 18:48:19 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id t4sm5819681pfq.165.2021.05.07.18.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 18:48:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 24/72] softfloat: Use pointers with parts_silence_nan Date: Fri, 7 May 2021 18:47:14 -0700 Message-Id: <20210508014802.892561-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210508014802.892561-1-richard.henderson@linaro.org> References: <20210508014802.892561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" At the same time, rename to parts64_silence_nan, split out parts_silence_nan_frac, and define a macro for parts_silence_nan. Signed-off-by: Richard Henderson --- fpu/softfloat.c | 16 +++++++++------- fpu/softfloat-specialize.c.inc | 17 +++++++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) -- 2.25.1 Reviewed-by: Alex Bennée diff --git a/fpu/softfloat.c b/fpu/softfloat.c index b0cbd5941c..2123453d40 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -657,6 +657,7 @@ static inline float64 float64_pack_raw(const FloatParts64 *p) #include "softfloat-specialize.c.inc" #define parts_default_nan parts64_default_nan +#define parts_silence_nan parts64_silence_nan /* Canonicalize EXP and FRAC, setting CLS. */ static FloatParts64 sf_canonicalize(FloatParts64 part, const FloatFmt *parm, @@ -851,7 +852,8 @@ static FloatParts64 return_nan(FloatParts64 a, float_status *s) if (is_snan(a.cls)) { float_raise(float_flag_invalid, s); if (!s->default_nan_mode) { - return parts_silence_nan(a, s); + parts_silence_nan(&a, s); + return a; } } else if (!s->default_nan_mode) { return a; @@ -875,7 +877,7 @@ static FloatParts64 pick_nan(FloatParts64 a, FloatParts64 b, float_status *s) a = b; } if (is_snan(a.cls)) { - return parts_silence_nan(a, s); + parts_silence_nan(&a, s); } } return a; @@ -916,7 +918,7 @@ static FloatParts64 pick_nan_muladd(FloatParts64 a, FloatParts64 b, FloatParts64 } if (is_snan(a.cls)) { - return parts_silence_nan(a, s); + parts_silence_nan(&a, s); } return a; } @@ -3801,7 +3803,7 @@ float16 float16_silence_nan(float16 a, float_status *status) float16_unpack_raw(&p, a); p.frac <<= float16_params.frac_shift; - p = parts_silence_nan(p, status); + parts_silence_nan(&p, status); p.frac >>= float16_params.frac_shift; return float16_pack_raw(&p); } @@ -3812,7 +3814,7 @@ float32 float32_silence_nan(float32 a, float_status *status) float32_unpack_raw(&p, a); p.frac <<= float32_params.frac_shift; - p = parts_silence_nan(p, status); + parts_silence_nan(&p, status); p.frac >>= float32_params.frac_shift; return float32_pack_raw(&p); } @@ -3823,7 +3825,7 @@ float64 float64_silence_nan(float64 a, float_status *status) float64_unpack_raw(&p, a); p.frac <<= float64_params.frac_shift; - p = parts_silence_nan(p, status); + parts_silence_nan(&p, status); p.frac >>= float64_params.frac_shift; return float64_pack_raw(&p); } @@ -3834,7 +3836,7 @@ bfloat16 bfloat16_silence_nan(bfloat16 a, float_status *status) bfloat16_unpack_raw(&p, a); p.frac <<= bfloat16_params.frac_shift; - p = parts_silence_nan(p, status); + parts_silence_nan(&p, status); p.frac >>= bfloat16_params.frac_shift; return bfloat16_pack_raw(&p); } diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc index 085ddea62b..2a1bc66633 100644 --- a/fpu/softfloat-specialize.c.inc +++ b/fpu/softfloat-specialize.c.inc @@ -177,20 +177,25 @@ static void parts64_default_nan(FloatParts64 *p, float_status *status) | floating-point parts. *----------------------------------------------------------------------------*/ -static FloatParts64 parts_silence_nan(FloatParts64 a, float_status *status) +static uint64_t parts_silence_nan_frac(uint64_t frac, float_status *status) { g_assert(!no_signaling_nans(status)); g_assert(!status->default_nan_mode); /* The only snan_bit_is_one target without default_nan_mode is HPPA. */ if (snan_bit_is_one(status)) { - a.frac &= ~(1ULL << (DECOMPOSED_BINARY_POINT - 1)); - a.frac |= 1ULL << (DECOMPOSED_BINARY_POINT - 2); + frac &= ~(1ULL << (DECOMPOSED_BINARY_POINT - 1)); + frac |= 1ULL << (DECOMPOSED_BINARY_POINT - 2); } else { - a.frac |= 1ULL << (DECOMPOSED_BINARY_POINT - 1); + frac |= 1ULL << (DECOMPOSED_BINARY_POINT - 1); } - a.cls = float_class_qnan; - return a; + return frac; +} + +static void parts64_silence_nan(FloatParts64 *p, float_status *status) +{ + p->frac = parts_silence_nan_frac(p->frac, status); + p->cls = float_class_qnan; } /*----------------------------------------------------------------------------