From nobody Thu Oct 30 15:33:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526086116813643.9293161366662; Fri, 11 May 2018 17:48:36 -0700 (PDT) Received: from localhost ([::1]:59278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHIi7-0002OD-FO for importer@patchew.org; Fri, 11 May 2018 20:48:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHId5-0003xa-GU for qemu-devel@nongnu.org; Fri, 11 May 2018 20:43:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHId4-0002oV-PM for qemu-devel@nongnu.org; Fri, 11 May 2018 20:43:19 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:34145) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHId4-0002oC-Jp for qemu-devel@nongnu.org; Fri, 11 May 2018 20:43:18 -0400 Received: by mail-pf0-x244.google.com with SMTP id a14-v6so3438958pfi.1 for ; Fri, 11 May 2018 17:43:18 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id k84-v6sm10756406pfh.93.2018.05.11.17.43.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 17:43:16 -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; bh=KKM5+1s0S4RtYoVM9p3qzJTyULZIllGWLcjzz7/+Vb8=; b=ZzMWcyDJrf3CwrRApNOfJ9o01/yFnwBhT9M3f13naOUalPsU1lUvBCP6ykQJWv6BFP iQ84Oh2clnfh0vo1keFJ9Bt9CzLa0fcaBjg809VMYJW9o/8T4MvEDO6K75uQFDyRV2bu uloxvyLh0DqL7ynp+gkkt1pg0b1t5mdeFcKt4= 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; bh=KKM5+1s0S4RtYoVM9p3qzJTyULZIllGWLcjzz7/+Vb8=; b=XzdREK+GU/AIhhg86CxrHVFRWFLh3U/3v5Fp9Kh1rxW7GRyQTDbYFO0zQ5toRl2hJm qj2EBHivCFhHQl5OJGx+8gQgRPACXPH3IdwRP2GLTwyMEXvJUKDeabMuVrPKAiy+tp32 Sy8/vDpoyeWUCr130TuiEoDdtP/eIcvjMEeSBJ6STFlnLEHpZa75FLfNFVm09pjKOwCQ vweLwK1xe4DawBpUH0JZpbw0q3ZUyT+QGye8IILwF1B7OpfKC5zmbn3OAvWH34CZH4cA TXdLsFEN6WN4l5JgbyVLqvGrnO0ujB9O+ehHPlYvFdvVOBuHmbF+2pWu19vCW1dCco1g /ysQ== X-Gm-Message-State: ALKqPwfKITE2E+iPAFePA4tHnRi83Qb3YaW2eBPA4+cgHD7FUtW5AVUl VkBTaJ6apD2g2Jy0ZhrhaI8cSw9JBAU= X-Google-Smtp-Source: AB8JxZpAcG/dL71AKEn2ZZ9Vl+vf93PVkT7fXFOnZISuxdhrAyBN2gRvhCMj39Ab6nroYTcImWRFaQ== X-Received: by 2002:a65:5a81:: with SMTP id c1-v6mr1023675pgt.20.1526085797250; Fri, 11 May 2018 17:43:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 11 May 2018 17:42:46 -0700 Message-Id: <20180512004311.9299-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180512004311.9299-1-richard.henderson@linaro.org> References: <20180512004311.9299-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::244 Subject: [Qemu-devel] [PATCH v2 02/27] fpu/softfloat: Don't set Invalid for float-to-int(MAXINT) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell In float-to-integer conversion, if the floating point input converts exactly to the largest or smallest integer that fits in to the result type, this is not an overflow. In this situation we were producing the correct result value, but were incorrectly setting the Invalid flag. For example for Arm A64, "FCVTAS w0, d0" on an input of 0x41dfffffffc00000 should produce 0x7fffffff and set no flags. Fix the boundary case to take the right half of the if() statements. This fixes a regression from 2.11 introduced by the softfloat refactoring. Cc: qemu-stable@nongnu.org Fixes: ab52f973a50 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- fpu/softfloat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index b39c0c6fbb..bc0f52fa54 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1368,14 +1368,14 @@ static int64_t round_to_int_and_pack(FloatParts in,= int rmode, r =3D UINT64_MAX; } if (p.sign) { - if (r < -(uint64_t) min) { + if (r <=3D -(uint64_t) min) { return -r; } else { s->float_exception_flags =3D orig_flags | float_flag_inval= id; return min; } } else { - if (r < max) { + if (r <=3D max) { return r; } else { s->float_exception_flags =3D orig_flags | float_flag_inval= id; --=20 2.17.0