From patchwork Tue Feb 26 14:11:55 2019 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: 159211 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3269790jad; Tue, 26 Feb 2019 06:19:57 -0800 (PST) X-Google-Smtp-Source: AHgI3IYZ+fAWb2eaRSprCN6QlvU4jN0dtN+fmeoaqHJeFQWXsM7udAuyECHxzvLl7B05ilUW5Sfd X-Received: by 2002:a25:e90b:: with SMTP id n11mr18886102ybd.16.1551190797891; Tue, 26 Feb 2019 06:19:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551190797; cv=none; d=google.com; s=arc-20160816; b=qKnkJMFFvHvGkA9yIQKeKTZog/Dh2/WuDG3BohyCNGZo46nf8OJ4Edt0MU0Kl5woPz aK3NjpcEqt/yNR29SXD+RCBSiBMSg07rRFZZIKceqv+va4Jvom1vvECkzxtBCztCNmtW TqW1V6+hI6mmxFgtmlCH19yRd6dvEIql9BvcAFDiM2GMVidxMMjqFFS8zHiTJ1aCKrq3 Zw2SDnlNr+eRCA6FRC2PjuNBWGKUnDMIoCp5tJlVsGY309hjqYrlrOKp+ZcrX1IXG1Xv FLdAvjJfcc2Mc5mJomwDgjNcIeJspHftEvxAyo14ONdSaXZRk9OK6yYpWiL4vkTHXgoo t9rA== 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; bh=ElZinor46d8S2+pEgLHFRgbqLUxMLQ18SFFrnMhtqKM=; b=sWS6eVbWbSd4ZQkCx/TAq1xYZWKw/TRSQcAP83lU1dgFJ/+JXxS02llqyajRLmzQz0 U8O3YPrk+dCu67TdhBvkntS3r6tyVz1s5zFmsXVhfQURvEjMJBNZoqe1RTORQuf/lWmu dZkCajHWGRn2QxuaJZewbfAhZvxqZFyYlnGgptrlAODpZd3XncrstmyEWhKgn4OtuGa2 Tkw4MzahJMC+NCPlWqovzzDSzMlmAwpx3iEsUDj8Z5Y3HgzClO91f5GkOFRD3ZSQc/z+ ioeNdOiyxbAjQtaAnJN0bjVscbvV392OWfokf6EdtGWhf/9njrLL9IhSBS9nBrpzGvPQ qD9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=J5kWJGdk; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e201si4892633yba.232.2019.02.26.06.19.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Feb 2019 06:19:57 -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=fail header.i=@linaro.org header.s=google header.b=J5kWJGdk; 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" Received: from localhost ([127.0.0.1]:56200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydaP-0005qN-9M for patch@linaro.org; Tue, 26 Feb 2019 09:19:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydSp-00087u-0I for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gydSn-0003Jf-US for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:06 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:45784) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gydSn-0003GO-6S for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:05 -0500 Received: by mail-wr1-x432.google.com with SMTP id w17so14089763wrn.12 for ; Tue, 26 Feb 2019 06:12:05 -0800 (PST) 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=ElZinor46d8S2+pEgLHFRgbqLUxMLQ18SFFrnMhtqKM=; b=J5kWJGdkyOtBsyD3kLzvuKg/dvT4YxCmQefU54htgRIwrVJOnAezBKeuir7WZt9gwD tNsC0f6mQwkGUedzgwRz9HC+B+cM5ho7tGsXhPAdt4MtTmWQ8QOO+1JEu+T2UqC3xNVh fSHIbFF/Xy7/i8bMRmayo8s5Gv1W8RXvNUZdepip4hYfQEERPtpRqbyG0BJQxRdRm4Ns jqV5Igpe/mnzeZI5GDtoRaKeuL2p2K4xWUiKailVUbq+tO9+F2PysfFoTHbnk38JDwX/ 9tGJOkc4q5ItvfbV78ax+VF+bqtzWf1luxRI3NlqBrFAE0ScrZvPBsmtJ17UJZut9Moe xTIA== 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=ElZinor46d8S2+pEgLHFRgbqLUxMLQ18SFFrnMhtqKM=; b=MgfnH/85BDt1J0e+nl6KsRh/jbDZI9DfJcfkmIkLqLsXcs5kCk0NfoJUCCyxYF45DT etcKVgorJYOwyJFaJo4HFn43Qc8QaWTwmbWZnlxpusxSSEsn/XTNbx20Bq0PTA0+lqww 9Qa5e27xx9ZfOlykamLsNsQFc+hi83S+wBUxDutpzc14JW0F4z06Z5pmUFCUKbYATrLd AF0qwUfgeJhyOkEpKKJ/AO8twdxXy3A8zEA76v5am9E7qqZFRF9JKn4YDngPVj2oxn5u 3FIlQnLOvSd3BkU9bSJV6DmvouC+0610u+WpgWv9v9FtyxEE37u1WQun27VIdHVFCyW6 NDkg== X-Gm-Message-State: AHQUAuZqFnfbNWO9XoS6J9kDgQPKMRQiTmZA/0Zc6dQqZWuHJlud0Cwd GCV+hCgX0y0juN6Eo3yBcXo7Qg== X-Received: by 2002:adf:afe3:: with SMTP id y35mr15972551wrd.318.1551190323856; Tue, 26 Feb 2019 06:12:03 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a9sm9005621wmm.10.2019.02.26.06.12.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 06:12:02 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D938E1FF82; Tue, 26 Feb 2019 14:12:01 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 14:11:55 +0000 Message-Id: <20190226141201.16999-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226141201.16999-1-alex.bennee@linaro.org> References: <20190226141201.16999-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:4864:20::432 Subject: [Qemu-devel] [PULL 1/7] tests: Ignore fp test outputs 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: =?utf-8?q?Alex_Benn=C3=A9e?= , "Emilio G . Cota" , qemu-devel@nongnu.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Eric Blake Commit 2cade3d wired up new tests, but did not exclude the new *.out files produced by running the tests. Signed-off-by: Eric Blake Reviewed-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/.gitignore b/tests/.gitignore index 72c18aaab0..f2bf85c8c4 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -5,6 +5,7 @@ benchmark-crypto-hmac check-* !check-*.c !check-*.sh +fp/*.out qht-bench rcutorture test-* From patchwork Tue Feb 26 14:11:56 2019 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: 159209 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3266810jad; Tue, 26 Feb 2019 06:17:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IYchRDj83v7QnqBFqyjuuVRwn++bKHZfMcLkoVNusp8DgXrZuJMLr93UsUS0Z4wsibcAKHD X-Received: by 2002:a25:25d4:: with SMTP id l203mr4241924ybl.490.1551190630742; Tue, 26 Feb 2019 06:17:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551190630; cv=none; d=google.com; s=arc-20160816; b=e8aB5aUy3MI7kg8ularMBS96eXMioSOjtalfk1XdhiY56cam5Q3XyPNSnne8xJUUbV ErMtun5L08cYYhWgS59Qj/Hu/c+1GQuEpURQHgcLOZyYBFsiK/abHE0F5wFhVlN6oYSH G3emhIvLIsFWc0t4vNrt6p35P5x6b/xDNFgdVLMrOHLlOgUAjHWUKd90ZlVJyzQy7DOe Fj9GtJqnROp/zltHzypP+B4OFrUBqSy6FvSUBWLt7kt9bwsi6rZ+NWfWpTb4AnULGFh6 OfR27TobFnu3SfQ2igiMedDi1GhDhWGhLB1q6w/uXN+cNb9C+h4I9lqASZN4lIox7V6b IQBA== 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; bh=sCJ8UQ8bltaJu3pSGrfKmiXdjjKmZzFd3nDew7MN8/A=; b=seWc8jhwnwWktCL50bh9iizyUJMgY4lsdefEL5crapHy2cVhciEbVG8Cae8nDWeAWv rvrs472+l0FUPc0FZOi1vk/oNsXGx/WI+zpP1VIvVFDeQxuNBMXdQd2uatFoovUlrY7W uwH40f8E6EST8A2HiLmJqhi6PUDAg9xBsZLjNtBPXI3Org/AtaJ66lZVNYFTebJkM8I3 VvT4QpgbWG4W/Pvt9+BTcz5D+9nNMLpuWi1/n1E2PGR2agKQZVgj9xF8M7umm/N+PzIf Xps/i5f6wrxXfj7M7hO1tL02T6uWaxRBav7jpv4G9svKuC/KDsAhPgkanzqAtc4xxHJM NkAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CPQ6FYtu; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e188si6904749ywa.66.2019.02.26.06.17.10 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Feb 2019 06:17:10 -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=fail header.i=@linaro.org header.s=google header.b=CPQ6FYtu; 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" Received: from localhost ([127.0.0.1]:56128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydXi-0002ra-7r for patch@linaro.org; Tue, 26 Feb 2019 09:17:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydSs-0008Av-RZ for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gydSo-0003KD-9m for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:10 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:32835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gydSo-0003Ir-1s for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:06 -0500 Received: by mail-wr1-x42a.google.com with SMTP id i12so14149851wrw.0 for ; Tue, 26 Feb 2019 06:12:05 -0800 (PST) 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=sCJ8UQ8bltaJu3pSGrfKmiXdjjKmZzFd3nDew7MN8/A=; b=CPQ6FYtu+mWpjh2qTy88wgIEq4gKctElCPCyPiUX8mwOqwRSeU1GLIgRGAGhIP+Fs/ pJbGoiUmGZkzbZELlxvtz8MNxVOFy0JSr4wfAdbQF8+Q18U9C8WRjAsCmIBJCxTAQ4+C RsU6WdAjErkr9foBL+bDC4s9xPEgqRa7hu6EEt3aZQ8HGdcO2f6CgW22V5AQS3o5y/sh 4aEWhB6hr97oG6XZJLY5okOiJRFkXZDALcCu3ZcInu/Q+1fdU714XGZvPELqK7sii9fW GhBOL8/7Ii4rnnG6QvVCoSYP/93K7ElVgnu1I+yJ91RKRKn58ryu+mkX/+v/Iv5pNu9l FDRw== 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=sCJ8UQ8bltaJu3pSGrfKmiXdjjKmZzFd3nDew7MN8/A=; b=E0ZdIX+2ViL/Big9gFmzl3d2RrUNg28miZ5OZOX0PdhDX8f355SfcqFT8qxhGJ9Nn+ uRmxNzrQmu6GzYmGWnf+9pegisUksJzuu2cjLafgkJMdCwFFbKmMsOHLgygSd3afBKdK 6kfPT4ccTRNdvlM3thEbp/spWEQvgCB0fObWGfEaJZutV0oLbIS11akaBpZUW+NVet45 00IdvCGsC6cfKsY4+k0BZ93kbjYKH1Bb4BP4oNjlM4BmywkuZUbvrRDYl7kV19g9J4ie TFsQjfy+Fl33dQ6VvSZdEFZLJMqpRDetfjrVnAHhsL4URMP+z5yZSycfgT6nd9KXRUZX LH8w== X-Gm-Message-State: AHQUAubgb9I8J/ItinTf9puGhW29VgVJzwzdrtRX+zWae7t25CN16big c1r3yXKlIhDbtqtVpVr/hV7pVg== X-Received: by 2002:a5d:4149:: with SMTP id c9mr17249374wrq.58.1551190324928; Tue, 26 Feb 2019 06:12:04 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 132sm32284205wmd.27.2019.02.26.06.12.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 06:12:02 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E5E991FF83; Tue, 26 Feb 2019 14:12:01 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 14:11:56 +0000 Message-Id: <20190226141201.16999-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226141201.16999-1-alex.bennee@linaro.org> References: <20190226141201.16999-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:4864:20::42a Subject: [Qemu-devel] [PULL 2/7] softfloat: add float128_is_{normal, denormal} 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , qemu-devel@nongnu.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Needed on s390x, to test for the data class of a number. So it will gain soon a user. A number is considered normal if the exponent is neither 0 nor all 1's. That can be checked by adding 1 to the exponent, and comparing against >= 2 after dropping an eventual overflow into the sign bit. While at it, convert the other floatXX_is_normal functions to use a similar, less error prone calculation, as suggested by Richard H. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 38a5e99cf3..3ff5215b81 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -466,7 +466,7 @@ static inline int float32_is_zero_or_denormal(float32 a) static inline bool float32_is_normal(float32 a) { - return ((float32_val(a) + 0x00800000) & 0x7fffffff) >= 0x01000000; + return (((float32_val(a) >> 23) + 1) & 0xff) >= 2; } static inline bool float32_is_denormal(float32 a) @@ -622,7 +622,7 @@ static inline int float64_is_zero_or_denormal(float64 a) static inline bool float64_is_normal(float64 a) { - return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53; + return (((float64_val(a) >> 52) + 1) & 0x7ff) >= 2; } static inline bool float64_is_denormal(float64 a) @@ -940,6 +940,16 @@ static inline int float128_is_zero_or_denormal(float128 a) return (a.high & 0x7fff000000000000LL) == 0; } +static inline bool float128_is_normal(float128 a) +{ + return (((a.high >> 48) + 1) & 0x7fff) >= 2; +} + +static inline bool float128_is_denormal(float128 a) +{ + return float128_is_zero_or_denormal(a) && !float128_is_zero(a); +} + static inline int float128_is_any_nan(float128 a) { return ((a.high >> 48) & 0x7fff) == 0x7fff && From patchwork Tue Feb 26 14:11:57 2019 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: 159207 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3263983jad; Tue, 26 Feb 2019 06:14:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ8C4nLqEsdXie1qzV9DwfK8d20L4tv5goBywwBrbmAg7BnxPduHCr4kRSNOSZUClApGm89 X-Received: by 2002:a25:388f:: with SMTP id f137mr18664121yba.70.1551190484933; Tue, 26 Feb 2019 06:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551190484; cv=none; d=google.com; s=arc-20160816; b=DxJiPAiJCjEkg49YqU5JD0FzJFAIoPupglG23BCPix/GC4wyypEVgzVVvkiDT8EP45 9G2S3KxE8C45H/mWNV1j40tjwJOSZpTxo/bFkK9g0LNufvLSWfeYMUOebJBTmuI7SZgF 4bgTVqHfsDGM2nVu2ERwa+WnUzulS3zRTjWkRogf2QsGTbsaXcia2TaqnwUaLYi4oI9X zXY/DMJ1jIYlMvnPd0oG9qWmixm5odcn1esll4ZNDRTZryZ2vS2R1co3f026MmWgoAAO kiULE0YFxGrA6UyvJD+QbPGPHC6jopwrfr6N9vGQVPV6kneNnfTHuxt1Nhz6UfUyz22o sc4g== 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; bh=9PlaSEsDdPkM2ibDFgPhYrix17N8Teye9eXCeE4mukI=; b=Jwii3qp4p19Ax+VNR9uzh/BxXRqCcXDxCY2Np1hmflnK++l/DIQ5x36vVObS1o8sFk lTUXUr1XSkot2+KJGPdUuaUvkFYMsqXvM9BlC1pr2HZukqyEKl0k7/+YRBLR6JGCaob4 UNBIXwf6tjZ1gi20px9vldAhHnPUUuA89QHEexcneFQf+H8r4kY6PxY9wrX0QQnUR4o1 W74bPIl+QFpii9a9O8ntWA1FCFL3JfnQ6k0PlaWu7WvojtD3w/8SZHBeJYM8+FggRESw YgyA7i1AHqmq3JxBZBpPiiSVHzyvdyAn3anE6CU1OStuU18Ha1sTatUNWWcDGL9tajfP hMDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KI6VGb25; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y13si6901639ywg.153.2019.02.26.06.14.44 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Feb 2019 06:14:44 -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=fail header.i=@linaro.org header.s=google header.b=KI6VGb25; 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" Received: from localhost ([127.0.0.1]:56079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydVM-0000va-DV for patch@linaro.org; Tue, 26 Feb 2019 09:14:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydSv-0008Cw-4e for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gydSq-0003NP-Bg for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:13 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:34770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gydSq-0003Ma-4N for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:08 -0500 Received: by mail-wm1-x336.google.com with SMTP id o10so2236923wmc.1 for ; Tue, 26 Feb 2019 06:12:08 -0800 (PST) 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=9PlaSEsDdPkM2ibDFgPhYrix17N8Teye9eXCeE4mukI=; b=KI6VGb25oZs6Ei+YQ+49agKEaMf5QJuptqS5xHd4E/ve5516+FeuTLSOfhJ5i4v1ql LyrEbAfGv35iIIUD8IFs+8anntBE9nPO48i2W+qAd0wWRxRmqcf4L8eAH+kKyIcvEfeT KQxXZn6IpIwzOOf0uOPmeHc21BI9Dfsz2aTz0C+wMt1A4U332mk52orJItM5sM6THwcQ Y9rKIIAGC2u0kHrZq2Dn57JE7WfUddcMqSCUABE4xqEO3N48dkoh2QvHz3GpnyCRMnQ7 gRFIeUaRhrGdy/PNiD5vkfT1cqG3o18lGehK7X7DWxBgpKRMBjE53f7n7YuOmLD70SBv BapA== 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=9PlaSEsDdPkM2ibDFgPhYrix17N8Teye9eXCeE4mukI=; b=Vc6s//dlnO2RwTD4XqRr3/HcRt7cXHcTneXxZEB746GHYGVmnBM8yTl89gZQ3nIfp+ 0xSzHFiu8nxW+71Y0p/Vsobf7bQ3UqGE3BCS3TwZeQwpbhqKRx81/9fZ5NhAwVsdVA7e fSFgZeU5JEe0ydvqC/IxbNouY39EXY7pceho/knqWVmUBovsq9QpdzmNcaQc8ttriuoW 86atSEBsVKDFFQzYhaBEF0JLGeffrSFuZvBvfwUWrcaubZ6abfQOaLK3mVuv4MKEmzu5 R4/yo4VCDtgQqZ4hodi9ruusu6myDt6A3Ho8gWPocLa7jWmqStsC70Qanr6O5dqd1mpH qS6Q== X-Gm-Message-State: AHQUAua3G9mAqd7X2rYSFSrTiHJnzGwRK7T4keauRqW1acazEBXj36wT xzaSGJtMwwFu2GR5EJi/EdKZwA== X-Received: by 2002:a05:600c:224c:: with SMTP id a12mr2749091wmm.103.1551190326935; Tue, 26 Feb 2019 06:12:06 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id i74sm15961586wmg.48.2019.02.26.06.12.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 06:12:04 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F161A1FF86; Tue, 26 Feb 2019 14:12:01 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 14:11:57 +0000 Message-Id: <20190226141201.16999-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226141201.16999-1-alex.bennee@linaro.org> References: <20190226141201.16999-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:4864:20::336 Subject: [Qemu-devel] [PULL 3/7] softfloat: Implement float128_to_uint32 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , qemu-devel@nongnu.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Handling it just like float128_to_uint32_round_to_zero, that hopefully is free of bugs :) Documentation basically copied from float128_to_uint64 Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 9132d7a0b0..c69cd6b5d1 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -6792,6 +6792,35 @@ uint32_t float128_to_uint32_round_to_zero(float128 a, float_status *status) return res; } +/*---------------------------------------------------------------------------- +| Returns the result of converting the quadruple-precision floating-point value +| `a' to the 32-bit unsigned integer format. The conversion is +| performed according to the IEC/IEEE Standard for Binary Floating-Point +| Arithmetic---which means in particular that the conversion is rounded +| according to the current rounding mode. If `a' is a NaN, the largest +| positive integer is returned. If the conversion overflows, the +| largest unsigned integer is returned. If 'a' is negative, the value is +| rounded and zero is returned; negative values that do not round to zero +| will raise the inexact exception. +*----------------------------------------------------------------------------*/ + +uint32_t float128_to_uint32(float128 a, float_status *status) +{ + uint64_t v; + uint32_t res; + int old_exc_flags = get_float_exception_flags(status); + + v = float128_to_uint64(a, status); + if (v > 0xffffffff) { + res = 0xffffffff; + } else { + return v; + } + set_float_exception_flags(old_exc_flags, status); + float_raise(float_flag_invalid, status); + return res; +} + /*---------------------------------------------------------------------------- | Returns the result of converting the quadruple-precision floating-point | value `a' to the single-precision floating-point format. The conversion diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 3ff5215b81..3ff3fa5224 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -878,6 +878,7 @@ int64_t float128_to_int64(float128, float_status *status); int64_t float128_to_int64_round_to_zero(float128, float_status *status); uint64_t float128_to_uint64(float128, float_status *status); uint64_t float128_to_uint64_round_to_zero(float128, float_status *status); +uint32_t float128_to_uint32(float128, float_status *status); uint32_t float128_to_uint32_round_to_zero(float128, float_status *status); float32 float128_to_float32(float128, float_status *status); float64 float128_to_float64(float128, float_status *status); From patchwork Tue Feb 26 14:11:58 2019 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: 159210 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3269585jad; Tue, 26 Feb 2019 06:19:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IbZAK61HHBLeSquBQqhbl9nuO63alsAW9gvugRZvmMngHC3InKOSKSWq2ghAYtqUrercTfF X-Received: by 2002:a25:2084:: with SMTP id g126mr18188337ybg.313.1551190787478; Tue, 26 Feb 2019 06:19:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551190787; cv=none; d=google.com; s=arc-20160816; b=lz4CaDVeZ8vpSCJ2RuMPcgcKEnJgvL8wmwUldCdtUE6tDHFvp1GsjJgUGaS+S1Oq3V R/Pe/HZ0TGjIdjpQ1RiP5935/5b50Ztxsq5Ez0GNbRmvZrijXvds3E+ReJy4WGqsHeB5 0jiPW4pkg2b+XBZOUX0dtudWIuwDAFMfM7PlfV0ejxIe3WjSeXlXWeBi8ygwKddxx+x8 MpQPQn8oKmEOR8aDPO0S2DBn3HiFEeyKJrOI97iSUuxHWzYKqNmQypuk8dlIkT5YeyuZ Kvr02t+XbXU9IPrN7cH7fw/CgeXO5pUl2P3hRcD6BIrgK2PSHTxxi+ABt5Qs4eCN4Nuh Xlyw== 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; bh=TbKdv4o68uSSzGzZ00LGX0Gq1zuxtTdAgx8OH5pfQAc=; b=hsKd7GihU3Ae6sXyEme3k8Ia+ZGM8mx1tvQ5q65HzzFY1OhJF0RnxqYclSkAQOX0fi KI2SGSWXC6HspY/KDvwULaUAvQPMecNo0bRH0y5XEHUSTFFaX1csvEtE3fE7wFpZ5LX9 1MdL/b8RQR0Q2p3S6kwpiH+HVq/0JeiUp2UXuU10bvAIVxiApIEV/e/iyYcC1vbdCFHi J6ioObia/7wSJYjNQmqwp/NWzlzXlfxD1k9flcszxJplq4p6GhJmdY8ENpZIF1vXm1Gq X5Q1s1GjJAgq6LiO61RYFury7mnL/+6kOnnQTJMa2emiccvjxcJv713rYKPsBhVbI/5u dNLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=O0evoR4K; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r16si6580480ybg.437.2019.02.26.06.19.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Feb 2019 06:19:47 -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=fail header.i=@linaro.org header.s=google header.b=O0evoR4K; 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" Received: from localhost ([127.0.0.1]:56190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydaE-0004lU-TQ for patch@linaro.org; Tue, 26 Feb 2019 09:19:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydSu-0008CU-NZ for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gydSp-0003MC-38 for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:12 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:39130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gydSo-0003Jy-R0 for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:07 -0500 Received: by mail-wm1-x32e.google.com with SMTP id z84so2394805wmg.4 for ; Tue, 26 Feb 2019 06:12:06 -0800 (PST) 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=TbKdv4o68uSSzGzZ00LGX0Gq1zuxtTdAgx8OH5pfQAc=; b=O0evoR4KxgzvWu72tFnmnLpBr7zD9c38ixGvByGfMLmmraK9ZBzpZzA2d5fLYnOZuh A/HKjNpJeII5QlyZmhRzTX4gBiC3SGV6jWsNGOd9TBF/iO33iNuQ4V4p6JyxjFzDY5Jp DOf0Xx7Za9+1ENDIyt80xw1TWA+6HnNdox4Qp183/ymEolo1sE/yN2Ss7SaHJ42tRqzA 7DxlTcEquLv/S61v/etY1jbsoMPCmVI6FRNm+pNbU1Vcge/DWnlQXce3Nv+H3VsKl06q SpciCHZ9Sg1DxWfo1snNyZ/BPgqsYSLIPB8B+kybKRYl3weyFOSQmdBnrRy4mL+VpeDk imdA== 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=TbKdv4o68uSSzGzZ00LGX0Gq1zuxtTdAgx8OH5pfQAc=; b=KLr1GQ0MybxV2Yi4WcR8Bea0rasuzEdV6mdgqhv3vpGV5puDxHScoM1JGqRZnWH/Qa vXc2ymO4/Q3xl+FOtfrd9WNCK2VPKBn/ou4MXPScY7cjh6Rht4doXV/q2AuKcuW995pA BawUcgmAFVeYRBXpVC+XFw9R2oyMSjSMDuUsNOR+bCcAIOwzAiDp/GkzDpUENMBQKBN3 uqYjKPCErFbpc6ixN89q0K5JAuHrr0Dm09HhId1cNGFR7rx592QAgN8npGZxWDMRmC/U locTZ9aoh2QxpBfGFHNstvglbGwtWRw/4B5DN85JC4bcYxQIjWw1AkwYYX4zuR93MAeq F15w== X-Gm-Message-State: AHQUAuatxkBkhIwFEtbe+mXtuCYdKRKmz4ovwL97uPbrvwO9fgz2Ot8t G+0du1+d+LrBHOiSU8JUGiNG9Q== X-Received: by 2002:a1c:342:: with SMTP id 63mr2725019wmd.34.1551190325690; Tue, 26 Feb 2019 06:12:05 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g81sm15231189wmf.7.2019.02.26.06.12.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 06:12:04 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 08C241FF87; Tue, 26 Feb 2019 14:12:02 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 14:11:58 +0000 Message-Id: <20190226141201.16999-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226141201.16999-1-alex.bennee@linaro.org> References: <20190226141201.16999-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:4864:20::32e Subject: [Qemu-devel] [PULL 4/7] tests/fp: add wrapping for f128_to_ui32 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: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Needed to test: softfloat: Implement float128_to_uint32 Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson -- 2.20.1 diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c index 2a35ef601d..4114f346a9 100644 --- a/tests/fp/fp-test.c +++ b/tests/fp/fp-test.c @@ -622,7 +622,8 @@ static void do_testfloat(int op, int rmode, bool exact) test_ab_extF80_z_bool(true_ab_extF80M_z_bool, subj_ab_extF80M_z_bool); break; case F128_TO_UI32: - not_implemented(); + test_a_f128_z_ui32_rx(slow_f128M_to_ui32, qemu_f128M_to_ui32, rmode, + exact); break; case F128_TO_UI64: test_a_f128_z_ui64_rx(slow_f128M_to_ui64, qemu_f128M_to_ui64, rmode, diff --git a/tests/fp/wrap.inc.c b/tests/fp/wrap.inc.c index d3bf600cd0..0cbd20013e 100644 --- a/tests/fp/wrap.inc.c +++ b/tests/fp/wrap.inc.c @@ -367,6 +367,7 @@ WRAP_80_TO_INT_MINMAG(qemu_extF80M_to_i64_r_minMag, WRAP_128_TO_INT(qemu_f128M_to_i32, float128_to_int32, int_fast32_t) WRAP_128_TO_INT(qemu_f128M_to_i64, float128_to_int64, int_fast64_t) +WRAP_128_TO_INT(qemu_f128M_to_ui32, float128_to_uint32, uint_fast32_t) WRAP_128_TO_INT(qemu_f128M_to_ui64, float128_to_uint64, uint_fast64_t) #undef WRAP_128_TO_INT From patchwork Tue Feb 26 14:11:59 2019 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: 159212 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3272679jad; Tue, 26 Feb 2019 06:22:18 -0800 (PST) X-Google-Smtp-Source: AHgI3IbNGLeHYn3PP02qdHYOXy23Xfousxh0/bOPB3kMF/5FuyA9GMdbg/UE9he8LC0aQ2eRHwes X-Received: by 2002:a25:804e:: with SMTP id a14mr9536280ybn.424.1551190938579; Tue, 26 Feb 2019 06:22:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551190938; cv=none; d=google.com; s=arc-20160816; b=IRx83I6jINZkHy3fl6nL6CSAL/+Z4ZzuI4DNFUmvj8VkNqGwqsKg9agjWtQjmTwXoJ q/QTfjV12n9MmLKgxQCt9fcl9THORwbqZzEYqwE8gxH3tAEv+e4CU4STyBAaoXFJbVXi 0Bg+XbCXKb+coH6P2ridlI0H9ZMdJJxokeg/5C3dRRarfqyZ+ydDYSgPIMtramyxUn7B cCJG3PTF/AoLH4bcEKnLivNqA/h9jlMelkbkLEp8N1TelZ39da9Hlrcmbw75zf6i30ji 9bHlBcBnms56I/CctVrGrRpYd9zHXxGyOqk97xb8mzHLmih+aT9xneAFme3aQWIs0HOV wwmA== 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; bh=DIQQzZ5yI2N0UED541VTsiiHlY+9khJZNOpGHJJl6vk=; b=KT3aAZ2olMIOOOFcFxOET0Iiu4hcUuRt2gpKDeL7+lCokigNt5QxgduG2ersnq/cKW 1j6IEl4cOcQhD6+69H7mtRPcpM3efsT2j8r9vDaiFOnZS2AMz7V+E2r9Ort7dEaF4wYw Mi0eMwApFhx1zod5rrKgtMjC6W+3j95BQSx9ea2THxg8SRyx5R2o0VZamQR8H1O8w6C5 4LYlWnlUnZ2yp+KCtqy536iLPoSIb8eHumRAPh52jDv04GMw94gU/bE1GmLTWQuYf9lv PGpxcNcgoL9BoC7PfL0yaX74Wbpo3LA3KB0KMNOk9bShtq2BnI8Hpc6wBfu/38IEbj53 WILw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LczL43b3; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z62si7292395ywd.439.2019.02.26.06.22.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Feb 2019 06:22:18 -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=fail header.i=@linaro.org header.s=google header.b=LczL43b3; 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" Received: from localhost ([127.0.0.1]:56243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydcg-0006sK-1I for patch@linaro.org; Tue, 26 Feb 2019 09:22:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydSv-0008DI-FK for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gydSq-0003Nu-VE for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:13 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:36555) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gydSq-0003NB-P2 for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:08 -0500 Received: by mail-wr1-x42b.google.com with SMTP id o17so14133609wrw.3 for ; Tue, 26 Feb 2019 06:12:08 -0800 (PST) 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=DIQQzZ5yI2N0UED541VTsiiHlY+9khJZNOpGHJJl6vk=; b=LczL43b3b7/9MInrvbo48m6o1jNGgk1kFeCYyVkBSK2b1qUL7eTdfNOyB1UCsi6xPa Q1R9GARc+M3PShMfN5GNQ4fyctvS55hcCgPjvcU9InSknB7mSK1Ukqn7yeJOPtNMK7oq +P/GXP2yRyMzziaDgwOyKALjTREMaJ6bkTN4jmI1lD4R7TtUcnEYnI4L+P/fVlMer+a9 xFffiqTNz4ouAuBf7umHqELO8xdpkvr5VM9o8y6i01If7le03DNlN1vKTDfyZG9FQV7B V5DYvcvDt8IljbEbfDHLE7XkuOxL2C0fCrz7PuHQm6IzZr7fRf8gQ1jdv0E2vMNQTZ8L GgGQ== 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=DIQQzZ5yI2N0UED541VTsiiHlY+9khJZNOpGHJJl6vk=; b=CUt4JAUMHTqhPCWnG0XK9dftoP5pxU/Yasny/nR0vrOCMuQv9iUN+HrpPAj8aFKw6r 8NHKDQwO2DQSEdOCCKsfjk+wnV6SQZzD94LHCh/wuJ6PWjVLjcqoqKVad/3Y7qI6uRtV UqHsalj7bSiUmXNFSm6Bj93OaKlj6SqYBfKIX2/E0/hjaXE7xFbA7xg5zL4Cf1mF3zlv enwogLheeFo42zd/I5hQB1KOJa1bLBosZVEc8YvE2CeBEQhj+ePIuAnfQZPFLblQ4Jtm 24TV9sIuWO00ImHU3Bkw+j6KCaNjCMIbqJM75dcL/C+WyXa8o4VyAftr8fVojHMl0b2M 9htg== X-Gm-Message-State: AHQUAuaS34yhUwMWrWng/o2+8rfXn5mBNDi2iD9aa6GZFb0sxSXPCR9M NZfTqlEEsGYtfbGGDlyd8vXEcA== X-Received: by 2002:adf:e80c:: with SMTP id o12mr15994507wrm.114.1551190327704; Tue, 26 Feb 2019 06:12:07 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b3sm24311288wme.27.2019.02.26.06.12.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 06:12:04 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 152C21FF88; Tue, 26 Feb 2019 14:12:02 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 14:11:59 +0000 Message-Id: <20190226141201.16999-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226141201.16999-1-alex.bennee@linaro.org> References: <20190226141201.16999-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:4864:20::42b Subject: [Qemu-devel] [PULL 5/7] tests/fp: enable f128_to_ui[32/64] tests in float-to-uint 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: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We've just added f128_to_ui32 and we missed out the f128_to_ui64 tests last time. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson -- 2.20.1 diff --git a/tests/Makefile.include b/tests/Makefile.include index 3741f8f6dd..060f765b0e 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -909,8 +909,7 @@ test-softfloat = $(call quiet-command, \ # Conversion Routines: # FIXME: i32_to_extF80 (broken), i64_to_extF80 (broken) -# ui32_to_f128 (not implemented), f128_to_ui32 (not implemented) -# extF80_roundToInt (broken) +# ui32_to_f128 (not implemented), extF80_roundToInt (broken) # check-softfloat-conv: $(FP_TEST_BIN) $(call test-softfloat, \ @@ -939,9 +938,11 @@ check-softfloat-conv: $(FP_TEST_BIN) f16_to_ui32 f16_to_ui32_r_minMag \ f32_to_ui32 f32_to_ui32_r_minMag \ f64_to_ui32 f64_to_ui32_r_minMag \ + f128_to_ui32 f128_to_ui32_r_minMag \ f16_to_ui64 f16_to_ui64_r_minMag \ f32_to_ui64 f32_to_ui64_r_minMag \ - f64_to_ui64 f64_to_ui64_r_minMag, \ + f64_to_ui64 f64_to_ui64_r_minMag \ + f128_to_ui64 f128_to_ui64_r_minMag, \ float-to-uint) $(call test-softfloat, \ f16_roundToInt f32_roundToInt \ From patchwork Tue Feb 26 14:12:00 2019 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: 159208 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3264374jad; Tue, 26 Feb 2019 06:15:05 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib4r0ExAqzs5t04yGzV6kc4MUCRasbMi3/kXXNEjWT+oKWZ16P1Mmoad1XuvVUyOJPPskIt X-Received: by 2002:a81:67c1:: with SMTP id b184mr18700046ywc.39.1551190505446; Tue, 26 Feb 2019 06:15:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551190505; cv=none; d=google.com; s=arc-20160816; b=zKCzLhIfj9HP4qbxZQOA2LbiBK8TKh3BOZq8+x23jWPZ34t6U5f/9JROrRJeGirqZ2 1GBinEoOQU7F6lpFWN+0NXK62Wlww8nRTVWD0ooUSbEOX3fJV86U7H/aYeleaXAZZPAl /228Be08zNaXbJPSrTHxuFh73K8aSibKmOUOZXoak6uc/6wiWpXi1HtUsOHqpJMX1xH0 HFkiVKheDy3lQ6PT4kQw8CB7CfddZ/JkKA8BApf68k9SNYhm0Bs701Znp5hAf6Ng4mmQ MLItN6v7wdZ+BsIFnhvEcnw53HYEmJFATXK4UYU4fsE+fyv7CgV1dQjf6NRbVznbXY8a hAsQ== 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; bh=1Q0k9QQTnRWHqnwq52Tx8dR/n33a7rMpg27Spk2nK1k=; b=K4ryv0Gtqk8euXWTK5EBIaFsCf3iLOAksQ9PrjaWh7L8XV2UcyQYgy5seojngaiO1x wZUwx83p8AF5NJzgrjeZdr1jmkWRL63yK1W5kLwT/tmlpaGmWTuZm7u26DIQY5T8Q7V0 UtkgNmVINkkNpnOpQeOg5XQ3zHGm/QyXK4KkdGz+19PCypZuuTAwHV1pWQGiuQjqWq8q PnwPO267rFq/0i4F5x3zX2zZZCvGsssl8UNX6lp+8yk+M3/TmFtoLcdveUMrgZZDcIHR U82Vy9qQlU1CQEpjRY9t+hAUztguXaMkKaRhHF2AICjoyMlJOUqvdIQwxzoWxWcE7AJW 8h6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oSyFwQM8; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q203si7714242ybc.34.2019.02.26.06.15.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Feb 2019 06:15:05 -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=fail header.i=@linaro.org header.s=google header.b=oSyFwQM8; 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" Received: from localhost ([127.0.0.1]:56089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydVg-0001qV-Rd for patch@linaro.org; Tue, 26 Feb 2019 09:15:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydSt-0008BR-IS for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gydSs-0003Q9-7J for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:11 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:34144) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gydSr-0003Ou-Tp for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:10 -0500 Received: by mail-wr1-x433.google.com with SMTP id f14so14141764wrg.1 for ; Tue, 26 Feb 2019 06:12:09 -0800 (PST) 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=1Q0k9QQTnRWHqnwq52Tx8dR/n33a7rMpg27Spk2nK1k=; b=oSyFwQM8J5o4K54ohX+3mLUiSMZ6vG7Mjn6RYYlii9S1MyRuuYOp/4hY9Xq4bnqF2P CK7cyzpttGn61261LG0Z3HCf1oF29XKzAfLJlqVDYAxYyXRtMgPBUbx0Skgo6ZP+ZX3G SPmuIXrxhdxQKrP6zc8jtqy1hNquxQn/nnAAsBAZbnU8Pa+oiJHYQOY6VJ7pvuZ+WCwB e18zYzvezGBXeqi+1CXGtqCv2BA8nBO/x3KUKtbqB1LUIA1CGbpAarLVSZnMbE3WHne2 tmnceUgYqYS2AHKBLYhzeCVN1xX+CG9ABE/8eZW9y7whwZADKED211Q7b7MzxHwtFzHD UTFQ== 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=1Q0k9QQTnRWHqnwq52Tx8dR/n33a7rMpg27Spk2nK1k=; b=PE5+KAvgv6d7xj+H0wKBzwta8Ynv/wmzeutA+qiBs6Y7hn39TSeol++cXmmjQLzXon wCVsKlEN9rBjEByfo5VYJDfd+cHAxaTmh4E9jcucqbEgFa0hvxjG3oVphQgd6R2GyspM LhsUXPzdyuynhb4PXfMWzEaluwGp/8bBCu/4/C1vA2FfRq3qjqw4Eh+fi+VdOi8myEq5 p44WDyWFSnRSXcm2nTRn0yAKgN3w7J3Dl5p1tAgUoItLH3xzpjXDMXMu0v2D4RCEICbL sHpSZ9lvDbUz9+hHpaDgGZL8QKi5TkR2gAIskj1XDhKwD4A9kYpwD0KWQXii+o5rbQng vWWQ== X-Gm-Message-State: AHQUAuZ83A8dxGzhuiLgNCeyYKbaSeUa4uQvntY6WitCwKmb2k3HU9Bc Bn0MVmSXJ7Mzs3x5ZemTYXwavQ== X-Received: by 2002:adf:f391:: with SMTP id m17mr15693570wro.137.1551190328743; Tue, 26 Feb 2019 06:12:08 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c1sm12233156wmb.14.2019.02.26.06.12.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 06:12:04 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 21E421FF89; Tue, 26 Feb 2019 14:12:02 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 14:12:00 +0000 Message-Id: <20190226141201.16999-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226141201.16999-1-alex.bennee@linaro.org> References: <20190226141201.16999-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:4864:20::433 Subject: [Qemu-devel] [PULL 6/7] softfloat: Support float_round_to_odd more places 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , qemu-devel@nongnu.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Previously this was only supported for roundAndPackFloat64. New support in round_canonical, round_to_int, float128_round_to_int, roundAndPackFloat32, roundAndPackInt32, roundAndPackInt64, roundAndPackUint64. This does not include any of the floatx80 routines, as we do not have users for that rounding mode there. Signed-off-by: Richard Henderson Message-Id: <20190215170225.15537-1-richard.henderson@linaro.org> Tested-by: David Hildenbrand [AJB: add missing break] Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index c69cd6b5d1..4610738ab1 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -696,6 +696,7 @@ static FloatParts sf_canonicalize(FloatParts part, const FloatFmt *parm, static FloatParts round_canonical(FloatParts p, float_status *s, const FloatFmt *parm) { + const uint64_t frac_lsb = parm->frac_lsb; const uint64_t frac_lsbm1 = parm->frac_lsbm1; const uint64_t round_mask = parm->round_mask; const uint64_t roundeven_mask = parm->roundeven_mask; @@ -731,6 +732,10 @@ static FloatParts round_canonical(FloatParts p, float_status *s, inc = p.sign ? round_mask : 0; overflow_norm = !p.sign; break; + case float_round_to_odd: + overflow_norm = true; + inc = frac & frac_lsb ? 0 : round_mask; + break; default: g_assert_not_reached(); } @@ -778,9 +783,14 @@ static FloatParts round_canonical(FloatParts p, float_status *s, shift64RightJamming(frac, 1 - exp, &frac); if (frac & round_mask) { /* Need to recompute round-to-even. */ - if (s->float_rounding_mode == float_round_nearest_even) { + switch (s->float_rounding_mode) { + case float_round_nearest_even: inc = ((frac & roundeven_mask) != frac_lsbm1 ? frac_lsbm1 : 0); + break; + case float_round_to_odd: + inc = frac & frac_lsb ? 0 : round_mask; + break; } flags |= float_flag_inexact; frac += inc; @@ -1988,6 +1998,9 @@ static FloatParts round_to_int(FloatParts a, int rmode, case float_round_down: one = a.sign; break; + case float_round_to_odd: + one = true; + break; default: g_assert_not_reached(); } @@ -2021,6 +2034,9 @@ static FloatParts round_to_int(FloatParts a, int rmode, case float_round_down: inc = a.sign ? rnd_mask : 0; break; + case float_round_to_odd: + inc = a.frac & frac_lsb ? 0 : rnd_mask; + break; default: g_assert_not_reached(); } @@ -3314,6 +3330,9 @@ static int32_t roundAndPackInt32(flag zSign, uint64_t absZ, float_status *status case float_round_down: roundIncrement = zSign ? 0x7f : 0; break; + case float_round_to_odd: + roundIncrement = absZ & 0x80 ? 0 : 0x7f; + break; default: abort(); } @@ -3368,6 +3387,9 @@ static int64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, case float_round_down: increment = zSign && absZ1; break; + case float_round_to_odd: + increment = !(absZ0 & 1) && absZ1; + break; default: abort(); } @@ -3424,6 +3446,9 @@ static int64_t roundAndPackUint64(flag zSign, uint64_t absZ0, case float_round_down: increment = zSign && absZ1; break; + case float_round_to_odd: + increment = !(absZ0 & 1) && absZ1; + break; default: abort(); } @@ -3526,6 +3551,9 @@ static float32 roundAndPackFloat32(flag zSign, int zExp, uint32_t zSig, case float_round_down: roundIncrement = zSign ? 0x7f : 0; break; + case float_round_to_odd: + roundIncrement = zSig & 0x80 ? 0 : 0x7f; + break; default: abort(); break; @@ -3536,8 +3564,10 @@ static float32 roundAndPackFloat32(flag zSign, int zExp, uint32_t zSig, || ( ( zExp == 0xFD ) && ( (int32_t) ( zSig + roundIncrement ) < 0 ) ) ) { + bool overflow_to_inf = roundingMode != float_round_to_odd && + roundIncrement != 0; float_raise(float_flag_overflow | float_flag_inexact, status); - return packFloat32( zSign, 0xFF, - ( roundIncrement == 0 )); + return packFloat32(zSign, 0xFF, -!overflow_to_inf); } if ( zExp < 0 ) { if (status->flush_to_zero) { @@ -3555,6 +3585,13 @@ static float32 roundAndPackFloat32(flag zSign, int zExp, uint32_t zSig, if (isTiny && roundBits) { float_raise(float_flag_underflow, status); } + if (roundingMode == float_round_to_odd) { + /* + * For round-to-odd case, the roundIncrement depends on + * zSig which just changed. + */ + roundIncrement = zSig & 0x80 ? 0 : 0x7f; + } } } if (roundBits) { @@ -6987,6 +7024,15 @@ float128 float128_round_to_int(float128 a, float_status *status) add128(z.high, z.low, 0, roundBitsMask, &z.high, &z.low); } break; + case float_round_to_odd: + /* + * Note that if lastBitMask == 0, the last bit is the lsb + * of high, and roundBitsMask == -1. + */ + if ((lastBitMask ? z.low & lastBitMask : z.high & 1) == 0) { + add128(z.high, z.low, 0, roundBitsMask, &z.high, &z.low); + } + break; default: abort(); } @@ -6998,7 +7044,7 @@ float128 float128_round_to_int(float128 a, float_status *status) status->float_exception_flags |= float_flag_inexact; aSign = extractFloat128Sign( a ); switch (status->float_rounding_mode) { - case float_round_nearest_even: + case float_round_nearest_even: if ( ( aExp == 0x3FFE ) && ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) ) @@ -7011,14 +7057,17 @@ float128 float128_round_to_int(float128 a, float_status *status) return packFloat128(aSign, 0x3FFF, 0, 0); } break; - case float_round_down: + case float_round_down: return aSign ? packFloat128( 1, 0x3FFF, 0, 0 ) : packFloat128( 0, 0, 0, 0 ); - case float_round_up: + case float_round_up: return aSign ? packFloat128( 1, 0, 0, 0 ) : packFloat128( 0, 0x3FFF, 0, 0 ); + + case float_round_to_odd: + return packFloat128(aSign, 0x3FFF, 0, 0); } return packFloat128( aSign, 0, 0, 0 ); } @@ -7051,6 +7100,12 @@ float128 float128_round_to_int(float128 a, float_status *status) z.high += roundBitsMask; } break; + case float_round_to_odd: + if ((z.high & lastBitMask) == 0) { + z.high |= (a.low != 0); + z.high += roundBitsMask; + } + break; default: abort(); } diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c index 4114f346a9..7d0faf2b47 100644 --- a/tests/fp/fp-test.c +++ b/tests/fp/fp-test.c @@ -125,17 +125,42 @@ static void not_implemented(void) static bool blacklisted(unsigned op, int rmode) { - /* odd has only been implemented for a few 128-bit ops */ + /* odd has not been implemented for any 80-bit ops */ if (rmode == softfloat_round_odd) { switch (op) { - case F128_ADD: - case F128_SUB: - case F128_MUL: - case F128_DIV: - case F128_TO_F64: - case F128_SQRT: - return false; - default: + case EXTF80_TO_UI32: + case EXTF80_TO_UI64: + case EXTF80_TO_I32: + case EXTF80_TO_I64: + case EXTF80_TO_UI32_R_MINMAG: + case EXTF80_TO_UI64_R_MINMAG: + case EXTF80_TO_I32_R_MINMAG: + case EXTF80_TO_I64_R_MINMAG: + case EXTF80_TO_F16: + case EXTF80_TO_F32: + case EXTF80_TO_F64: + case EXTF80_TO_F128: + case EXTF80_ROUNDTOINT: + case EXTF80_ADD: + case EXTF80_SUB: + case EXTF80_MUL: + case EXTF80_DIV: + case EXTF80_REM: + case EXTF80_SQRT: + case EXTF80_EQ: + case EXTF80_LE: + case EXTF80_LT: + case EXTF80_EQ_SIGNALING: + case EXTF80_LE_QUIET: + case EXTF80_LT_QUIET: + case UI32_TO_EXTF80: + case UI64_TO_EXTF80: + case I32_TO_EXTF80: + case I64_TO_EXTF80: + case F16_TO_EXTF80: + case F32_TO_EXTF80: + case F64_TO_EXTF80: + case F128_TO_EXTF80: return true; } } From patchwork Tue Feb 26 14:12:01 2019 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: 159213 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3275014jad; Tue, 26 Feb 2019 06:24:29 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibzt72VtqmCnKNYiTxU5A3Ps+IhMAmoCjUJwXZ/afV90mtTf4PIUKI7qhbB+yyqQVLhxIBk X-Received: by 2002:a25:2552:: with SMTP id l79mr12317017ybl.299.1551191069751; Tue, 26 Feb 2019 06:24:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551191069; cv=none; d=google.com; s=arc-20160816; b=m7RHOT19raD4qvHDnE8bKIBGilBOEGZ9lzxlPEKe63uMopVDyF3EOfjj3KGPiS+caB wWn5oYjVYwOzkIsfrm1ihoA/bK9EMIO2ZJpjnelE4NqxrnLWmVYer2KonaD02aI9eUBF AWAvMZT5VSRm1PqjOXAjxGWbr3AtTgMJ1WvF2m2+nnzPvtabPuH4yBwVE9D/speyHMi7 vU7Ofb719k5r40PIdz10v4HalpXy0LzwNQqV9eDJpMWOtyA3c43EdBtInGG0ng7RHLmQ lWjDDAyXuTpPX102hYBvOEe68cH9Ycz+ji1p/FaLk4kJAOni5Bm/9g+KbHlwV0UWrBYb jB8Q== 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; bh=qe2kZXq7+BsdpDpRE+R5guw1kKnFhbyMtqHGKOaBfBY=; b=KMwQjfzH8o5c+SP8kt5NOcQL0ZrImtxdTq6ZcmNv2SZ/g+8rEkiNn77s/nZ61YiNEP DDmpo8Yij5ClBBkGaRxfp8uTI5lvutzTrXhR1iWeK84ZR4BJe+zPelerZmx9As5y6dn4 8JNd+bO2sTMu8y30ifnI0b8iiXXFDTWUa2cPwmm0tDMdNeXw8z54/LmKjiYh4o79Cu3U 0Ghw4kJIsl3qjPAjxNXZedZk6idU0VBGb1sq/wazgw7kxbTpmkWFXkBmKlsSOrXcdI1P hOX4llb1S8VZ+Je7XAhYuaS3gEAN9wx+I6IXe49nLATGTUztgMVIA7qlJhUapnKkZOaZ 2pRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CR8iK4V+; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t6si6618113ybl.365.2019.02.26.06.24.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Feb 2019 06:24:29 -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=fail header.i=@linaro.org header.s=google header.b=CR8iK4V+; 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" Received: from localhost ([127.0.0.1]:56270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyden-0000G5-90 for patch@linaro.org; Tue, 26 Feb 2019 09:24:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gydSu-0008C4-8n for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gydSt-0003Rc-B0 for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:12 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:52641) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gydSt-0003QP-4c for qemu-devel@nongnu.org; Tue, 26 Feb 2019 09:12:11 -0500 Received: by mail-wm1-x336.google.com with SMTP id m1so2569861wml.2 for ; Tue, 26 Feb 2019 06:12:11 -0800 (PST) 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=qe2kZXq7+BsdpDpRE+R5guw1kKnFhbyMtqHGKOaBfBY=; b=CR8iK4V+6rf827+nBuXIMQwwXMUieTytFT/nlp4ekVFx+RuXZfY5CFc5IqpV64terz A5Y3AySLvvQ7lt0EFMDjbVg/yBc/cLGz5fLmak5oqGZ2ksth1JcRl4yrL8290/a+nqFF ILDsPvm9559hftotD5/Gxthv01xGBGzu1Gfwke3gN85Ty/PyhW3OVsJ+kCEio95wIuCj Imud/fir//LyGJQ9bWhwlp5f4/Krjf9GFOxKP37v5/2HZwqwpZIn4apfDvvIdgos5A8c 7lSuJaKuNhL4OQtfrYALCV67fg+bl7uiEEWt4fK05JYu2pQQS4Qsr57tW4oeZ79UJ8+y Iigg== 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=qe2kZXq7+BsdpDpRE+R5guw1kKnFhbyMtqHGKOaBfBY=; b=uE0N5iPAXd1gZYlK4+JbE8nrvj7jKetBkI3k+eejknzmml47VFxHDqm7BvdD7O1wDb m485uzD5iwtjcAcT+7sQMYOjj9CEf8n7uF4JHQmQoiQOJIEgnd/lZEiOJ2IT+R1jqH0G YxqwH9Ee2irwA8FIUTRBTpADJyuIEi153EmleEGHxrYqa75A8I6nFZZ7TNalzhdlJxqR lP3tYkJEyvUZEFpdOS0u9sqEjmT96qx/cjb2f7+0KqG12fB1yTP++1AcdFB+5Chr/hDq fBJRM93iYZJg+ZBNOV7SyAmvRtpvUsizAOXaOPgxFDmu3jsNLjXUjQ0z0KYy9dpPuVbD 1SCQ== X-Gm-Message-State: AHQUAubRMbd83JiXRzuyBQYV7E4D1u7sH7QRv6+tLc0mD98lkjdvq+EM Lpbn7wmOeHo4ruaP13dpVjN7OA== X-Received: by 2002:a1c:8088:: with SMTP id b130mr2739730wmd.96.1551190330080; Tue, 26 Feb 2019 06:12:10 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id n3sm10594689wrs.10.2019.02.26.06.12.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 06:12:07 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2E5111FF8A; Tue, 26 Feb 2019 14:12:02 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 14:12:01 +0000 Message-Id: <20190226141201.16999-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226141201.16999-1-alex.bennee@linaro.org> References: <20190226141201.16999-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:4864:20::336 Subject: [Qemu-devel] [PULL 7/7] tests/Makefile.include: test all rounding modes of softfloat 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: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We missed a bug in a recent patch as we were not testing all the rounding modes for all operations. However enabling all rounding modes for mulAdd does slow down the already slowest test and doesn't really buy us much additional coverage so lets allow the default test flags to be overridden. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson -- 2.20.1 diff --git a/tests/Makefile.include b/tests/Makefile.include index 060f765b0e..f260014f02 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -898,12 +898,12 @@ $(FP_TEST_BIN): # The full test suite can take a bit of time, default to a quick run # "-l 2 -r all" can take more than a day for some operations and is best # run manually -FP_TL=-l 1 +FP_TL=-l 1 -r all -# $1 = tests, $2 = description +# $1 = tests, $2 = description, $3 = test flags test-softfloat = $(call quiet-command, \ cd $(BUILD_DIR)/tests/fp && \ - ./fp-test -s $(FP_TL) $1 > $2.out 2>&1 || \ + ./fp-test -s $(if $3,$3,$(FP_TL)) $1 > $2.out 2>&1 || \ (cat $2.out && exit 1;), \ "FLOAT TEST", $2) @@ -984,7 +984,7 @@ check-softfloat-compare: $(SF_COMPARE_RULES) check-softfloat-mulAdd: $(FP_TEST_BIN) $(call test-softfloat, \ f16_mulAdd f32_mulAdd f64_mulAdd f128_mulAdd, \ - mulAdd) + mulAdd,-l 1) # FIXME: extF80_rem (broken) check-softfloat-rem: $(FP_TEST_BIN)