From patchwork Fri Apr 13 14:03:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 133377 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp765454ljb; Fri, 13 Apr 2018 07:04:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/QPe5c8aQgrcogWwQCHpfcLa9XD0ABuqhN5c/OvoRTdUGasv/XDB/9QHKvcuqFzbzHGg3I X-Received: by 10.233.225.10 with SMTP id g10mr4650610qkm.263.1523628249534; Fri, 13 Apr 2018 07:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523628249; cv=none; d=google.com; s=arc-20160816; b=MWs2AOq/6QEOyZb38QmTHj3016qAI3Xsa9gm6O7Mycnpcx3f3ePkj5hYNqed8inluS dprqRB3otQuf9Jmu6sB+876+VzaDZ4zwmHxfNPrHyrDfybmXUZ/quckdPHOZChf0wF3B xIyPx5gev+H4nAO0Ptbkw2IN6mKJHxJK+LXhI2LMpMzh4MZKfVk09w6ua9Cs3hK3swT6 QXXbXs+cU1dKmkChoE9cRWT73+FjejPidLEOnIAltd4Gqh1SZ98BDfpom6pyLQDM5ZSa xVs0daYHWfy9hlTpnT5oUzNGsGeatv7tokzmcAFmOS38Oy1vQAloSLckDpRypKgEUsFO tRlQ== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=7EujjhTl4udGdJbhRHyWMrTYrxgmGjapgU23kkosbxs=; b=fqTQyYiWfRrHix7XRA0oZ/B8137XJV81JPr00g6mnXB4IGWJBKluFOXJHwJVd2SGXx JLRXiDArToAZJ20gYkT15gS6ZBVjp0evsMvHtQ94o9cUk8Mn7bRN9czFlUwwcyjzdvOB 9Aqex2kD8R0suWag7cCGSmi6yLl6NpMivxxXBbOzbl+7xNU1UFWCtoFphGPcyI2cMDxr 9FELfr8+KIiLawoj1M8m3VXwPAsVTyF3ra/ioXFSrQv/utCDqIfCp6AtgH4ZMbK3/GhF 9lsCwPfOR1w2FOujQWTdPp3kbr09puEK4HgAMQqZpOOZkzdheSMy3iHhOxCXrzMe2o18 RAkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d1uzxxYZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j130si1223599qkj.78.2018.04.13.07.04.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 13 Apr 2018 07:04:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d1uzxxYZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:55906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6zJA-0003CK-TW for patch@linaro.org; Fri, 13 Apr 2018 10:04:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6zIl-00037P-PH for qemu-devel@nongnu.org; Fri, 13 Apr 2018 10:03:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6zIf-0000bO-Vc for qemu-devel@nongnu.org; Fri, 13 Apr 2018 10:03:43 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:35317) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f6zIf-0000b6-Or for qemu-devel@nongnu.org; Fri, 13 Apr 2018 10:03:37 -0400 Received: by mail-wr0-x241.google.com with SMTP id o3so8435937wri.2 for ; Fri, 13 Apr 2018 07:03:37 -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=7EujjhTl4udGdJbhRHyWMrTYrxgmGjapgU23kkosbxs=; b=d1uzxxYZyizcYgh4AATAqFktEWXqN95tRaokTxI/lE93ee+aJg3lysJd92QIYxSv1o H7VVYDPEno1fvttamO/X4D7ptsLpadbWUJs4Nzb9BKUcuPKpCjlC6FwAuxk0JQ1hgUCQ LEYD1diO2s6UkskT+zXwA5uWEPjBm9xZLSsRc= 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=7EujjhTl4udGdJbhRHyWMrTYrxgmGjapgU23kkosbxs=; b=VoWRzKrJcGpeuWJYq8vCUpts2nj2tSoj3vUccxagqh+j63Gh04EFtmUWufWe47XFxy Jm4J4jHeYEvrAblNWQb1rjaIvHPZD3Z8Fu26sHf2pBLReceix6a+SpeI+pnfdq6TPQoI 2Hi6DtYK+0ikD6gLuGqfS58OBi859GZSciSFCW/aWqZGxbEkZ75T/Km76jK3SmdTDo0x 1dZwdmkqHHi8jUbW3txeML0hCkH+qXYuJfWaANG2rRa8OcmKAUjBqXl+fQkzp4Haelab NWn87GHS3yN8hO96DHu8tIbOG2AoRu1tlGyOb3DDlvLcRl7jcCyefYnrycOBnSej1Snk hGwg== X-Gm-Message-State: ALQs6tAAjvnsO/e8b848WJ7A/Fsx+Y2xPv6rPffuoHHs5K7RmlMecNcA zTzgDLanA4htREgYixPw3DTxIg== X-Received: by 10.223.146.69 with SMTP id 63mr142067wrj.156.1523628216620; Fri, 13 Apr 2018 07:03:36 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l131sm3623179wmb.36.2018.04.13.07.03.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Apr 2018 07:03:35 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 3E4873E061C; Fri, 13 Apr 2018 15:03:34 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 13 Apr 2018 15:03:34 +0100 Message-Id: <20180413140334.26622-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180413140334.26622-1-alex.bennee@linaro.org> References: <20180413140334.26622-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PATCH v2 2/2] fpu/softfloat: raise float_invalid for NaN/Inf in round_to_int_and_pack 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: Bastian Koppelmann , =?utf-8?q?Alex_Be?= =?utf-8?b?bm7DqWU=?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The re-factor broke the raising of INVALID when NaN/Inf is passed to the float_to_int conversion functions. round_to_uint_and_pack got this right for NaN but also missed out the Inf handling. Fixes https://bugs.launchpad.net/qemu/+bug/1759264 Signed-off-by: Alex Bennée Cc: Bastian Koppelmann --- fpu/softfloat.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.0 Reviewed-by: Bastian Koppelmann Reviewed-by: Peter Maydell Tested-by: Bastian Koppelmann diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 9b99aa6ec8..fb8663f59e 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1344,8 +1344,10 @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode, case float_class_qnan: case float_class_dnan: case float_class_msnan: + s->float_exception_flags = orig_flags | float_flag_invalid; return max; case float_class_inf: + s->float_exception_flags = orig_flags | float_flag_invalid; return p.sign ? min : max; case float_class_zero: return 0; @@ -1437,6 +1439,7 @@ static uint64_t round_to_uint_and_pack(FloatParts in, int rmode, uint64_t max, s->float_exception_flags = orig_flags | float_flag_invalid; return max; case float_class_inf: + s->float_exception_flags = orig_flags | float_flag_invalid; return p.sign ? 0 : max; case float_class_zero: return 0;