From patchwork Fri Dec 13 17:32:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 850153 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1639315wry; Fri, 13 Dec 2024 09:36:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXI0NjKo8om+6cf4dvgVl0JVOVvlT0SoLMu/Cvj2pnI++S4P++M+jKosCrjQJhgs02IZVataA==@linaro.org X-Google-Smtp-Source: AGHT+IFF819SdnbQ02RBJzoyb5TquSuUWGeR9MnCk5vTHo2sscL1X4BrGqJHI9rO0Md0wmwzK0EZ X-Received: by 2002:a05:6000:1fa2:b0:386:3357:2d9d with SMTP id ffacd0b85a97d-3888e0f2de1mr2650770f8f.36.1734111401310; Fri, 13 Dec 2024 09:36:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734111401; cv=none; d=google.com; s=arc-20240605; b=WKNqEr+LV5i1rF1vX0m/jVj3rXJznoBqnSLyjURiMu7nVxEF5pM9nMZA5j2woiEFir qeoggVpRBHqoGVPmdnUKurYlCJWFm/SQupsZd/YDtFQMEee31njita7dXCT8VUEHOpPb RwryQ0yOBOekLc4i3jNx/nDzNj+i2cVpzLg9yM0A3ZHm7uPmI1bCxcDUGyq4b0xYEC8U PJHrvHReffBtVV4Xk5QYxsBe6elpjnvP7YYxgqVO6V+J/O1c6NQrGi4ftzvAT1mAnyT3 Jc46SJFyrlirqbJfSsgYfVw372DnrPm71ikk3nf8hME5GrcXkedtSuvahjElygYd3xkl W2ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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=4Tvdd/VSuAoXtZ7lXIE2S/8K11Z6fStvv2Pl+2QKZyA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=lSFSImaOOXL10TaBt0TmprQs8ujiPehL1u7GIPdgV5c3J8R09BNhr18ujRMi8oJDPe CLNMN9oMK6v2s5a/QDtjcF4VtmcNw/12AfULdEwJrkd+DFw615QR2h53xNcWjZiSgNED arw3wrQmfz4mPI/LZkLaqEhLgObpLjOvJwP52rfYgtwUWUVFubDg8e8uau+marYjPSvp JukFe28iEtfSmwmyt798gI+BtG/WLckHLkxi4j5D0CyRlsc9rDTghcNVA/LilYgkk+Nk A2SmFQYNNWunuJwpuWwROrr0a6QJmnn/fCC5nvSELTDyuKt6D77/nCxyNAtd/dRJ6KQo +fTQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gwMvsFkV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 5b1f17b1804b1-4362580f9e8si22754445e9.191.2024.12.13.09.36.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 09:36:41 -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=pass header.i=@linaro.org header.s=google header.b=gwMvsFkV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tM9aO-0000ZV-Ib; Fri, 13 Dec 2024 12:36:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tM9Y5-0008MD-TJ for qemu-devel@nongnu.org; Fri, 13 Dec 2024 12:33:58 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tM9Xy-0001jO-Cj for qemu-devel@nongnu.org; Fri, 13 Dec 2024 12:33:57 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3862f32a33eso985782f8f.3 for ; Fri, 13 Dec 2024 09:33:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734111226; x=1734716026; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4Tvdd/VSuAoXtZ7lXIE2S/8K11Z6fStvv2Pl+2QKZyA=; b=gwMvsFkVvQvGJ29VHbPGqKdBQkGHMmw/eDvdfFJf7vSd/Rl/uPTgMlIEHwIIDgPQjn Pruc5odOJI1itIqQ0sQklSKs2ek6/lqIsN/TAtXjHsC+WNfIdvIodTm7H9RbpTcg88J8 nQVd/6nKA/6ychrbEKhigUmAiGXBEUEZGztm4ErEz0sQgbdzvdk73IrHJPjq3bUhlVSi A7X7jgS+JPHQUyvaDIDnT5buFVZz4dj31ov6WjCWDL0IquXvACTKMRJ0LSO95OnaLzwq Ju9BM5V3+v3LySIQ59lQ1eOMen9BhD7hNbZI6cIgYm1JtpbUtVUgvZ8VXDSG03M+HFw4 fj9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734111226; x=1734716026; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Tvdd/VSuAoXtZ7lXIE2S/8K11Z6fStvv2Pl+2QKZyA=; b=rrLeo2oSBhp5BlwgsWYDHvIfalYluUPGNRId3B96pOmf+5SnaDHyUmEQ/EkvikcCwn IUq8DfxB+gfSoh5ZGYMT7OQbx3/v2JGtg72N4VnYn1uuTB3l/8+vDBvKCLgZMlaFlBOo zbILYvp199p1GhKuQ0mT4pPjNHps96Mf+gbdL78+byzlMMFf4eUHKBR05twzAWgA0PW5 iV/8BVz71g/DDfieh2rbGh9nWyAW6gNEa4t/ZV4wNEKOAiFYlPdIGh4un+azZIX4xfEo yQWeRPz8UJJxG9Sxopmp3h22JpvLkPTCyVMa8gt4aPpuoDgZv8K67sGiZoMM7V1acwFU Ejiw== X-Gm-Message-State: AOJu0YzigqTunZOhHtGre5sSJBuHbh/eVxGYOxZgZJndmq2Sa2h/ZoK3 OpM2GyBRGqYfLTqevX7lZVOS2oNamSUi6Oh4WwawuKdNUg8xnlgpCyEsDkHVZpqam4BYJ23+XPl F X-Gm-Gg: ASbGncvCk5z0jRn8+JfRzufPF12sttJ9pMfK6cBoOH/ImuzxbvHdI4zDifrwdQ5nwd3 i94mSTZuFeKhUfmxyfKcNm3CnFtWY0F5ud/lbtXyQskkDHkPjG6mhohkSO4L5ZTa9T051lnOj6o ZTh3/SuP/XDmjBuj5MQFi2PkLgvY3uUYXcEJzEaddH7lsP+AehUfdvqkkY/BNqeun4edLELP2pF K6jrHmNbegiv6lOh/ftf6jDsmYVmUkt5Uc8cbng9k0qmHKEGRY0Hbxb30BLkg== X-Received: by 2002:a5d:6d8f:0:b0:385:e43a:4dd8 with SMTP id ffacd0b85a97d-38880af1458mr2823540f8f.4.1734111226023; Fri, 13 Dec 2024 09:33:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c80162ddsm87026f8f.37.2024.12.13.09.33.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 09:33:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 70/85] target/arm: Use float_round_to_odd in helper_fcvtx_f64_to_f32 Date: Fri, 13 Dec 2024 17:32:14 +0000 Message-Id: <20241213173229.3308926-71-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241213173229.3308926-1-peter.maydell@linaro.org> References: <20241213173229.3308926-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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, T_SPF_TEMPERROR=0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Softfloat has native support for round-to-odd. Use it. Signed-off-by: Richard Henderson Message-id: 20241206031428.78634-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/tcg/helper-a64.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c index 28de7468cd1..fb6fe0fcaa9 100644 --- a/target/arm/tcg/helper-a64.c +++ b/target/arm/tcg/helper-a64.c @@ -408,23 +408,13 @@ float64 HELPER(frecpx_f64)(float64 a, void *fpstp) float32 HELPER(fcvtx_f64_to_f32)(float64 a, CPUARMState *env) { - /* Von Neumann rounding is implemented by using round-to-zero - * and then setting the LSB of the result if Inexact was raised. - */ float32 r; float_status *fpst = &env->vfp.fp_status; - float_status tstat = *fpst; - int exflags; + int old = get_float_rounding_mode(fpst); - set_float_rounding_mode(float_round_to_zero, &tstat); - set_float_exception_flags(0, &tstat); - r = float64_to_float32(a, &tstat); - exflags = get_float_exception_flags(&tstat); - if (exflags & float_flag_inexact) { - r = make_float32(float32_val(r) | 1); - } - exflags |= get_float_exception_flags(fpst); - set_float_exception_flags(exflags, fpst); + set_float_rounding_mode(float_round_to_odd, fpst); + r = float64_to_float32(a, fpst); + set_float_rounding_mode(old, fpst); return r; }