From nobody Sun Feb 8 12:38:09 2026 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153238090252189.7050602511789; Mon, 23 Jul 2018 14:21:42 -0700 (PDT) Received: from localhost ([::1]:36728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhiGz-0007vQ-Ei for importer@patchew.org; Mon, 23 Jul 2018 17:21:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhKM-0003Zm-Eo for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhKL-0005Db-F0 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:06 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:43147) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhKL-0005DM-9j; Mon, 23 Jul 2018 16:21:05 -0400 Received: by mail-oi0-x241.google.com with SMTP id b15-v6so3468875oib.10; Mon, 23 Jul 2018 13:21:05 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id a8-v6sm7948945oia.24.2018.07.23.13.21.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=79FhJ45C6ScQWoWPkygQVM7Ai2fm6uQPtNrO1Wa5grY=; b=ROoks/k7y3PEuh7jvWLp+fKsWOZxK5neSHArAZbYLJF85G03sE8eNFLHSPGrcDRQwR vWNy+C553Xmtwn8uBBBZH+/Gzlp9nHMW679McO8lNhCi7sJih+DfcIXvrbLFbBAgeo9x kyQ0nu9EaYhSyUWFdk50B/PKBK/T6kyLZcBGI9VmIvyZQtoZ/WZqAiyO0no2oD1ESkZ0 03+azVv3IlbuAkIrli3nj8Aag1ci2HkI6cJj/KMkYRdiLjF6P2caCln1wzw14e8GXL9/ dR3VCfujLb8/XGPhr4m70IMiQ/iTqy7cK8ICbZFkX+buozoS/Cs81kLMjhwtQG0z4X0y mX9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=79FhJ45C6ScQWoWPkygQVM7Ai2fm6uQPtNrO1Wa5grY=; b=a/3PAQtduP10rzzyLp0yV/ZJGn8kk2+x74Y++qZNYhRRkYcEEVVEa+1YV6Um/kbJqk oWPKEQIzoWi/2gHLxaiUPlIz6Q+16mPRiFayPc0xaxtT2/nt8x/qpjAP89Y9tpe5tXJ1 VyCyf46W2DvYB/8YZ+jZnWShSlATcMIpc8rc0WLtiM0EnDKMY7ymWCAuvlDop3e22cA7 RdW+BMc031/thws7oHgiX38bRBXkyMZDqAzNRg6bwNvB5ogiroNRcXI+iqOuRBSuKJAu Lkiipq3JOQZJQOQiqLsXTIUsTd1f9wu+zjc4QqYSsDa1vr+RRqfQpyuf1NGu79Egx3Uu TM8g== X-Gm-Message-State: AOUpUlGkkve7FHG5HgcKBauUzP196rUYDhKU2XaW530ejlQ+ta1xUSwf mwA450nkc+VNDtaDZmcUT0jI1PIBLjJLrg== X-Google-Smtp-Source: AAOMgpe00a62yhkki6A1lvLGLgOSudaXNYk068nN1WfLiOllqHbttCzIuveG7W6Ymf9TthRrt+UQHA== X-Received: by 2002:aca:ec46:: with SMTP id k67-v6mr312071oih.81.1532377264164; Mon, 23 Jul 2018 13:21:04 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:19 -0500 Message-Id: <20180723201748.25573-71-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::241 Subject: [Qemu-devel] [PATCH 70/99] 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 , 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 Message-id: 20180510140141.12120-1-peter.maydell@linaro.org (cherry picked from commit 333583757c5e910b040bef793974773635ce1918) Signed-off-by: Michael Roth --- fpu/softfloat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 8401b37bd4..9bcaaebe4f 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.1