From patchwork Fri Dec 14 13:54:38 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: 153849 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2107919ljp; Fri, 14 Dec 2018 06:05:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/UGzAlUDa4sh4VT5EAnWSfeqElOfGbrHCBc3fpXVM89uxJPWEJDgmcGoglILTa8nzyLrfHL X-Received: by 2002:a0c:9144:: with SMTP id q62mr2817273qvq.87.1544796331679; Fri, 14 Dec 2018 06:05:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796331; cv=none; d=google.com; s=arc-20160816; b=lO2LJy8bgLIrrGpO/l2VtYOkg28A4jEM1VyYbXaqa0d6IHqgcOR4Ajp/e2ASku9Giv QHFu50VYzHafCtXpmcrgiY9Q97jkJzJMQjAB/64Nb73Ut8d40FI/eJf5L+rrW98ZjcgU n9QZBKdsk7znzoN7f1jYCJp86pi2OBRHGi73+JLltvkLDqBk8NPep4PlTe9Rurg9BAjB 6oqyHYC8fLsQT4/gLV/Gp4Fn5eInMU2r3xnitHxtBY0C7dpzfwnrR+3PTZCvDhmnXt8o VfvPT6uvTotn7abcm+1dx1M31oAvF9EpX1zRz4LhWk4J5WJjwRWOhxLveVp1hPJijTXl JiKA== 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=Y6OUNTZwqV0o9uI18myQgIl/0VGTb9eXHSxrqd4Rl94=; b=DQA3HK9ewUkWhq/3OfsItyDF7sLOC2i5zsfdDPAOyLp0B4h9cZTfw4bJFrhc6jfztt ff7cO6L/buVKENgCjUjK1zx/s2zqU5dZAE3aUHW0uqvpmdvHq56CWTR0R+j4a3gxgwx6 zK4EswwZxclcMHRmp5J29j9EUeY7Qnt8QTlF3VlMmfp+VufxccCNB8KE1U75dVcBN6wc HjvitAhTn0f5gPOyxxy8/kbDnieIs7OsfkMXGRZ7cFYo7uKbqF8CblbJ4R6/+etqhbHz coUz0sslO+UWS4XQn9TCI+ZsOEYRGlZaNHsB4qlsJVfLXhb9JZcEBmIIdPzg3v+K1DG/ TUuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JhGTzIXx; 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 y17si2781448qvr.23.2018.12.14.06.05.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:05:31 -0800 (PST) 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=JhGTzIXx; 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]:33704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo5r-0002Pf-49 for patch@linaro.org; Fri, 14 Dec 2018 09:05:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvg-0008Kw-DA for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvc-0001u9-Vs for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:00 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:40395) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvc-0001si-Lz for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:54:56 -0500 Received: by mail-wr1-x434.google.com with SMTP id p4so5509349wrt.7 for ; Fri, 14 Dec 2018 05:54:56 -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=Y6OUNTZwqV0o9uI18myQgIl/0VGTb9eXHSxrqd4Rl94=; b=JhGTzIXxldDn9sONW4AlC930h2oXMj3+4RH4htmZfmKc9YYs/zH3LPyHW+ZrPPym1n Pm4KSiWCcvlwzAsguYLL/E3nB2kRwtQqtfswMooKf1dCCncaImvd6MmO6t2SzlNZVUxq RFoy2+lPmiTg2tOM5ZAbc0Evh8rQyPTp9WoGQ= 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=Y6OUNTZwqV0o9uI18myQgIl/0VGTb9eXHSxrqd4Rl94=; b=Jmzu06XGgLQp4SKB+rSSzvunJe1s5f+FbTufmvCFo6/1ZUVPpofcgBoPQXNPKoXzWc qen5rTQQLsCYiYVp58++vHysyM6H0JdbWTddFH2jLF1SGumvhFoNewCr/bB3YadOMo2d X7z40/HWl0W3ANuGLDNtenQoqrco8C7Gx/tTRuVmLKVemT4n7XbJEpWn1ae534KfsDco aCaTvlbY6LC1Ygq/fTb6YqSHd4lO27vz3J72/HmJn4yxt080UCb+QMglCdRUSxFWOfZK 2DdRae75by50W5J+F0sG2ct14DCMygjGyNEyS5tdD8e/eRv60RqjxEuIhGO/GFFR1UD5 5nXw== X-Gm-Message-State: AA+aEWYW0MkJKNjawY7Eng99WUt+5ctmhN5XO1gpYX6zSpGQ8mQ72ovb fS5cqGfhW8W3wxMuOKgs+UMsDQ== X-Received: by 2002:adf:84e4:: with SMTP id 91mr2666307wrg.237.1544795695281; Fri, 14 Dec 2018 05:54:55 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x15sm5893343wrs.27.2018.12.14.05.54.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:53 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 18B273E0287; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:38 +0000 Message-Id: <20181214135452.25936-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::434 Subject: [Qemu-devel] [PULL 01/15] contrib: add a basic gitdm config 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?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is a QEMU specific version of a gitdm config for generating reports on the contributor base of the project. I've added enough group maps and domain aliases to ensure the current top ten is as reflective as it can be. As of this commit running: git log --numstat --since "Last Year" | gitdm -n -l 10 Reports: Top changeset contributors by employer Red Hat 3172 (44.3%) Linaro 1153 (16.1%) (None) 549 (7.7%) IBM 348 (4.9%) Academics (various) 170 (2.4%) Virtuozzo 168 (2.3%) Wave Computing 118 (1.6%) Xilinx 102 (1.4%) Igalia 93 (1.3%) Cadence Design Systems 88 (1.2%) Top lines changed by employer Red Hat 144092 (28.1%) Cadence Design Systems 126554 (24.6%) Linaro 77480 (15.1%) Wave Computing 33134 (6.5%) SiFive 14392 (2.8%) IBM 12219 (2.4%) (None) 11948 (2.3%) Academics (various) 10447 (2.0%) Virtuozzo 10445 (2.0%) CodeWeavers 9179 (1.8%) Signed-off-by: Alex Bennée Reviewed-by: Daniel P. Berrangé Reviewed-by: Markus Armbruster Reviewed-by: Aleksandar Markovic -- 2.17.1 diff --git a/contrib/gitdm/aliases b/contrib/gitdm/aliases new file mode 100644 index 0000000000..07fd3391a5 --- /dev/null +++ b/contrib/gitdm/aliases @@ -0,0 +1,27 @@ +# +# This is the email aliases file, mapping secondary addresses +# onto a single, canonical address. Duplicates some info from .mailmap +# + +# weird commits +balrog@c046a42c-6fe2-441c-8c8c-71466251a162 balrogg@gmail.com +aliguori@c046a42c-6fe2-441c-8c8c-71466251a162 anthony@codemonkey.ws +aurel32@c046a42c-6fe2-441c-8c8c-71466251a162 aurelien@aurel32.net +blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162 blauwirbel@gmail.com +edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162 edgar.iglesias@gmail.com +bellard@c046a42c-6fe2-441c-8c8c-71466251a162 fabrice@bellard.org +j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162 l_indien@magic.fr +pbrook@c046a42c-6fe2-441c-8c8c-71466251a162 paul@codesourcery.com +ths@c046a42c-6fe2-441c-8c8c-71466251a162 ths@networkno.de +malc@c046a42c-6fe2-441c-8c8c-71466251a162 av1474@comtv.ru + +# There is also a: +# (no author) <(no author)@c046a42c-6fe2-441c-8c8c-71466251a162> +# for the cvs2svn initialization commit e63c3dc74bf. + +# Next, translate a few commits where mailman rewrote the From: line due +# to strict SPF, although we prefer to avoid adding more entries like that. +"Ed Swierk via Qemu-devel" eswierk@skyportsystems.com +"Ian McKellar via Qemu-devel" ianloic@google.com +"Julia Suvorova via Qemu-devel" jusual@mail.ru +"Justin Terry (VM) via Qemu-devel" juterry@microsoft.com diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map new file mode 100644 index 0000000000..8cbbcfe93d --- /dev/null +++ b/contrib/gitdm/domain-map @@ -0,0 +1,19 @@ +# +# QEMU gitdm domain-map +# +# This maps email domains to nice easy to read company names +# + +amd.com AMD +greensocs.com GreenSocs +ibm.com IBM +igalia.com Igalia +linaro.org Linaro +oracle.com Oracle +redhat.com Red Hat +siemens.com Siemens +sifive.com SiFive +suse.de SUSE +virtuozzo.com Virtuozzo +wdc.com Western Digital +xilinx.com Xilinx diff --git a/contrib/gitdm/filetypes.txt b/contrib/gitdm/filetypes.txt new file mode 100644 index 0000000000..15d6f803b9 --- /dev/null +++ b/contrib/gitdm/filetypes.txt @@ -0,0 +1,146 @@ +# -*- coding:utf-8 -*- +# Copyright (C) 2006 Libresoft +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Authors : Gregorio Robles +# Authors : Germán Póo-Caamaño +# +# This QEMU version is a cut-down version of what originally shipped +# in the gitdm sample-config directory. +# +# This file contains associations parameters regarding filetypes +# (documentation, develompent, multimedia, images...) +# +# format: +# filetype [] +# +# Order: +# The list should keep an order, so filetypes can be counted properly. +# ie. we want ltmain.sh -> 'build' instead of 'code'. +# +# If there is an filetype which is not in order but has values, it will +# be added at the end. +# +order build,tests,code,documentation,devel-doc,blobs + +# +# +# Code files (headers and the like included +# (most common languages first +# +filetype code \.c$ # C +filetype code \.inc.c$ # C +filetype code \.C$ # C++ +filetype code \.cpp$ # C++ +filetype code \.c\+\+$ # C++ +filetype code \.cxx$ # C++ +filetype code \.cc$ # C++ +filetype code \.h$ # C or C++ header +filetype code \.hh$ # C++ header +filetype code \.hpp$ # C++ header +filetype code \.hxx$ # C++ header +filetype code \.sh$ # Shell +filetype code \.pl$ # Perl +filetype code \.py$ # Python +filetype code \.s$ # Assembly +filetype code \.S$ # Assembly +filetype code \.asm$ # Assembly +filetype code \.awk$ # awk +filetype code ^common$ # script fragements +filetype code ^common.*$ # script fragements +filetype code (qom|qmp)-\w+$ # python script fragments + +# +# Interface/api files +# +filetype interface \.json$ # json +filetype interface \.hx$ # documented options + +# +# Test related blobs (unfortunately we can't filter out test code) +# +filetype tests \.hex$ +filetype tests \d{2,3}$ # test data 00-999 +filetype tests ^[A-Z]{4}$ # ACPI test data +filetype tests ^[A-Z]{4}\.*$ # ACPI test data +filetype tests \.out$ +filetype tests \.out\.nocache$ +filetype tests \.err$ +filetype tests \.exit$ # bad-if-FOO.exit etc +filetype tests \.decode$ +filetype tests \.yml$ # travis/shippable config + +# +# Development documentation files (for hacking generally) +# +filetype devel-doc ^readme.*$ +filetype devel-doc ^changelog.* +filetype devel-doc ^hacking.*$ +filetype devel-doc ^licen(s|c)e.*$ +filetype devel-doc ^copying.*$ +filetype devel-doc ^MAINTAINERS$ +filetype devel-doc ^BSD-2-Clause$ +filetype devel-doc ^BSD-3-Clause$ +filetype devel-doc ^GPL-2.0$ +filetype devel-doc \.txt$ +filetype devel-doc \.rst$ +filetype devel-doc \.texi$ +filetype devel-doc \.pod$ + +# +# Building, compiling, and configuration admin files +# +filetype build configure.*$ +filetype build Makefile$ +filetype build Makefile\.*$ +filetype build config$ +filetype build conf$ +filetype build \.cfg$ +filetype build \.mk$ +filetype build \.mak$ +filetype build \.docker$ +filetype build \.pre$ +filetype build ^.gitignore$ +filetype build ^.gitmodules$ +filetype build ^.gitpublish$ +filetype build ^.mailmap$ +filetype build ^.dir-locals.el$ +filetype build ^.editorconfig$ +filetype build ^.exrc$ +filetype build ^.gdbinit$ +filetype build \.cocci$ # Coccinelle semantic patches + +# +# Misc blobs +# +filetype blobs \.bin$ +filetype blobs \.dtb$ +filetype blobs \.dts$ +filetype blobs \.rom$ +filetype blobs \.img$ +filetype blobs \.ndrv$ +filetype blobs \.bmp$ +filetype blobs \.svg$ +filetype blobs ^pi_10.com$ + + +# +# Documentation files +# +filetype documentation \.html$ +filetype documentation \.txt$ +filetype documentation \.texi$ +filetype documentation \.po$ # translation files diff --git a/contrib/gitdm/group-map-cadence b/contrib/gitdm/group-map-cadence new file mode 100644 index 0000000000..ab97dd2fc3 --- /dev/null +++ b/contrib/gitdm/group-map-cadence @@ -0,0 +1,3 @@ +# Cadence Design Systems + +jcmvbkbc@gmail.com diff --git a/contrib/gitdm/group-map-codeweavers b/contrib/gitdm/group-map-codeweavers new file mode 100644 index 0000000000..c4803489e2 --- /dev/null +++ b/contrib/gitdm/group-map-codeweavers @@ -0,0 +1 @@ +sergio.g.delreal@gmail.com diff --git a/contrib/gitdm/group-map-ibm b/contrib/gitdm/group-map-ibm new file mode 100644 index 0000000000..b66db5f4a8 --- /dev/null +++ b/contrib/gitdm/group-map-ibm @@ -0,0 +1,6 @@ +# +# Some IBM contributors submit via another domain +# + +clg@kaod.org +groug@kaod.org diff --git a/contrib/gitdm/group-map-redhat b/contrib/gitdm/group-map-redhat new file mode 100644 index 0000000000..6d05c6b54f --- /dev/null +++ b/contrib/gitdm/group-map-redhat @@ -0,0 +1,7 @@ +# +# Red Hat contributors using non-corporate email +# + +david@gibson.dropbear.id.au +laurent@vivier.eu +pjp@fedoraproject.org diff --git a/contrib/gitdm/group-map-wavecomp b/contrib/gitdm/group-map-wavecomp new file mode 100644 index 0000000000..c571a52c65 --- /dev/null +++ b/contrib/gitdm/group-map-wavecomp @@ -0,0 +1,18 @@ +# +# Wave Computing acquired MIPS in June 2018. Also, from February 2013 +# to October 2017, MIPS was owned by Imagination Technologies. +# + +aleksandar.markovic@imgtec.com +aleksandar.markovic@mips.com +amarkovic@wavecomp.com +arikalo@wavecomp.com +dnikolic@wavecomp.com +james.hogan@mips.com +matthew.fortune@mips.com +paul.burton@imgtec.com +pburton@wavecomp.com +smarkovic@wavecomp.com +yongbok.kim@imgtec.com +yongbok.kim@mips.com +ysu@wavecomp.com diff --git a/gitdm.config b/gitdm.config new file mode 100644 index 0000000000..7472d4b8be --- /dev/null +++ b/gitdm.config @@ -0,0 +1,50 @@ +# +# This is the gitdm configuration file for QEMU. +# +# It is to be used with LWN's git dataminer tool for generating +# reports about development activity in the QEMU repo. The LWN gitdm +# tool can be found at: +# +# git://git.lwn.net/gitdm.git +# +# A run to generate a report for the last year of activity would be +# +# git log --numstat --since "Last Year" | gitdm -n -l 10 +# + +# EmailAliases lets us cope with developers who use more +# than one address or have changed addresses. This duplicates some of +# the information in the existing .mailmap but in a slightly different +# form. +# +EmailAliases contrib/gitdm/aliases + +# +# EmailMap does the main work of mapping addresses onto +# employers. +# +EmailMap contrib/gitdm/domain-map + +# +# Use GroupMap to map a file full of addresses to the +# same employer. This is used for people that don't post from easily +# identifiable corporate emails. +# + +GroupMap contrib/gitdm/group-map-redhat Red Hat +GroupMap contrib/gitdm/group-map-wavecomp Wave Computing +GroupMap contrib/gitdm/group-map-cadence Cadence Design Systems +GroupMap contrib/gitdm/group-map-codeweavers CodeWeavers +GroupMap contrib/gitdm/group-map-ibm IBM + +# Also group together our prolific individual contributors +# and those working under academic auspices +GroupMap contrib/gitdm/group-map-individuals (None) +GroupMap contrib/gitdm/group-map-academics Academics (various) + +# +# +# Use FileTypeMap to map a file types to file names using regular +# regular expressions. +# +FileTypeMap contrib/gitdm/filetypes.txt From patchwork Fri Dec 14 13:54:39 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: 153846 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2104849ljp; Fri, 14 Dec 2018 06:03:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/VDuKDpjRZEOSx1IIzzgWUgMDkVFYnnOPmZPY2eObN5nhzRQKNi16FlOKmUMrLqVRgIFiWt X-Received: by 2002:a37:2815:: with SMTP id o21mr2587593qkh.225.1544796196744; Fri, 14 Dec 2018 06:03:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796196; cv=none; d=google.com; s=arc-20160816; b=Ph6ZHsNXMM3wheqIQN8AB4PSoE2MUwdy9sZpW/sI9piHpD1VnqWwVHYPerTLY/5msk gj/kY0B2hJW7850gvB4xp6JZXa5TRKQK1QLgbzG8VqClLGWpPaSBmmh0ldwEG/ShTs7D G76By0F6dNajERvIrYdZq2TAeZ/h7N3JaDCjRUqvflLJyOEEUhmrBFAfGUYBtxfCfoCN Q+BHWZijPtYSd6/2tAlgKXvOz2q8KKqG/BVVB7VWTQzyI1uda7GIgxOqC+uOq+QUyD3P CK8m0RHBqrN0VcWXZh2nri/aBwyBuyc5JZ/mbHVO/LFauTGppjSf/kG37829xejku3Ad agQw== 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=AtvdBP9zwUp5TilEyK4H0PDCQTgNBzxl975bNrGKBa8=; b=SMc0z0HKgJhOOVtq0+eY2BGCr731XHo1ZGFb+6Y5uxIucYFEX0c5O+3TR9+/XMhd6j gq37CUzsJLhZhy6Q+SyDC+HAsItOdZTj9TQQ3kib21bKgoKwyLH2aGJcha22uqYrkCyd vHxkUZsMRTKJnlfyBJ5nS5hj/+YMIHVBPcZy7s1H/0ifRzJJ9tJ7iP/mlNsge+pQ7+wX tz6hWc5hsLjf9HjZZHH19LGfVq+LqXXyFz6Ngs31Occ3sn61Mgv6X3xE01onPehv2o3y 5YRY9ggd1hiNv/L14zeSQTUoHRnDcXTBReFdvhv2MHvPG9bEi8cRNMg4+5pwgSvYR8g0 i67Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="XY4hFg/Y"; 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 y18si1693193qto.339.2018.12.14.06.03.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:03:16 -0800 (PST) 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="XY4hFg/Y"; 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]:33691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo3g-0006Ws-88 for patch@linaro.org; Fri, 14 Dec 2018 09:03:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvg-0008Ks-Bn for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvc-0001sv-0T for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:00 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:40592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvb-0001s5-PP for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:54:55 -0500 Received: by mail-wm1-x331.google.com with SMTP id q26so5856834wmf.5 for ; Fri, 14 Dec 2018 05:54:55 -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=AtvdBP9zwUp5TilEyK4H0PDCQTgNBzxl975bNrGKBa8=; b=XY4hFg/YEUQbK1UykLoZmPw2HprOB7qaoDK+tFgXNNUJrKrgK6+qjGEzqVM89oGiE/ iNYSXtVNLSMJDJuxZU4KrIO7jnkZm1Df4iuoBdYlMyYA2eJNPVTtaHUKtL0r9ELJ5hnx 9FpKkrJA2F1cbO8MheDe9wNxsUUf6fo6BDjcg= 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=AtvdBP9zwUp5TilEyK4H0PDCQTgNBzxl975bNrGKBa8=; b=Smr0uBca8LMPOV8xN1sX3fxmaQEpZXnjm9P5jLQMckrTh2HmbcR0xlyvuC6zUWZRK4 1AOXobCtRsa+uEc6Gi+RLyBdz3AQZlUcKfB6uraRredqMKIh71JAtSBgbptd3cO9zhg6 9+GsdKj1OByRrhEBXUekKPimIk+ZZP4c3IbOmesGM6eHKhDRvwlN64GWz7ts8wKzuoyu /ORv3mIbeq116GNrfLjgTKy7IWmTUP6WvqDbm3zr9kxEmRigzgzdv2N9mx2R4WfLckQ2 5cj405nyi/SnwFpcNCWRjcw1KJYDcsghvk3+yg/olhD0nUYKe20kE0ACPP8Q/W+rPnc+ 5HEw== X-Gm-Message-State: AA+aEWaeZfk6skTQ5b44mCSL7s2acUuvst65eVLn+0H0fwMVaGy2y8Wh tP0QsyjShSxqH5ncdDcB9tOXLg== X-Received: by 2002:a1c:ae88:: with SMTP id x130mr3149803wme.91.1544795694606; Fri, 14 Dec 2018 05:54:54 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h17sm2954135wrt.59.2018.12.14.05.54.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:53 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2B14B3E035E; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:39 +0000 Message-Id: <20181214135452.25936-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::331 Subject: [Qemu-devel] [PULL 02/15] MAINTAINERS: update status of FPU emulation 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?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Given I've spent a fair amount of time around this code now I'm putting myself forward as a maintainer. Also given that the code has been extensively re-written and has testing and new incoming features it is probably more than just Odd Fixes. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson -- 2.17.1 diff --git a/MAINTAINERS b/MAINTAINERS index 83c127f0d6..d676c73f88 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -127,9 +127,11 @@ F: include/sysemu/cpus.h FPU emulation M: Aurelien Jarno M: Peter Maydell -S: Odd Fixes +M: Alex Bennée +S: Maintained F: fpu/ F: include/fpu/ +F: tests/fp/ Alpha M: Richard Henderson From patchwork Fri Dec 14 13:54:40 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: 153838 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2096250ljp; Fri, 14 Dec 2018 05:55:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/WU3UGgJNlOMltHoxFECHRW/nDCozLlOMqEOlaooH/mYosV7R1Hel9usUFXi+n+9rSBwfVs X-Received: by 2002:a0c:a086:: with SMTP id c6mr2697446qva.154.1544795729833; Fri, 14 Dec 2018 05:55:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544795729; cv=none; d=google.com; s=arc-20160816; b=LdZh6mKoFeJ0z/oNERPspLejFN96KAeMl4Y0SMcRwUAnYXrOvG5WCgdBUAT1ehdyKR G8Kw9rpe1vgJxyCa8wI+CiOYFYu9ag5yUUsajnbHC1G37hKpvoP4pofDZtoqWoSCob6T omRLCKwHzoHwR4cRCmo9/aCf6JdmXEUgDB0u4c1cDweBm8jPsAm1JVCMg7QvSax03OnG B8qiGerY6b+DM/YBneN7gzrHULq5PXPFoX/lj7GRu1SBSmS5kmb+kTmjFs6K53bf2YxE tSdHOVse+2vbl3DnZNvTlKnkE8HitI2f/DvAWRBt1/5hsONGy/GfBjmglpvk9aXlBjku U7ig== 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=IiPSkjJ5CpyJQD15Ltj0ZzJSbb/FiP/fKQ7Za7fFrVM=; b=JM1L2y+SL/5sOn7rTjpA3ughkIjOHWoRN9qKm3LTgf9GO7NCVIiEYhEFUmt3yMv3LO IZ34ApK4NcY9F2boYrJ8jr4XU4zpY8/d9h9BKtHUbK2c/jyRHBbAiZlE2ZsDb8WMgHOg /3VYR7eMnfqO0bqm44/0qV1LVGbSe2E2G8EvBGrZsZTxD7pPYLvclwLxiEvYhWPh/ilL /ZWjzLCInvdpmLGLZRVCCp80AM2qhtQvjV8VFbZzIHE8z5wJtN8I9d4vbiV/GX299Xxv 9ZC7unf314jLGlkyUPObhvi8q+q4MTm2UnlGruUCWBiSJJafUwxk2VqFWJ2U1Ac+XMGa vM1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UnJ8YHyz; 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 x195si2683615qka.224.2018.12.14.05.55.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 05:55:29 -0800 (PST) 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=UnJ8YHyz; 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]:33643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnw9-0008MO-6Z for patch@linaro.org; Fri, 14 Dec 2018 08:55:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvg-0008Kv-D8 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnve-0001vI-Ix for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:00 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:36222) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnve-0001ur-CL for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:54:58 -0500 Received: by mail-wr1-x436.google.com with SMTP id u4so4543847wrp.3 for ; Fri, 14 Dec 2018 05:54:57 -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=IiPSkjJ5CpyJQD15Ltj0ZzJSbb/FiP/fKQ7Za7fFrVM=; b=UnJ8YHyzIeHVf4UK+fCndRGIwcY5STcPby3ZDqIe55yzSeQVFI1hmZpP36OktZR8DS 66oZGchgkheAuLrY1lwFb7CQ7ivBaiAKmvbp7gxfGt0RyevU7qIQcg5hx83hiaCqyRro VEKwWKtrqAdC/EtX7UlIXNgglgoiKFVPesekE= 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=IiPSkjJ5CpyJQD15Ltj0ZzJSbb/FiP/fKQ7Za7fFrVM=; b=srV79NBP9cT9YFwaQvumGN2vkkLyAzEJOaS6jo/y04QqFv9irrMGHUlmL9x5KeJxUC DYsdpLb6h51ept0TgE3VhYz5AcdXjtKP4LTlmS3gRWzWcOCIJFEIjLfOf4hg+gVS8yO9 6TOhbQZarZLn9Yd3UbCWc6gEv4zEZPd/cxxAAvKhrvAWI6N43BnSjY+eSfzSAwrq4+Q6 DLIWrM4r8opQsSB9xItvt1GzFhimgT/o2CG6qgLywlSAIwlpWmGanAbXCW6yZz6O4QUC RUBOXiVIxpPmjygrUEUr/xzrjAa8dWx/j5dGAYA5Lk/8TTKKwli2B9mhSopHqF4cUqBg xVoA== X-Gm-Message-State: AA+aEWaM+Qdh4qYQjQlOE+5c/VEe66kuGZcF6qnNoBDxN0LBStHMhldN EV6voB81K7sH6It/w4xyLTOXVQ== X-Received: by 2002:a05:6000:10d1:: with SMTP id b17mr2708063wrx.306.1544795696824; Fri, 14 Dec 2018 05:54:56 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r3sm7426286wrs.78.2018.12.14.05.54.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:54 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 3D8363E035F; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:40 +0000 Message-Id: <20181214135452.25936-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::436 Subject: [Qemu-devel] [PULL 03/15] fp-test: pick TARGET_ARM to get its specialization 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This gets rid of the muladd errors due to not raising the invalid flag. - Before: Errors found in f64_mulAdd, rounding near_even, tininess before rounding: +000.0000000000000 +7FF.0000000000000 +7FF.FFFFFFFFFFFFF => +7FF.FFFFFFFFFFFFF ..... expected -7FF.FFFFFFFFFFFFF v.... [...] - After: In 6133248 tests, no errors found in f64_mulAdd, rounding near_even, tininess before rounding. [...] Reviewed-by: Alex Bennée Tested-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/tests/fp/Makefile b/tests/fp/Makefile index d649a5a1db..49cdcd1bd2 100644 --- a/tests/fp/Makefile +++ b/tests/fp/Makefile @@ -29,6 +29,9 @@ QEMU_INCLUDES += -I$(TF_SOURCE_DIR) # work around TARGET_* poisoning QEMU_CFLAGS += -DHW_POISON_H +# define a target to match testfloat's implementation-defined choices, such as +# whether to raise the invalid flag when dealing with NaNs in muladd. +QEMU_CFLAGS += -DTARGET_ARM # capstone has a platform.h file that clashes with softfloat's QEMU_CFLAGS := $(filter-out %capstone, $(QEMU_CFLAGS)) From patchwork Fri Dec 14 13:54:41 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: 153840 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2098474ljp; Fri, 14 Dec 2018 05:57:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/VoEFRikYhOqlsHLdExtTbnEKB+eFddEvsWc+uv/HWNnqRPdF5rjersZ0i2OL0Q6mnK9Zdd X-Received: by 2002:ac8:3a64:: with SMTP id w91mr2901748qte.70.1544795875292; Fri, 14 Dec 2018 05:57:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544795875; cv=none; d=google.com; s=arc-20160816; b=zKGNxyTpJFePA938rT9WSvAFPcEeiv4ZQveBXjeeCw7HSOUNDHNAPhUV7/zINYbwjo ctd2abHrZ7wKyRiXSSpMoDuSDb7FOqs8VffUrpMsBoxBgSWSJj0XmsrEc1Fe8fsg6TFS Ji7BV+UAZUsk/dwE30T0yYYJ+j5e7kfusq8fWAtKd0o+Bkinp7k42Tn/D8cehJbjHCSm fI4I43mfNBgJJzEnUpgSns29mgYpEixTcpS4FSPcH9CKSHelF1InZSB47G67l5SzT9kD IE84PjtdczevmtPzvS6U5qXDbjD+x27UDer4cp5LtZvkB91ZWFpailOSKSuumRxXmNjO XJ0Q== 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=v/G8a/aDMb6V6+YDboZPGVLMWpsRQK32FHAFTNc/jVo=; b=pppjoRytawkrKWFlWbAcg7OTfjY+vzQG2kInRvRvVADWGHzaxDtGZG+5cnEpNXlMuB 7CahPzx5ooypxkSG1repoDM8kyZGzFyUkK5O2fTnle+IcOu70oI6EjOofO0fh7GXWbsQ LHr54fXkxO/dHrr9+bSu21/1HJQfGdbbbNAAsB4tm7bIC0r2/qU7jptm+d/a/r20+y4N RvVotOAD0SeIbzHuqP0AkVmCkxY3lG0dBbIbYDtQxbYuqpy9QL/clpoI43tRE6PIVI66 2rPpavUI3x/RZu4/fw4HfwlO63RPfSjtgLJVZXf24TWmxgrtzNf9ztTLpSmXKRWQ8vM6 ooJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h2uMLVej; 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 k9si2648449qvd.103.2018.12.14.05.57.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 05:57:55 -0800 (PST) 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=h2uMLVej; 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]:33650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnyU-00019j-AB for patch@linaro.org; Fri, 14 Dec 2018 08:57:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvg-0008Kt-D5 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvd-0001un-6o for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:00 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:32785) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvd-0001t1-0A for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:54:57 -0500 Received: by mail-wr1-x432.google.com with SMTP id c14so5549783wrr.0 for ; Fri, 14 Dec 2018 05:54:56 -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=v/G8a/aDMb6V6+YDboZPGVLMWpsRQK32FHAFTNc/jVo=; b=h2uMLVejHrs2T/kRjI3OCtbJU2XPL4IrH4KSuPdw7OOWqiu/oPg9iKXV8v7RMBEnGX ZEd3CRPsYAZwrkB2/dmSwZn6EBdKtfwyAaTfcCb7pKGifdsQx1AYTgcBJ6HOlYcil3N/ fEAki3soAFMdtdoteWeSHplivLrlLOixZh4fM= 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=v/G8a/aDMb6V6+YDboZPGVLMWpsRQK32FHAFTNc/jVo=; b=Nz+uQNmWv/vY2EytBezGyU0oUQbzI95W9VIDEva9YS68MQuuFOSvHDu6sCsHxUI+Fz pTlWI2cTkV3mGiR5LGBpYBRMpbQy5E02UxHzN898paFmubJBXUmAbJ/dRUtABSsodZB7 2ar0QLt/b8v6vn8qhqbJsAQLhd+Z/ql8NrXhZvRhxnN3w/MxnKdBQkC0JZak2/o+dAW3 tLNoO4d0ZgGVpHsPlN2PNUCx8Z2HWNRZvaTMV9GvN5UZuYe1Bx7s+6IuGmxQ4mYJAQFK /B9WfT/EMTzmRgHq3iwl4As1lJ2Hcsp8SmQ2vsrTmThal2izdnR49D3t4IrdsRl58wXj etOg== X-Gm-Message-State: AA+aEWbAYdIQNBCWA37nkyfJQMRFHvTq40Xu5TNEHigJ9/s5oZs0hwdA cXafGI2QpDMRvQ8g/n2aC/J+fQ== X-Received: by 2002:a5d:44d1:: with SMTP id z17mr2625276wrr.271.1544795695893; Fri, 14 Dec 2018 05:54:55 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a6sm4589545wmh.10.2018.12.14.05.54.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:54 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 500953E0363; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:41 +0000 Message-Id: <20181214135452.25936-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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 04/15] softfloat: add float{32, 64}_is_{de, }normal 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This paves the way for upcoming work. Reviewed-by: Bastian Koppelmann Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 8fd9f9bbae..9eeccd88a5 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -464,6 +464,16 @@ static inline int float32_is_zero_or_denormal(float32 a) return (float32_val(a) & 0x7f800000) == 0; } +static inline bool float32_is_normal(float32 a) +{ + return ((float32_val(a) + 0x00800000) & 0x7fffffff) >= 0x01000000; +} + +static inline bool float32_is_denormal(float32 a) +{ + return float32_is_zero_or_denormal(a) && !float32_is_zero(a); +} + static inline float32 float32_set_sign(float32 a, int sign) { return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31)); @@ -605,6 +615,16 @@ static inline int float64_is_zero_or_denormal(float64 a) return (float64_val(a) & 0x7ff0000000000000LL) == 0; } +static inline bool float64_is_normal(float64 a) +{ + return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53; +} + +static inline bool float64_is_denormal(float64 a) +{ + return float64_is_zero_or_denormal(a) && !float64_is_zero(a); +} + static inline float64 float64_set_sign(float64 a, int sign) { return make_float64((float64_val(a) & 0x7fffffffffffffffULL) From patchwork Fri Dec 14 13:54:42 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: 153842 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2100613ljp; Fri, 14 Dec 2018 06:00:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/XlRRvKZE+Cd+hxFHCdWl74Lc1Ko6KKhpMD4NQFNsa4Bc/GdU9vppS7aFnbVMUjVB/SOWCx X-Received: by 2002:aed:3b25:: with SMTP id p34mr2803784qte.310.1544796014189; Fri, 14 Dec 2018 06:00:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796014; cv=none; d=google.com; s=arc-20160816; b=cX1Hu6/T/WbGj23R3p/13HDR4AQFN4Ddj85NdG02JDyhqb1DQo90LQJEqPn5sDnrs0 fvkBmu7wvwcXlQ7XgOBW3PckR5P/wgdgraFL3u5ZlVWLie2MsehEonrpV0g+0ifgbs4c n0DW4PO73iSZdqRia4YwYxpcaO5EOu/VbAHGkNOivoZzYw1BAJyKp/0ctTQwDgoHpg8g zMA5d+s30QGq9Z5j3cWOzcEsKn+q2POdDNYH5cO9RW6/rmWO+o1FzRQdqC3VpwqCZIBi 0uB16TkKZYdoj0idykp+YSlkEbBgu7QFslqlrGClvEaY8Pagq55zubtEg5/ZG/xJoAQy COzg== 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=4y9FUmY2nafi57HhYvgJvorYMC2w+RoucBwKitqF7PM=; b=eaGexdvSqmumyWPj/YF2z/aVvYcPP6R54GA2tSgUo1QLGHi873j6UQLFTCZIt4vc+h /r2nueKGPA1U4we20ulCsWcjfpn40n3bMaAsSN9WUy6npi50PI8WYlEUq8+s7luJfnCV R7QxeVr6BXAWxvq/b6SmCXqAy8bpn/E39lNEpTz3ftWkEqc6i91bKod09RVcpKZM6u4a hoLM0/C2+JU3Q1+L2iEjKOe7VvaYg5kORqzEi9t5XN7WYCwVe9dIoJL/kv/4zD21FhMQ 92wUfvrN4+VOOGCa47PPTNWBPe7YfXeGXRVl3wIaSwwH62ooZdGbjBicVl6qthZHT6pY hQOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d1o2ThMC; 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 y65si2934505qky.128.2018.12.14.06.00.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:00:14 -0800 (PST) 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=d1o2ThMC; 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]:33663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo0j-0003eR-K0 for patch@linaro.org; Fri, 14 Dec 2018 09:00:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvh-0008Lt-Lw for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvg-0001wH-PY for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:01 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:36212) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvg-0001vU-Cz for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:00 -0500 Received: by mail-wr1-x42b.google.com with SMTP id u4so4543970wrp.3 for ; Fri, 14 Dec 2018 05:54:59 -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=4y9FUmY2nafi57HhYvgJvorYMC2w+RoucBwKitqF7PM=; b=d1o2ThMCYVvUsH7oeXIaoLRIZtg5UrGEv+8aYzwWdxVVRBjf4Oqy63jrbpOraRQUeh 7jpS69jTY1WvwVurtPfqmAjokmQ2jLyOQqKtlbRpol9cOz+cvqJAD9GYJCxFB1X+2vRP hTgJg9Cznuy0v/4UEXCSEj8J06CG1Gd03GWsU= 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=4y9FUmY2nafi57HhYvgJvorYMC2w+RoucBwKitqF7PM=; b=RC/zQ+s6pyvLQYeUSIX6JHXige7Cy0FQ8+UJPM37HsNLait86boeZR0UgZ2rNrBDv0 +NT78f50YnnACd1/V+9Is14wSuCSwd6lgFo0QqJFjtZHy/1x0lN5gXp5UW4b83MVvRty C6vsdwvOmspa/1TwDmtqaeER/An3FYFM67ZB2hidX4kZ8O177agnkZVrgj6/UhxnrDBh Ekw4cKWrgphIxq6SW0CL+mZ3O2J8CEtADOGXIoKXyetd8+M3STQazmi7KuuJyRI8WqSK pHfXUatL6DBj/mOKoVTVh0eiwixEkEuEkz1WQhfnMJzmq/9lblJAnYtL0V6IGMYpXLUY Fstg== X-Gm-Message-State: AA+aEWZpOwL4c1t7NcPR1klR3C8ULWS5TOcxS4qFEgU/vgstytLEPIQS PzKL1x4th8waRLWoUUrdSzEsfw== X-Received: by 2002:adf:ee07:: with SMTP id y7mr2784836wrn.187.1544795698507; Fri, 14 Dec 2018 05:54:58 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x186sm4994869wmg.41.2018.12.14.05.54.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:56 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 628293E03C0; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:42 +0000 Message-Id: <20181214135452.25936-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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 05/15] target/tricore: use float32_is_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: Bastian Koppelmann , "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Bastian Koppelmann Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/target/tricore/fpu_helper.c b/target/tricore/fpu_helper.c index df162902d6..31df462e4a 100644 --- a/target/tricore/fpu_helper.c +++ b/target/tricore/fpu_helper.c @@ -44,11 +44,6 @@ static inline uint8_t f_get_excp_flags(CPUTriCoreState *env) | float_flag_inexact); } -static inline bool f_is_denormal(float32 arg) -{ - return float32_is_zero_or_denormal(arg) && !float32_is_zero(arg); -} - static inline float32 f_maddsub_nan_result(float32 arg1, float32 arg2, float32 arg3, float32 result, uint32_t muladd_negate_c) @@ -260,8 +255,8 @@ uint32_t helper_fcmp(CPUTriCoreState *env, uint32_t r1, uint32_t r2) set_flush_inputs_to_zero(0, &env->fp_status); result = 1 << (float32_compare_quiet(arg1, arg2, &env->fp_status) + 1); - result |= f_is_denormal(arg1) << 4; - result |= f_is_denormal(arg2) << 5; + result |= float32_is_denormal(arg1) << 4; + result |= float32_is_denormal(arg2) << 5; flags = f_get_excp_flags(env); if (flags) { From patchwork Fri Dec 14 13:54:43 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: 153843 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2101065ljp; Fri, 14 Dec 2018 06:00:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/VotiJ9YcTqUKwZA6WLVQonQ4xh7BH0Ah7VcDucd0K84SysXTMyvDbkptCBwZ+ngyuQ6E0u X-Received: by 2002:a0c:a545:: with SMTP id y63mr2764096qvy.119.1544796036733; Fri, 14 Dec 2018 06:00:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796036; cv=none; d=google.com; s=arc-20160816; b=HK5WePCLo+cZcVXmFhNd33eBTNhxtxxjQMACeF6Y4xctmcpfa6u0sDhz4hfXnImozx CaJk6zc0lPseGQfLJ1mLg3Whatm+k6O3L+Cq8kuuWQF3/l0AiumGitVK/gVtTBFixqa3 m7CrW129khZm9IXVfxQlvaMyoWrGblwYjpOg2E2EjBdnu/Z+oWOkPH0/9KXeECGLrgKa SJOpArYth5R9ghcwRVnNGJUSlffslPS47DXslUVIO7qGEUt/2Ui2tr6dR98JyvN08Dyo sVlcSzywUfOGkIH2dKIQq2XmJRPONMm8L+bay0N30BYW3nX8Y+gzpGsPMTVrh1dky0B/ 9RrQ== 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=UBrDEL/8GNRM4b55ogWA7uIYylBy9hKpPQIaQIKKC+Q=; b=G/N5KdbKGUR77wH/ZMRmD/Zt4O99WIEcxiX00hnKCc2HKfqRFPTWv+0oVjbe1jd7WX DghSl0sx54x8rayvae+Ythk2mTkjF4OFisA7WuTFABNCkTBm5hz0yz7y9r0GU5jjE38Z vMPqX/Ti9Q8TOAMtn1ed6W4opTsw6pmN/BFGO3BRKG5JaitDSqA+N43CngJZHbbJOBOs U3WmEguVnObOrr+Qng4tz4bM6+4UHcnd1qCXSG/zXiDqPwuT5SseFGy0sG3MTDy+f16Y 8Fwl+iKm79qDTZZgi0JOCJY9aMN9TERuuRvjvM3Cgtdr+o1C0Ok1xVJlD3+u7MQ3AXhQ A4Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LHtsv4yT; 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 i1si155367qtg.372.2018.12.14.06.00.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:00:36 -0800 (PST) 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=LHtsv4yT; 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]:33665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo16-0004Qm-8G for patch@linaro.org; Fri, 14 Dec 2018 09:00:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvi-0008M9-88 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvg-0001wP-QN for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:02 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:50384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvg-0001vE-DH for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:00 -0500 Received: by mail-wm1-x332.google.com with SMTP id n190so5798631wmd.0 for ; Fri, 14 Dec 2018 05:54:59 -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=UBrDEL/8GNRM4b55ogWA7uIYylBy9hKpPQIaQIKKC+Q=; b=LHtsv4yTkY5tPTkCp0OJ2tLaWYV1jqbqiBaVngZZ0N6EHwdS6rvSHN++dqUQN/eXeR +6gpVpuuWZq3roT2CaJj0zj2RmA1rZ6iC5TT1cr2AVbJ9IdU+B0CGJfPzih5OJOgW7ai cvlAvjZJ9blNbDhZ85IZ+ynuD4Q5CkA8f6D+I= 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=UBrDEL/8GNRM4b55ogWA7uIYylBy9hKpPQIaQIKKC+Q=; b=Pn1Le6zy25tCUTbXg/x+2+xFH7yR+/AjKYKPK41qbB14atWkg2jrOnLLfFxdzhwNC6 wBO5Ib2m0B+EmNMbC1lkarTVNAVfJWCFkGMjFt9BK3+WY1xrI0SOm3hVAPJTilWUvWi9 iK9HOkBww+wxWy6Jowe3r8A/gs6nHnsVp/eMHifwhgPxq42Fc72LFkNDpVnDaMIMyJhi gjX4yrbXrTMpfpyy0wf8LE1yKM2zibSk1Bm5psI1b2PGyjcLOcQ/rwY7Sg0D4zMtDicg 8adaVa+ys2qAoFXRUDfEJ79oGVklNlZ/jkLWp++L0rQ3oIkM4OelWUJGn2HaxddkTzYl C76A== X-Gm-Message-State: AA+aEWboCPsOk4uLu9tScdCQc5SV8qKGn+DFK1HH7GjQA8zoZSsPIStX AEIIE4CgGoOE6hgV9vaKSH706w== X-Received: by 2002:a7b:c852:: with SMTP id c18mr3160261wml.49.1544795697958; Fri, 14 Dec 2018 05:54:57 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o4sm4884596wmh.40.2018.12.14.05.54.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:56 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 764EC3E055E; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:43 +0000 Message-Id: <20181214135452.25936-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::332 Subject: [Qemu-devel] [PULL 06/15] softfloat: rename canonicalize to sf_canonicalize 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" glibc >= 2.25 defines canonicalize in commit eaf5ad0 (Add canonicalize, canonicalizef, canonicalizel., 2016-10-26). Given that we'll be including soon, prepare for this by prefixing our canonicalize() with sf_ to avoid clashing with the libc's canonicalize(). Reported-by: Bastian Koppelmann Tested-by: Bastian Koppelmann Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index e1eef954e6..ecdc00c633 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -336,8 +336,8 @@ static inline float64 float64_pack_raw(FloatParts p) #include "softfloat-specialize.h" /* Canonicalize EXP and FRAC, setting CLS. */ -static FloatParts canonicalize(FloatParts part, const FloatFmt *parm, - float_status *status) +static FloatParts sf_canonicalize(FloatParts part, const FloatFmt *parm, + float_status *status) { if (part.exp == parm->exp_max && !parm->arm_althp) { if (part.frac == 0) { @@ -513,7 +513,7 @@ static FloatParts round_canonical(FloatParts p, float_status *s, static FloatParts float16a_unpack_canonical(float16 f, float_status *s, const FloatFmt *params) { - return canonicalize(float16_unpack_raw(f), params, s); + return sf_canonicalize(float16_unpack_raw(f), params, s); } static FloatParts float16_unpack_canonical(float16 f, float_status *s) @@ -534,7 +534,7 @@ static float16 float16_round_pack_canonical(FloatParts p, float_status *s) static FloatParts float32_unpack_canonical(float32 f, float_status *s) { - return canonicalize(float32_unpack_raw(f), &float32_params, s); + return sf_canonicalize(float32_unpack_raw(f), &float32_params, s); } static float32 float32_round_pack_canonical(FloatParts p, float_status *s) @@ -544,7 +544,7 @@ static float32 float32_round_pack_canonical(FloatParts p, float_status *s) static FloatParts float64_unpack_canonical(float64 f, float_status *s) { - return canonicalize(float64_unpack_raw(f), &float64_params, s); + return sf_canonicalize(float64_unpack_raw(f), &float64_params, s); } static float64 float64_round_pack_canonical(FloatParts p, float_status *s) From patchwork Fri Dec 14 13:54:44 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: 153850 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2108495ljp; Fri, 14 Dec 2018 06:05:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/WqN/tbYHyzZ16wSKU/ZcudpsVNN+t5xDF4D5QNhRkvgmDPlhzkjKPV6Psr4dxUKr0k+16v X-Received: by 2002:ac8:7016:: with SMTP id x22mr2779821qtm.325.1544796355204; Fri, 14 Dec 2018 06:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796355; cv=none; d=google.com; s=arc-20160816; b=Os3oJtxmmiLw8xmuFU3Y2uRZaCcOaVmYR+hN/z61muLffhsBB053F8hSfNbEgS7saZ VxjgITFZidCfXla1fq6F6mDjdqSp+WFKzgWXMrJ040gj1LUox0+T/BbubDwLHBzFmCur frBh7dcpBMcJfLcT+/0jpoC4Yn3yeR3+3a+50iuBRluHs8UQiD+LtF/ndf19JBeBUJlJ Vswoe6yGqDFDfCFK3gPmQW+wZvnb5m6TLsiE7qGjEZ2YeqWQuH2fyb1tKFZYRNp9dAuR 2BYrEvS3WXPKqYvqWl9OLq54UzEeWM1VvbnduYpNs1n1HBpTJojYBUQSYzl0+2aCQbcc curg== 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=fg/ZIxwklhVpkdxua263VSnlqI6ZJvuK+mHRcjFmBvM=; b=LorvfIWNJaHI0tGC94tX/5DJ+C8bYhtIu1JZHA7nCmT7xiiHd3Eyc1zlxCnujFVdve jOJ89bWZo146whNn3VCRYtotpZZdRCNvkSFUTFWcmP9j19pyt4gmwr8Zyd3fq3SZIfNe B3KZ94YviHKH+Iyv5LT0sllJptVbErAM0sufgosjTko9tmK3rspYFoGRZ0OeHa8eC9nf 8dwfLRtRiLxy77VFoa9OCbeUcli1NuwFcTvmrmZOzi1xxLYh1YgzTYumknZx6utj+ecL RMZC+xffGKYjJeIoRyo6pJKWbRGjKnmL98BB0dbxEBCaBsRdT0FHi1rB6T04EH6cojKU 2XaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TsBK99Yr; 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 g1si2941449qtr.315.2018.12.14.06.05.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:05:55 -0800 (PST) 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=TsBK99Yr; 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]:33712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo6E-00035O-KP for patch@linaro.org; Fri, 14 Dec 2018 09:05:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvh-0008Lw-Od for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvg-0001wQ-QI for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:01 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:55473) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvg-0001ve-DU for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:00 -0500 Received: by mail-wm1-x333.google.com with SMTP id y139so5727230wmc.5 for ; Fri, 14 Dec 2018 05:55:00 -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=fg/ZIxwklhVpkdxua263VSnlqI6ZJvuK+mHRcjFmBvM=; b=TsBK99YrdTrfQP2ZZetrV9YJE8LAqOObN6Unu4RtG+aHEImsU6L5pK6LgsyA1WRBGo wrtm4kjHQRPwV6XtinMCmekR9VwiR3auTQzTIk56txCixqlNlXs5jPSWXC2xpAN2e5FH aABl9jq0H12OXymrqNT+oWrrO9nQiWYW3cPzU= 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=fg/ZIxwklhVpkdxua263VSnlqI6ZJvuK+mHRcjFmBvM=; b=KXZnosJbAzuv33n6pwkifQu7Qgn8wyQU3E00VeToKcQDeYG5JN2FxUOwi+ceS9UVei KiTSrzkHWvVNnNGgXujLxuS5LoX4xSjfs4mjy7TXrsgeTKIeRx7Zc8oUNWcaLX40raeQ m/YFedMrtUb/uYwtacW7J+YkR0esoP5SMatm6N3hGMrZzSSp7YR44piarv7S1gg+k31X 8Q7ySSYXZ+Sz7dHbSvfv2PfOMfTtJJOolsJLWvcvtHmD/uO57APJOH6fHMOgZlHbmIqq 0TWeMvRBvKFwUaJLzS+P27w+lgVUxEVZS+Cj6urxInWI+fPYa202eIBjcDubS28HtpCA SiAw== X-Gm-Message-State: AA+aEWZ4WW8CCLjMTTYZTt13MTnknJ+0WBQmijZvrxKKFQHol2D7sZ5p 7p65pXLfb44iLRNPL0vRb7E0fA== X-Received: by 2002:a1c:5604:: with SMTP id k4mr3218089wmb.107.1544795699137; Fri, 14 Dec 2018 05:54:59 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k128sm6316222wmd.37.2018.12.14.05.54.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:56 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 897733E0561; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:44 +0000 Message-Id: <20181214135452.25936-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::333 Subject: [Qemu-devel] [PULL 07/15] softfloat: add float{32, 64}_is_zero_or_normal 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" These will gain some users very soon. Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 9eeccd88a5..38a5e99cf3 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -474,6 +474,11 @@ static inline bool float32_is_denormal(float32 a) return float32_is_zero_or_denormal(a) && !float32_is_zero(a); } +static inline bool float32_is_zero_or_normal(float32 a) +{ + return float32_is_normal(a) || float32_is_zero(a); +} + static inline float32 float32_set_sign(float32 a, int sign) { return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31)); @@ -625,6 +630,11 @@ static inline bool float64_is_denormal(float64 a) return float64_is_zero_or_denormal(a) && !float64_is_zero(a); } +static inline bool float64_is_zero_or_normal(float64 a) +{ + return float64_is_normal(a) || float64_is_zero(a); +} + static inline float64 float64_set_sign(float64 a, int sign) { return make_float64((float64_val(a) & 0x7fffffffffffffffULL) From patchwork Fri Dec 14 13:54:45 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: 153844 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2101700ljp; Fri, 14 Dec 2018 06:01:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/VQy8qtRWFx6VUdFsAaW7jve1GVarwEjr8Ag4BxuZHK+1SY2nqeZS2FAWb+mp6hAvq2TkNW X-Received: by 2002:a0c:8a5a:: with SMTP id 26mr2807584qvu.94.1544796062786; Fri, 14 Dec 2018 06:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796062; cv=none; d=google.com; s=arc-20160816; b=DgEZ+mHmGC4a/iwhSBN1Ha6ABGyqfq0iJ1KXUeN/BhIFLSZjQw56eghhmhD/jgPfqp m7jcOJFFGqKdsCGc4Bijkof6LsSyZhZv3y2a2mIsTlMN3gfgoRcXUZxFwACUtpXZc0MB YTanTsWNaIH+3FXCaFB/v5SlrjQhwz+9x0yVuQbPdSbVkqd0kHNlJDeEikNxeKtoAhvP N3wjf/sNsWGgzlotOKtjLXrWgU/LkdsIgoTWdVdO6b3ZrHFl4lODk1ypk71sfF5jMyg9 1CaIsTFkG3qj499+Wh1b7I1SCetrEsqfl8LNc9BOejkHD1OqJUP1vz29HI5JJubXqCSf ljiA== 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=PiJJ8sQDJq1td+Nwr/8t517GlXzzi+KfjNDfMe1+2Sc=; b=UZexAbrerwcmsnTMkpwsfGMOmiryFzqFBrQgKrp8Q6Kqq8CXVZZAO4h7zdK/zrxtZm hlQe+I5wbB3HfubDrUc8tSla/5jELbD/uo/xK3QHfW+RC+QPX6eGqOXrpMhHJeLutLEm nDdjPzLV3DhN8Nw9tOxhytyJvp/gWz8+5k+IcZhHOGrorpWdaTv5wJaZJWzRTgQO35Le mikwJLKT5dc+ltI1ROwKjKPIg2tWYyOh41/8ahR4Kh4lLcXUNviGOBTJX+YzjIUVFG7s wD8PTu8RyanlN942q2FVq3wgtc4ilyzJjM4g/Lwxqr8I159ST7AcVYwzx9GB1dbiaTWm KRWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZiLoOA31; 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 d19si3017462qtm.138.2018.12.14.06.01.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:01:02 -0800 (PST) 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=ZiLoOA31; 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]:33683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo1W-0005bV-8A for patch@linaro.org; Fri, 14 Dec 2018 09:01:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvk-0008N7-Mt for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvi-0001xm-Kp for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:04 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:32779) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvi-0001xA-7a for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:02 -0500 Received: by mail-wr1-x42b.google.com with SMTP id c14so5550057wrr.0 for ; Fri, 14 Dec 2018 05:55:02 -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=PiJJ8sQDJq1td+Nwr/8t517GlXzzi+KfjNDfMe1+2Sc=; b=ZiLoOA3180HJIvjI3pR2Ze6IJ2A1Q0LSnlXJaHg5PQ2aSZUPKXbN1nH5a5OZm62s6k gG8UZI8GYD9WfCybJE05WZB4DJ97DfI6G5e/j+J2Zbk8RS1BPt+WnX2gXthvuDzoX+hX YatvXpW0mDuV1ZmeRaFEsSjvD/0FOaJk8oL3c= 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=PiJJ8sQDJq1td+Nwr/8t517GlXzzi+KfjNDfMe1+2Sc=; b=sDtioSG+0wrifp1/MNnq0QTSXB9sYnqAec228iRKSjVOptOeeXJpBJS6pToWxgsi4P B5MsDSy27Ww6VuODseXEkXTKZqxO0iZx01KUVHZEzrdhKIzYcsB6geL9gDa18cYfqk3T xH5Ge+yCPUftrbW9byLT51ynQKAuOjrI8VmskYmw6g35Rp5ry6mDWVYdlZKfte0zLo7V qhhA3l33uKqe0hz9sy/rDZwfNKufqLh5Y31K1QJOHYtwZfL27RTJC8A//OfG6jY6IWAW X4MHPD25lCNqjIdvFAi7J8nH2ZqoCj0up/O0BttKNIo5Ll03TOi7Ol2SKdojBCw2T7fQ Xvlg== X-Gm-Message-State: AA+aEWYJQflekyJuQ9OgKHiu8m/Q1BG6f0mTA7PBEEz8qqxOp/loBG3q 3KDUbzShg14u7mMdusCukSdV9A== X-Received: by 2002:adf:d089:: with SMTP id y9mr2810032wrh.22.1544795701048; Fri, 14 Dec 2018 05:55:01 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id w125sm4737081wmb.45.2018.12.14.05.54.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:56 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id A0CD53E0568; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:45 +0000 Message-Id: <20181214135452.25936-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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 08/15] tests/fp: add fp-bench 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" These microbenchmarks will allow us to measure the performance impact of FP emulation optimizations. Note that we can measure both directly the impact on the softfloat functions (with "-t soft"), or the impact on an emulated workload (call with "-t host" and run under qemu user-mode). Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/tests/fp/.gitignore b/tests/fp/.gitignore index 8d45d18ac4..704fd42992 100644 --- a/tests/fp/.gitignore +++ b/tests/fp/.gitignore @@ -1 +1,2 @@ fp-test +fp-bench diff --git a/tests/fp/Makefile b/tests/fp/Makefile index 49cdcd1bd2..5019dcdca0 100644 --- a/tests/fp/Makefile +++ b/tests/fp/Makefile @@ -553,7 +553,7 @@ TF_OBJS_LIB += $(TF_OBJS_WRITECASE) TF_OBJS_LIB += testLoops_common.o TF_OBJS_LIB += $(TF_OBJS_TEST) -BINARIES := fp-test$(EXESUF) +BINARIES := fp-test$(EXESUF) fp-bench$(EXESUF) # everything depends on config-host.h because platform.h includes it all: $(BUILD_DIR)/config-host.h @@ -590,10 +590,13 @@ $(TF_OBJS_LIB) slowfloat.o: %.o: $(TF_SOURCE_DIR)/%.c libtestfloat.a: $(TF_OBJS_LIB) +fp-bench$(EXESUF): fp-bench.o $(QEMU_SOFTFLOAT_OBJ) $(LIBQEMUUTIL) + clean: rm -f *.o *.d $(BINARIES) rm -f *.gcno *.gcda *.gcov rm -f fp-test$(EXESUF) + rm -f fp-bench$(EXESUF) rm -f libsoftfloat.a rm -f libtestfloat.a diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c new file mode 100644 index 0000000000..f5bc5edebf --- /dev/null +++ b/tests/fp/fp-bench.c @@ -0,0 +1,630 @@ +/* + * fp-bench.c - A collection of simple floating point microbenchmarks. + * + * Copyright (C) 2018, Emilio G. Cota + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#ifndef HW_POISON_H +#error Must define HW_POISON_H to work around TARGET_* poisoning +#endif + +#include "qemu/osdep.h" +#include +#include +#include "qemu/timer.h" +#include "fpu/softfloat.h" + +/* amortize the computation of random inputs */ +#define OPS_PER_ITER 50000 + +#define MAX_OPERANDS 3 + +#define SEED_A 0xdeadfacedeadface +#define SEED_B 0xbadc0feebadc0fee +#define SEED_C 0xbeefdeadbeefdead + +enum op { + OP_ADD, + OP_SUB, + OP_MUL, + OP_DIV, + OP_FMA, + OP_SQRT, + OP_CMP, + OP_MAX_NR, +}; + +static const char * const op_names[] = { + [OP_ADD] = "add", + [OP_SUB] = "sub", + [OP_MUL] = "mul", + [OP_DIV] = "div", + [OP_FMA] = "mulAdd", + [OP_SQRT] = "sqrt", + [OP_CMP] = "cmp", + [OP_MAX_NR] = NULL, +}; + +enum precision { + PREC_SINGLE, + PREC_DOUBLE, + PREC_FLOAT32, + PREC_FLOAT64, + PREC_MAX_NR, +}; + +enum rounding { + ROUND_EVEN, + ROUND_ZERO, + ROUND_DOWN, + ROUND_UP, + ROUND_TIEAWAY, + N_ROUND_MODES, +}; + +static const char * const round_names[] = { + [ROUND_EVEN] = "even", + [ROUND_ZERO] = "zero", + [ROUND_DOWN] = "down", + [ROUND_UP] = "up", + [ROUND_TIEAWAY] = "tieaway", +}; + +enum tester { + TESTER_SOFT, + TESTER_HOST, + TESTER_MAX_NR, +}; + +static const char * const tester_names[] = { + [TESTER_SOFT] = "soft", + [TESTER_HOST] = "host", + [TESTER_MAX_NR] = NULL, +}; + +union fp { + float f; + double d; + float32 f32; + float64 f64; + uint64_t u64; +}; + +struct op_state; + +typedef float (*float_func_t)(const struct op_state *s); +typedef double (*double_func_t)(const struct op_state *s); + +union fp_func { + float_func_t float_func; + double_func_t double_func; +}; + +typedef void (*bench_func_t)(void); + +struct op_desc { + const char * const name; +}; + +#define DEFAULT_DURATION_SECS 1 + +static uint64_t random_ops[MAX_OPERANDS] = { + SEED_A, SEED_B, SEED_C, +}; +static float_status soft_status; +static enum precision precision; +static enum op operation; +static enum tester tester; +static uint64_t n_completed_ops; +static unsigned int duration = DEFAULT_DURATION_SECS; +static int64_t ns_elapsed; +/* disable optimizations with volatile */ +static volatile union fp res; + +/* + * From: https://en.wikipedia.org/wiki/Xorshift + * This is faster than rand_r(), and gives us a wider range (RAND_MAX is only + * guaranteed to be >= INT_MAX). + */ +static uint64_t xorshift64star(uint64_t x) +{ + x ^= x >> 12; /* a */ + x ^= x << 25; /* b */ + x ^= x >> 27; /* c */ + return x * UINT64_C(2685821657736338717); +} + +static void update_random_ops(int n_ops, enum precision prec) +{ + int i; + + for (i = 0; i < n_ops; i++) { + uint64_t r = random_ops[i]; + + if (prec == PREC_SINGLE || PREC_FLOAT32) { + do { + r = xorshift64star(r); + } while (!float32_is_normal(r)); + } else if (prec == PREC_DOUBLE || PREC_FLOAT64) { + do { + r = xorshift64star(r); + } while (!float64_is_normal(r)); + } else { + g_assert_not_reached(); + } + random_ops[i] = r; + } +} + +static void fill_random(union fp *ops, int n_ops, enum precision prec, + bool no_neg) +{ + int i; + + for (i = 0; i < n_ops; i++) { + switch (prec) { + case PREC_SINGLE: + case PREC_FLOAT32: + ops[i].f32 = make_float32(random_ops[i]); + if (no_neg && float32_is_neg(ops[i].f32)) { + ops[i].f32 = float32_chs(ops[i].f32); + } + /* raise the exponent to limit the frequency of denormal results */ + ops[i].f32 |= 0x40000000; + break; + case PREC_DOUBLE: + case PREC_FLOAT64: + ops[i].f64 = make_float64(random_ops[i]); + if (no_neg && float64_is_neg(ops[i].f64)) { + ops[i].f64 = float64_chs(ops[i].f64); + } + /* raise the exponent to limit the frequency of denormal results */ + ops[i].f64 |= LIT64(0x4000000000000000); + break; + default: + g_assert_not_reached(); + } + } +} + +/* + * The main benchmark function. Instead of (ab)using macros, we rely + * on the compiler to unfold this at compile-time. + */ +static void bench(enum precision prec, enum op op, int n_ops, bool no_neg) +{ + int64_t tf = get_clock() + duration * 1000000000LL; + + while (get_clock() < tf) { + union fp ops[MAX_OPERANDS]; + int64_t t0; + int i; + + update_random_ops(n_ops, prec); + switch (prec) { + case PREC_SINGLE: + fill_random(ops, n_ops, prec, no_neg); + t0 = get_clock(); + for (i = 0; i < OPS_PER_ITER; i++) { + float a = ops[0].f; + float b = ops[1].f; + float c = ops[2].f; + + switch (op) { + case OP_ADD: + res.f = a + b; + break; + case OP_SUB: + res.f = a - b; + break; + case OP_MUL: + res.f = a * b; + break; + case OP_DIV: + res.f = a / b; + break; + case OP_FMA: + res.f = fmaf(a, b, c); + break; + case OP_SQRT: + res.f = sqrtf(a); + break; + case OP_CMP: + res.u64 = isgreater(a, b); + break; + default: + g_assert_not_reached(); + } + } + break; + case PREC_DOUBLE: + fill_random(ops, n_ops, prec, no_neg); + t0 = get_clock(); + for (i = 0; i < OPS_PER_ITER; i++) { + double a = ops[0].d; + double b = ops[1].d; + double c = ops[2].d; + + switch (op) { + case OP_ADD: + res.d = a + b; + break; + case OP_SUB: + res.d = a - b; + break; + case OP_MUL: + res.d = a * b; + break; + case OP_DIV: + res.d = a / b; + break; + case OP_FMA: + res.d = fma(a, b, c); + break; + case OP_SQRT: + res.d = sqrt(a); + break; + case OP_CMP: + res.u64 = isgreater(a, b); + break; + default: + g_assert_not_reached(); + } + } + break; + case PREC_FLOAT32: + fill_random(ops, n_ops, prec, no_neg); + t0 = get_clock(); + for (i = 0; i < OPS_PER_ITER; i++) { + float32 a = ops[0].f32; + float32 b = ops[1].f32; + float32 c = ops[2].f32; + + switch (op) { + case OP_ADD: + res.f32 = float32_add(a, b, &soft_status); + break; + case OP_SUB: + res.f32 = float32_sub(a, b, &soft_status); + break; + case OP_MUL: + res.f = float32_mul(a, b, &soft_status); + break; + case OP_DIV: + res.f32 = float32_div(a, b, &soft_status); + break; + case OP_FMA: + res.f32 = float32_muladd(a, b, c, 0, &soft_status); + break; + case OP_SQRT: + res.f32 = float32_sqrt(a, &soft_status); + break; + case OP_CMP: + res.u64 = float32_compare_quiet(a, b, &soft_status); + break; + default: + g_assert_not_reached(); + } + } + break; + case PREC_FLOAT64: + fill_random(ops, n_ops, prec, no_neg); + t0 = get_clock(); + for (i = 0; i < OPS_PER_ITER; i++) { + float64 a = ops[0].f64; + float64 b = ops[1].f64; + float64 c = ops[2].f64; + + switch (op) { + case OP_ADD: + res.f64 = float64_add(a, b, &soft_status); + break; + case OP_SUB: + res.f64 = float64_sub(a, b, &soft_status); + break; + case OP_MUL: + res.f = float64_mul(a, b, &soft_status); + break; + case OP_DIV: + res.f64 = float64_div(a, b, &soft_status); + break; + case OP_FMA: + res.f64 = float64_muladd(a, b, c, 0, &soft_status); + break; + case OP_SQRT: + res.f64 = float64_sqrt(a, &soft_status); + break; + case OP_CMP: + res.u64 = float64_compare_quiet(a, b, &soft_status); + break; + default: + g_assert_not_reached(); + } + } + break; + default: + g_assert_not_reached(); + } + ns_elapsed += get_clock() - t0; + n_completed_ops += OPS_PER_ITER; + } +} + +#define GEN_BENCH(name, type, prec, op, n_ops) \ + static void __attribute__((flatten)) name(void) \ + { \ + bench(prec, op, n_ops, false); \ + } + +#define GEN_BENCH_NO_NEG(name, type, prec, op, n_ops) \ + static void __attribute__((flatten)) name(void) \ + { \ + bench(prec, op, n_ops, true); \ + } + +#define GEN_BENCH_ALL_TYPES(opname, op, n_ops) \ + GEN_BENCH(bench_ ## opname ## _float, float, PREC_SINGLE, op, n_ops) \ + GEN_BENCH(bench_ ## opname ## _double, double, PREC_DOUBLE, op, n_ops) \ + GEN_BENCH(bench_ ## opname ## _float32, float32, PREC_FLOAT32, op, n_ops) \ + GEN_BENCH(bench_ ## opname ## _float64, float64, PREC_FLOAT64, op, n_ops) + +GEN_BENCH_ALL_TYPES(add, OP_ADD, 2) +GEN_BENCH_ALL_TYPES(sub, OP_SUB, 2) +GEN_BENCH_ALL_TYPES(mul, OP_MUL, 2) +GEN_BENCH_ALL_TYPES(div, OP_DIV, 2) +GEN_BENCH_ALL_TYPES(fma, OP_FMA, 3) +GEN_BENCH_ALL_TYPES(cmp, OP_CMP, 2) +#undef GEN_BENCH_ALL_TYPES + +#define GEN_BENCH_ALL_TYPES_NO_NEG(name, op, n) \ + GEN_BENCH_NO_NEG(bench_ ## name ## _float, float, PREC_SINGLE, op, n) \ + GEN_BENCH_NO_NEG(bench_ ## name ## _double, double, PREC_DOUBLE, op, n) \ + GEN_BENCH_NO_NEG(bench_ ## name ## _float32, float32, PREC_FLOAT32, op, n) \ + GEN_BENCH_NO_NEG(bench_ ## name ## _float64, float64, PREC_FLOAT64, op, n) + +GEN_BENCH_ALL_TYPES_NO_NEG(sqrt, OP_SQRT, 1) +#undef GEN_BENCH_ALL_TYPES_NO_NEG + +#undef GEN_BENCH_NO_NEG +#undef GEN_BENCH + +#define GEN_BENCH_FUNCS(opname, op) \ + [op] = { \ + [PREC_SINGLE] = bench_ ## opname ## _float, \ + [PREC_DOUBLE] = bench_ ## opname ## _double, \ + [PREC_FLOAT32] = bench_ ## opname ## _float32, \ + [PREC_FLOAT64] = bench_ ## opname ## _float64, \ + } + +static const bench_func_t bench_funcs[OP_MAX_NR][PREC_MAX_NR] = { + GEN_BENCH_FUNCS(add, OP_ADD), + GEN_BENCH_FUNCS(sub, OP_SUB), + GEN_BENCH_FUNCS(mul, OP_MUL), + GEN_BENCH_FUNCS(div, OP_DIV), + GEN_BENCH_FUNCS(fma, OP_FMA), + GEN_BENCH_FUNCS(sqrt, OP_SQRT), + GEN_BENCH_FUNCS(cmp, OP_CMP), +}; + +#undef GEN_BENCH_FUNCS + +static void run_bench(void) +{ + bench_func_t f; + + f = bench_funcs[operation][precision]; + g_assert(f); + f(); +} + +/* @arr must be NULL-terminated */ +static int find_name(const char * const *arr, const char *name) +{ + int i; + + for (i = 0; arr[i] != NULL; i++) { + if (strcmp(name, arr[i]) == 0) { + return i; + } + } + return -1; +} + +static void usage_complete(int argc, char *argv[]) +{ + gchar *op_list = g_strjoinv(", ", (gchar **)op_names); + gchar *tester_list = g_strjoinv(", ", (gchar **)tester_names); + + fprintf(stderr, "Usage: %s [options]\n", argv[0]); + fprintf(stderr, "options:\n"); + fprintf(stderr, " -d = duration, in seconds. Default: %d\n", + DEFAULT_DURATION_SECS); + fprintf(stderr, " -h = show this help message.\n"); + fprintf(stderr, " -o = floating point operation (%s). Default: %s\n", + op_list, op_names[0]); + fprintf(stderr, " -p = floating point precision (single, double). " + "Default: single\n"); + fprintf(stderr, " -r = rounding mode (even, zero, down, up, tieaway). " + "Default: even\n"); + fprintf(stderr, " -t = tester (%s). Default: %s\n", + tester_list, tester_names[0]); + fprintf(stderr, " -z = flush inputs to zero (soft tester only). " + "Default: disabled\n"); + fprintf(stderr, " -Z = flush output to zero (soft tester only). " + "Default: disabled\n"); + + g_free(tester_list); + g_free(op_list); +} + +static int round_name_to_mode(const char *name) +{ + int i; + + for (i = 0; i < N_ROUND_MODES; i++) { + if (!strcmp(round_names[i], name)) { + return i; + } + } + return -1; +} + +static void QEMU_NORETURN die_host_rounding(enum rounding rounding) +{ + fprintf(stderr, "fatal: '%s' rounding not supported on this host\n", + round_names[rounding]); + exit(EXIT_FAILURE); +} + +static void set_host_precision(enum rounding rounding) +{ + int rhost; + + switch (rounding) { + case ROUND_EVEN: + rhost = FE_TONEAREST; + break; + case ROUND_ZERO: + rhost = FE_TOWARDZERO; + break; + case ROUND_DOWN: + rhost = FE_DOWNWARD; + break; + case ROUND_UP: + rhost = FE_UPWARD; + break; + case ROUND_TIEAWAY: + die_host_rounding(rounding); + return; + default: + g_assert_not_reached(); + } + + if (fesetround(rhost)) { + die_host_rounding(rounding); + } +} + +static void set_soft_precision(enum rounding rounding) +{ + signed char mode; + + switch (rounding) { + case ROUND_EVEN: + mode = float_round_nearest_even; + break; + case ROUND_ZERO: + mode = float_round_to_zero; + break; + case ROUND_DOWN: + mode = float_round_down; + break; + case ROUND_UP: + mode = float_round_up; + break; + case ROUND_TIEAWAY: + mode = float_round_ties_away; + break; + default: + g_assert_not_reached(); + } + soft_status.float_rounding_mode = mode; +} + +static void parse_args(int argc, char *argv[]) +{ + int c; + int val; + int rounding = ROUND_EVEN; + + for (;;) { + c = getopt(argc, argv, "d:ho:p:r:t:zZ"); + if (c < 0) { + break; + } + switch (c) { + case 'd': + duration = atoi(optarg); + break; + case 'h': + usage_complete(argc, argv); + exit(EXIT_SUCCESS); + case 'o': + val = find_name(op_names, optarg); + if (val < 0) { + fprintf(stderr, "Unsupported op '%s'\n", optarg); + exit(EXIT_FAILURE); + } + operation = val; + break; + case 'p': + if (!strcmp(optarg, "single")) { + precision = PREC_SINGLE; + } else if (!strcmp(optarg, "double")) { + precision = PREC_DOUBLE; + } else { + fprintf(stderr, "Unsupported precision '%s'\n", optarg); + exit(EXIT_FAILURE); + } + break; + case 'r': + rounding = round_name_to_mode(optarg); + if (rounding < 0) { + fprintf(stderr, "fatal: invalid rounding mode '%s'\n", optarg); + exit(EXIT_FAILURE); + } + break; + case 't': + val = find_name(tester_names, optarg); + if (val < 0) { + fprintf(stderr, "Unsupported tester '%s'\n", optarg); + exit(EXIT_FAILURE); + } + tester = val; + break; + case 'z': + soft_status.flush_inputs_to_zero = 1; + break; + case 'Z': + soft_status.flush_to_zero = 1; + break; + } + } + + /* set precision and rounding mode based on the tester */ + switch (tester) { + case TESTER_HOST: + set_host_precision(rounding); + break; + case TESTER_SOFT: + set_soft_precision(rounding); + switch (precision) { + case PREC_SINGLE: + precision = PREC_FLOAT32; + break; + case PREC_DOUBLE: + precision = PREC_FLOAT64; + break; + default: + g_assert_not_reached(); + } + break; + default: + g_assert_not_reached(); + } +} + +static void pr_stats(void) +{ + printf("%.2f MFlops\n", (double)n_completed_ops / ns_elapsed * 1e3); +} + +int main(int argc, char *argv[]) +{ + parse_args(argc, argv); + run_bench(); + pr_stats(); + return 0; +} From patchwork Fri Dec 14 13:54:46 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: 153852 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2111464ljp; Fri, 14 Dec 2018 06:08:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/VLQGimzD4rOx61QEYiDCu9ID+ML5Tf8MslH5ZamsxdTlZBp5d9L38Cs0IRkZC8FkhX5TGB X-Received: by 2002:a0c:b8ac:: with SMTP id y44mr2866250qvf.76.1544796482931; Fri, 14 Dec 2018 06:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796482; cv=none; d=google.com; s=arc-20160816; b=UasFcyYmllsHRBXUnUCjFZoB9X12Av8ylninM6TOl6bphUggrmS1fCzB8a8saMNDBN 4BamFYtX5D70TKCm9QI31P40MBaD+i16pV5CduHRwbQ5B/Xfl9mQIXlbNdUDv781XNHA Al8YmEsr9nJff4xcqugroxt2dx6mjdEixU2V9M0K1Ta28L/LZTt6qvfzaseqCQ2/on2O KInd8dK89/kQT2zraC9roSpBbKQDPQUT5eAdccj15nrINlvicOMry64fBNAdiza5AIT7 XobVmjXO+NNKCFBvtP19iFCYl2YVlh2BlM54cP1vUUNEm/trtLJflbmz66xBUkQaJ2ra 9JAQ== 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=v2LkXUad3d8kbcUVsjTYbMWDRQeu5nyQch9NbYRGvp8=; b=STZmkH9mf/d8c2v6dMXUuv6n9m10egcI/G7i3ODdS2IoWK9JeB5zAuPrjDWMGUwqGx l9fDj/35BMZTWRnvS3qe6E6b1HUN2P5EQylVE5pPpXq3/hgdd2j+E09bBhjXWFRCy64d vnaflWhbU3RCtWTPF/pp5MbX7xFG06zTplzZR0S/0DPfQ5o6ToBHJukmnQIzNu99qObg eQg/fPEMsYjpymgcvWlKgL0mwMkkVKPdTIqQBNIVYsDBBKzK0M8X9CVP8UoF6zyKlJQ1 KKOl3tUtQHL4SlpoNF+QFiYeccL9j2+t5p1Ja4kAXVD3S27hOcwK7XxxO9Oz3HPBXtA6 Jr9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hb7X+6Tv; 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 37si944764qvb.136.2018.12.14.06.08.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:08:02 -0800 (PST) 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=Hb7X+6Tv; 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]:33721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo8H-0004Fm-CQ for patch@linaro.org; Fri, 14 Dec 2018 09:08:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvj-0008N4-VO for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvh-0001xO-W1 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:03 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:52326) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvh-0001wf-NV for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:01 -0500 Received: by mail-wm1-x334.google.com with SMTP id m1so5774237wml.2 for ; Fri, 14 Dec 2018 05:55:01 -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=v2LkXUad3d8kbcUVsjTYbMWDRQeu5nyQch9NbYRGvp8=; b=Hb7X+6TvXABzyel4moAeK6NRZ7g9C8cEwBbz2caJHMtXHgHCd/BJsc9RgbmnlhkL9I 4GqsAjBhKbXtxiKbR9o+Wjcj0rETl9NWqhoJielTJVTH0fSvtHy8tKVJln0Hr21MqVjO kCmX9Aj//qEB2ipoXUW7NsNaJh0OT3yMkZQxc= 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=v2LkXUad3d8kbcUVsjTYbMWDRQeu5nyQch9NbYRGvp8=; b=Abgxs9jE1fVIeMRXSehbev8xkj4oEwf9x6mtBN4VxSHJXiGUae1RveSn6sjZevweXG lXr/i8A3alcuGBldOtxubu5c1taZvYldDV4ZLtHctGN+01pRJ5aJik0iLjyBtfICqFmV CYdgOAH5c5iSrFY0CBANzD1QDMjARc/Y2su8cbOYJAqUzwGP3ZuHcRgNWiPF8zCXhwXh Jh+WwQYn703QuSH5lNgdrdYDEMAuqkLstjNjsyv+t65HS+wR0TPmTNmLukvuEo5VHziv Y/qWk6wPr3O/+bjZvI+sy9YJOPe3MluO8TXgz4U1D31zNI7zRUF4zM8QKY8bceQNmh+H dKVw== X-Gm-Message-State: AA+aEWb9f5VJ+PyieiIaRuS16S9MN85MMkX5jyqmBnV9ypLEwW2Yak9E TtnRiuXAJSkYgciFSWZP2CdMTQ== X-Received: by 2002:a7b:c853:: with SMTP id c19mr3181399wml.61.1544795700429; Fri, 14 Dec 2018 05:55:00 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b129sm3356042wmd.24.2018.12.14.05.54.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:56 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B5C1E3E056A; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:46 +0000 Message-Id: <20181214135452.25936-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::334 Subject: [Qemu-devel] [PULL 09/15] fpu: introduce hardfloat 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" The appended paves the way for leveraging the host FPU for a subset of guest FP operations. For most guest workloads (e.g. FP flags aren't ever cleared, inexact occurs often and rounding is set to the default [to nearest]) this will yield sizable performance speedups. The approach followed here avoids checking the FP exception flags register. See the added comment for details. This assumes that QEMU is running on an IEEE754-compliant FPU and that the rounding is set to the default (to nearest). The implementation-dependent specifics of the FPU should not matter; things like tininess detection and snan representation are still dealt with in soft-fp. However, this approach will break on most hosts if we compile QEMU with flags that break IEEE compatibility. There is no way to detect all of these flags at compilation time, but at least we check for -ffast-math (which defines __FAST_MATH__) and disable hardfloat (plus emit a #warning) when it is set. This patch just adds common code. Some operations will be migrated to hardfloat in subsequent patches to ease bisection. Note: some architectures (at least PPC, there might be others) clear the status flags passed to softfloat before most FP operations. This precludes the use of hardfloat, so to avoid introducing a performance regression for those targets, we add a flag to disable hardfloat. In the long run though it would be good to fix the targets so that at least the inexact flag passed to softfloat is indeed sticky. Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index ecdc00c633..468c4554d5 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -83,6 +83,7 @@ this code that are retained. * target-dependent and needs the TARGET_* macros. */ #include "qemu/osdep.h" +#include #include "qemu/bitops.h" #include "fpu/softfloat.h" @@ -95,6 +96,324 @@ this code that are retained. *----------------------------------------------------------------------------*/ #include "fpu/softfloat-macros.h" +/* + * Hardfloat + * + * Fast emulation of guest FP instructions is challenging for two reasons. + * First, FP instruction semantics are similar but not identical, particularly + * when handling NaNs. Second, emulating at reasonable speed the guest FP + * exception flags is not trivial: reading the host's flags register with a + * feclearexcept & fetestexcept pair is slow [slightly slower than soft-fp], + * and trapping on every FP exception is not fast nor pleasant to work with. + * + * We address these challenges by leveraging the host FPU for a subset of the + * operations. To do this we expand on the idea presented in this paper: + * + * Guo, Yu-Chuan, et al. "Translating the ARM Neon and VFP instructions in a + * binary translator." Software: Practice and Experience 46.12 (2016):1591-1615. + * + * The idea is thus to leverage the host FPU to (1) compute FP operations + * and (2) identify whether FP exceptions occurred while avoiding + * expensive exception flag register accesses. + * + * An important optimization shown in the paper is that given that exception + * flags are rarely cleared by the guest, we can avoid recomputing some flags. + * This is particularly useful for the inexact flag, which is very frequently + * raised in floating-point workloads. + * + * We optimize the code further by deferring to soft-fp whenever FP exception + * detection might get hairy. Two examples: (1) when at least one operand is + * denormal/inf/NaN; (2) when operands are not guaranteed to lead to a 0 result + * and the result is < the minimum normal. + */ +#define GEN_INPUT_FLUSH__NOCHECK(name, soft_t) \ + static inline void name(soft_t *a, float_status *s) \ + { \ + if (unlikely(soft_t ## _is_denormal(*a))) { \ + *a = soft_t ## _set_sign(soft_t ## _zero, \ + soft_t ## _is_neg(*a)); \ + s->float_exception_flags |= float_flag_input_denormal; \ + } \ + } + +GEN_INPUT_FLUSH__NOCHECK(float32_input_flush__nocheck, float32) +GEN_INPUT_FLUSH__NOCHECK(float64_input_flush__nocheck, float64) +#undef GEN_INPUT_FLUSH__NOCHECK + +#define GEN_INPUT_FLUSH1(name, soft_t) \ + static inline void name(soft_t *a, float_status *s) \ + { \ + if (likely(!s->flush_inputs_to_zero)) { \ + return; \ + } \ + soft_t ## _input_flush__nocheck(a, s); \ + } + +GEN_INPUT_FLUSH1(float32_input_flush1, float32) +GEN_INPUT_FLUSH1(float64_input_flush1, float64) +#undef GEN_INPUT_FLUSH1 + +#define GEN_INPUT_FLUSH2(name, soft_t) \ + static inline void name(soft_t *a, soft_t *b, float_status *s) \ + { \ + if (likely(!s->flush_inputs_to_zero)) { \ + return; \ + } \ + soft_t ## _input_flush__nocheck(a, s); \ + soft_t ## _input_flush__nocheck(b, s); \ + } + +GEN_INPUT_FLUSH2(float32_input_flush2, float32) +GEN_INPUT_FLUSH2(float64_input_flush2, float64) +#undef GEN_INPUT_FLUSH2 + +#define GEN_INPUT_FLUSH3(name, soft_t) \ + static inline void name(soft_t *a, soft_t *b, soft_t *c, float_status *s) \ + { \ + if (likely(!s->flush_inputs_to_zero)) { \ + return; \ + } \ + soft_t ## _input_flush__nocheck(a, s); \ + soft_t ## _input_flush__nocheck(b, s); \ + soft_t ## _input_flush__nocheck(c, s); \ + } + +GEN_INPUT_FLUSH3(float32_input_flush3, float32) +GEN_INPUT_FLUSH3(float64_input_flush3, float64) +#undef GEN_INPUT_FLUSH3 + +/* + * Choose whether to use fpclassify or float32/64_* primitives in the generated + * hardfloat functions. Each combination of number of inputs and float size + * gets its own value. + */ +#if defined(__x86_64__) +# define QEMU_HARDFLOAT_1F32_USE_FP 0 +# define QEMU_HARDFLOAT_1F64_USE_FP 1 +# define QEMU_HARDFLOAT_2F32_USE_FP 0 +# define QEMU_HARDFLOAT_2F64_USE_FP 1 +# define QEMU_HARDFLOAT_3F32_USE_FP 0 +# define QEMU_HARDFLOAT_3F64_USE_FP 1 +#else +# define QEMU_HARDFLOAT_1F32_USE_FP 0 +# define QEMU_HARDFLOAT_1F64_USE_FP 0 +# define QEMU_HARDFLOAT_2F32_USE_FP 0 +# define QEMU_HARDFLOAT_2F64_USE_FP 0 +# define QEMU_HARDFLOAT_3F32_USE_FP 0 +# define QEMU_HARDFLOAT_3F64_USE_FP 0 +#endif + +/* + * QEMU_HARDFLOAT_USE_ISINF chooses whether to use isinf() over + * float{32,64}_is_infinity when !USE_FP. + * On x86_64/aarch64, using the former over the latter can yield a ~6% speedup. + * On power64 however, using isinf() reduces fp-bench performance by up to 50%. + */ +#if defined(__x86_64__) || defined(__aarch64__) +# define QEMU_HARDFLOAT_USE_ISINF 1 +#else +# define QEMU_HARDFLOAT_USE_ISINF 0 +#endif + +/* + * Some targets clear the FP flags before most FP operations. This prevents + * the use of hardfloat, since hardfloat relies on the inexact flag being + * already set. + */ +#if defined(TARGET_PPC) || defined(__FAST_MATH__) +# if defined(__FAST_MATH__) +# warning disabling hardfloat due to -ffast-math: hardfloat requires an exact \ + IEEE implementation +# endif +# define QEMU_NO_HARDFLOAT 1 +# define QEMU_SOFTFLOAT_ATTR QEMU_FLATTEN +#else +# define QEMU_NO_HARDFLOAT 0 +# define QEMU_SOFTFLOAT_ATTR QEMU_FLATTEN __attribute__((noinline)) +#endif + +static inline bool can_use_fpu(const float_status *s) +{ + if (QEMU_NO_HARDFLOAT) { + return false; + } + return likely(s->float_exception_flags & float_flag_inexact && + s->float_rounding_mode == float_round_nearest_even); +} + +/* + * Hardfloat generation functions. Each operation can have two flavors: + * either using softfloat primitives (e.g. float32_is_zero_or_normal) for + * most condition checks, or native ones (e.g. fpclassify). + * + * The flavor is chosen by the callers. Instead of using macros, we rely on the + * compiler to propagate constants and inline everything into the callers. + * + * We only generate functions for operations with two inputs, since only + * these are common enough to justify consolidating them into common code. + */ + +typedef union { + float32 s; + float h; +} union_float32; + +typedef union { + float64 s; + double h; +} union_float64; + +typedef bool (*f32_check_fn)(union_float32 a, union_float32 b); +typedef bool (*f64_check_fn)(union_float64 a, union_float64 b); + +typedef float32 (*soft_f32_op2_fn)(float32 a, float32 b, float_status *s); +typedef float64 (*soft_f64_op2_fn)(float64 a, float64 b, float_status *s); +typedef float (*hard_f32_op2_fn)(float a, float b); +typedef double (*hard_f64_op2_fn)(double a, double b); + +/* 2-input is-zero-or-normal */ +static inline bool f32_is_zon2(union_float32 a, union_float32 b) +{ + if (QEMU_HARDFLOAT_2F32_USE_FP) { + /* + * Not using a temp variable for consecutive fpclassify calls ends up + * generating faster code. + */ + return (fpclassify(a.h) == FP_NORMAL || fpclassify(a.h) == FP_ZERO) && + (fpclassify(b.h) == FP_NORMAL || fpclassify(b.h) == FP_ZERO); + } + return float32_is_zero_or_normal(a.s) && + float32_is_zero_or_normal(b.s); +} + +static inline bool f64_is_zon2(union_float64 a, union_float64 b) +{ + if (QEMU_HARDFLOAT_2F64_USE_FP) { + return (fpclassify(a.h) == FP_NORMAL || fpclassify(a.h) == FP_ZERO) && + (fpclassify(b.h) == FP_NORMAL || fpclassify(b.h) == FP_ZERO); + } + return float64_is_zero_or_normal(a.s) && + float64_is_zero_or_normal(b.s); +} + +/* 3-input is-zero-or-normal */ +static inline +bool f32_is_zon3(union_float32 a, union_float32 b, union_float32 c) +{ + if (QEMU_HARDFLOAT_3F32_USE_FP) { + return (fpclassify(a.h) == FP_NORMAL || fpclassify(a.h) == FP_ZERO) && + (fpclassify(b.h) == FP_NORMAL || fpclassify(b.h) == FP_ZERO) && + (fpclassify(c.h) == FP_NORMAL || fpclassify(c.h) == FP_ZERO); + } + return float32_is_zero_or_normal(a.s) && + float32_is_zero_or_normal(b.s) && + float32_is_zero_or_normal(c.s); +} + +static inline +bool f64_is_zon3(union_float64 a, union_float64 b, union_float64 c) +{ + if (QEMU_HARDFLOAT_3F64_USE_FP) { + return (fpclassify(a.h) == FP_NORMAL || fpclassify(a.h) == FP_ZERO) && + (fpclassify(b.h) == FP_NORMAL || fpclassify(b.h) == FP_ZERO) && + (fpclassify(c.h) == FP_NORMAL || fpclassify(c.h) == FP_ZERO); + } + return float64_is_zero_or_normal(a.s) && + float64_is_zero_or_normal(b.s) && + float64_is_zero_or_normal(c.s); +} + +static inline bool f32_is_inf(union_float32 a) +{ + if (QEMU_HARDFLOAT_USE_ISINF) { + return isinf(a.h); + } + return float32_is_infinity(a.s); +} + +static inline bool f64_is_inf(union_float64 a) +{ + if (QEMU_HARDFLOAT_USE_ISINF) { + return isinf(a.h); + } + return float64_is_infinity(a.s); +} + +/* Note: @fast_test and @post can be NULL */ +static inline float32 +float32_gen2(float32 xa, float32 xb, float_status *s, + hard_f32_op2_fn hard, soft_f32_op2_fn soft, + f32_check_fn pre, f32_check_fn post, + f32_check_fn fast_test, soft_f32_op2_fn fast_op) +{ + union_float32 ua, ub, ur; + + ua.s = xa; + ub.s = xb; + + if (unlikely(!can_use_fpu(s))) { + goto soft; + } + + float32_input_flush2(&ua.s, &ub.s, s); + if (unlikely(!pre(ua, ub))) { + goto soft; + } + if (fast_test && fast_test(ua, ub)) { + return fast_op(ua.s, ub.s, s); + } + + ur.h = hard(ua.h, ub.h); + if (unlikely(f32_is_inf(ur))) { + s->float_exception_flags |= float_flag_overflow; + } else if (unlikely(fabsf(ur.h) <= FLT_MIN)) { + if (post == NULL || post(ua, ub)) { + goto soft; + } + } + return ur.s; + + soft: + return soft(ua.s, ub.s, s); +} + +static inline float64 +float64_gen2(float64 xa, float64 xb, float_status *s, + hard_f64_op2_fn hard, soft_f64_op2_fn soft, + f64_check_fn pre, f64_check_fn post, + f64_check_fn fast_test, soft_f64_op2_fn fast_op) +{ + union_float64 ua, ub, ur; + + ua.s = xa; + ub.s = xb; + + if (unlikely(!can_use_fpu(s))) { + goto soft; + } + + float64_input_flush2(&ua.s, &ub.s, s); + if (unlikely(!pre(ua, ub))) { + goto soft; + } + if (fast_test && fast_test(ua, ub)) { + return fast_op(ua.s, ub.s, s); + } + + ur.h = hard(ua.h, ub.h); + if (unlikely(f64_is_inf(ur))) { + s->float_exception_flags |= float_flag_overflow; + } else if (unlikely(fabs(ur.h) <= DBL_MIN)) { + if (post == NULL || post(ua, ub)) { + goto soft; + } + } + return ur.s; + + soft: + return soft(ua.s, ub.s, s); +} + /*---------------------------------------------------------------------------- | Returns the fraction bits of the half-precision floating-point value `a'. *----------------------------------------------------------------------------*/ From patchwork Fri Dec 14 13:54:47 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: 153839 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2096312ljp; Fri, 14 Dec 2018 05:55:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/WXsMRnGOUx5u//3s5pKoP02RRCqbxNOdkR0vH16O5zJ2aPx0br8o0npaAjU2i72D7/n3iP X-Received: by 2002:a37:6808:: with SMTP id d8mr2580703qkc.345.1544795734401; Fri, 14 Dec 2018 05:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544795734; cv=none; d=google.com; s=arc-20160816; b=u0NjkbX14YkF1kvD25ErEO0Ia0R8fu1sUBynlvhwRwHeNlDNalGYRp19QJ/y+7I5yf 3RXLqR0aXUMlxSh/sgKySNo8xZlwwMEJlf5ZJDX3oyuC5tGA7eNgBw/i2JgSBVnSYlAT cFvx0rqgacYLJdIanfp3Xb4pezIDT30253XRA2smAI/T4Y/prliiU9o6AUqXmUU/8fKH raxovri6+Eowc3dIgm4lPvXEgmelWkKbfNx+PcsRK3nCmDjsyuz1M91fq6valp+IVrG5 HrY8MnNW/Oi1zk+2sXFKJKuwLyk8UQU2jXfiLO5quGZ2shNJv9paual0QRJsUGuqXmcd MNxA== 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=/TTk5hpzllPNZlAWIwNZcUwm2HQBdZ6NX+gjzis72mo=; b=lW2rvkzmsdFcA/D2yiynaBZX1BBuI9tSI3QEv5IvIYGcEhSogoOi6a6+U2jEwi0XON tyZqNQcsEEjIjUF+d70hhqV8uI8u/Ji5MiELn77s8ilMlAKvQNucTITRnYiDyie5Adkh LD8YazoWYrr2ZjrUYUMBtVN5LGYcxcJe/LUM3Oiw3MxILcnOz9piqrD7pZIAwIKJxlrz SLWjOkaQ7L3+rG0BpMJidMCZ4qTgOWKaOhTw0BDOEuMsY1bXchAfbQDib4kEVBUZv2Gc KRyDd6CBgUgHpBd4MPR1y/6k0yC52oqjuofkhiEGKJsxQEAFKINPut3NFfnsSLHw+8qD NhIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Mzvfn7e5; 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 d27si1957492qvh.180.2018.12.14.05.55.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 05:55:34 -0800 (PST) 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=Mzvfn7e5; 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]:33645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnwD-0008Po-9v for patch@linaro.org; Fri, 14 Dec 2018 08:55:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvi-0008Mg-MG for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvh-0001wu-Az for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:02 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:40395) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvg-0001vm-TQ for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:01 -0500 Received: by mail-wr1-x433.google.com with SMTP id p4so5509606wrt.7 for ; Fri, 14 Dec 2018 05:55:00 -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=/TTk5hpzllPNZlAWIwNZcUwm2HQBdZ6NX+gjzis72mo=; b=Mzvfn7e5NIDv6mm5nQZ0I36n8tXY5xtqQ9qRvJApNngDWafadBRMkY1yS4VG/upoZq 8mRFtuPCVys8bnVcPXdyugslp7vNQMLMTxiD0bRs1ccmUdEp0hLNQ3f9HqPZZz+P0HHd 2euoikliGPzjXq4pzLbil42HXuaYbvv7q6skc= 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=/TTk5hpzllPNZlAWIwNZcUwm2HQBdZ6NX+gjzis72mo=; b=SJPlBugbZLBtpymsjkJxPDYKpH4TcET0aaUWenJ0GauH36K7UKogPmoXmeB+dz1wrX epuNRtGbgSTnB6bqGP+LxnWr39JhP05vJoNTpa+e+0hMQsRNFfYv24MMn+cM8Tcnj0bu UtkiQhiTddCXk+bbS7yU4cCfjVE7IB8b6nw2JvkkD2kwqe7QXHl4fpxkKWgk4410bkDY WqGQZz8T+BLYacZViMD4Rt70a7HXjaXM3qWvRRFdebv4+/m0zm+nylIjq8V2JoDcD8aq 2JgU0/wPkR7I3mI8budAMvJlm/d6Y0mCbR9azCUqcYwqrP/L8lKQ7ArL6ZD2csgAPHVo N5tQ== X-Gm-Message-State: AA+aEWbyAh2gpiIdoWOClbE7uK4ImYrGl9XsPnFY6Xm3X+p+HnQmLREN lk6MwfGZb6CnfvcDLa22u8tRQQ== X-Received: by 2002:adf:f091:: with SMTP id n17mr2715354wro.292.1544795699758; Fri, 14 Dec 2018 05:54:59 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c7sm9177120wre.64.2018.12.14.05.54.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:56 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id CA2703E0575; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:47 +0000 Message-Id: <20181214135452.25936-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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 10/15] hardfloat: implement float32/64 addition and subtraction 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Performance results (single and double precision) for fp-bench: 1. Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz - before: add-single: 135.07 MFlops add-double: 131.60 MFlops sub-single: 130.04 MFlops sub-double: 133.01 MFlops - after: add-single: 443.04 MFlops add-double: 301.95 MFlops sub-single: 411.36 MFlops sub-double: 293.15 MFlops 2. ARM Aarch64 A57 @ 2.4GHz - before: add-single: 44.79 MFlops add-double: 49.20 MFlops sub-single: 44.55 MFlops sub-double: 49.06 MFlops - after: add-single: 93.28 MFlops add-double: 88.27 MFlops sub-single: 91.47 MFlops sub-double: 88.27 MFlops 3. IBM POWER8E @ 2.1 GHz - before: add-single: 72.59 MFlops add-double: 72.27 MFlops sub-single: 75.33 MFlops sub-double: 70.54 MFlops - after: add-single: 112.95 MFlops add-double: 201.11 MFlops sub-single: 116.80 MFlops sub-double: 188.72 MFlops Note that the IBM and ARM machines benefit from having HARDFLOAT_2F{32,64}_USE_FP set to 0. Otherwise their performance can suffer significantly: - IBM Power8: add-single: [1] 54.94 vs [0] 116.37 MFlops add-double: [1] 58.92 vs [0] 201.44 MFlops - Aarch64 A57: add-single: [1] 80.72 vs [0] 93.24 MFlops add-double: [1] 82.10 vs [0] 88.18 MFlops On the Intel machine, having 2F64 set to 1 pays off, but it doesn't for 2F32: - Intel i7-6700K: add-single: [1] 285.79 vs [0] 426.70 MFlops add-double: [1] 302.15 vs [0] 278.82 MFlops Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 468c4554d5..08afa861a7 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1054,49 +1054,128 @@ float16 QEMU_FLATTEN float16_add(float16 a, float16 b, float_status *status) return float16_round_pack_canonical(pr, status); } -float32 QEMU_FLATTEN float32_add(float32 a, float32 b, float_status *status) +float16 QEMU_FLATTEN float16_sub(float16 a, float16 b, float_status *status) +{ + FloatParts pa = float16_unpack_canonical(a, status); + FloatParts pb = float16_unpack_canonical(b, status); + FloatParts pr = addsub_floats(pa, pb, true, status); + + return float16_round_pack_canonical(pr, status); +} + +static float32 QEMU_SOFTFLOAT_ATTR +soft_f32_addsub(float32 a, float32 b, bool subtract, float_status *status) { FloatParts pa = float32_unpack_canonical(a, status); FloatParts pb = float32_unpack_canonical(b, status); - FloatParts pr = addsub_floats(pa, pb, false, status); + FloatParts pr = addsub_floats(pa, pb, subtract, status); return float32_round_pack_canonical(pr, status); } -float64 QEMU_FLATTEN float64_add(float64 a, float64 b, float_status *status) +static inline float32 soft_f32_add(float32 a, float32 b, float_status *status) +{ + return soft_f32_addsub(a, b, false, status); +} + +static inline float32 soft_f32_sub(float32 a, float32 b, float_status *status) +{ + return soft_f32_addsub(a, b, true, status); +} + +static float64 QEMU_SOFTFLOAT_ATTR +soft_f64_addsub(float64 a, float64 b, bool subtract, float_status *status) { FloatParts pa = float64_unpack_canonical(a, status); FloatParts pb = float64_unpack_canonical(b, status); - FloatParts pr = addsub_floats(pa, pb, false, status); + FloatParts pr = addsub_floats(pa, pb, subtract, status); return float64_round_pack_canonical(pr, status); } -float16 QEMU_FLATTEN float16_sub(float16 a, float16 b, float_status *status) +static inline float64 soft_f64_add(float64 a, float64 b, float_status *status) { - FloatParts pa = float16_unpack_canonical(a, status); - FloatParts pb = float16_unpack_canonical(b, status); - FloatParts pr = addsub_floats(pa, pb, true, status); + return soft_f64_addsub(a, b, false, status); +} - return float16_round_pack_canonical(pr, status); +static inline float64 soft_f64_sub(float64 a, float64 b, float_status *status) +{ + return soft_f64_addsub(a, b, true, status); } -float32 QEMU_FLATTEN float32_sub(float32 a, float32 b, float_status *status) +static float hard_f32_add(float a, float b) { - FloatParts pa = float32_unpack_canonical(a, status); - FloatParts pb = float32_unpack_canonical(b, status); - FloatParts pr = addsub_floats(pa, pb, true, status); + return a + b; +} - return float32_round_pack_canonical(pr, status); +static float hard_f32_sub(float a, float b) +{ + return a - b; } -float64 QEMU_FLATTEN float64_sub(float64 a, float64 b, float_status *status) +static double hard_f64_add(double a, double b) { - FloatParts pa = float64_unpack_canonical(a, status); - FloatParts pb = float64_unpack_canonical(b, status); - FloatParts pr = addsub_floats(pa, pb, true, status); + return a + b; +} - return float64_round_pack_canonical(pr, status); +static double hard_f64_sub(double a, double b) +{ + return a - b; +} + +static bool f32_addsub_post(union_float32 a, union_float32 b) +{ + if (QEMU_HARDFLOAT_2F32_USE_FP) { + return !(fpclassify(a.h) == FP_ZERO && fpclassify(b.h) == FP_ZERO); + } + return !(float32_is_zero(a.s) && float32_is_zero(b.s)); +} + +static bool f64_addsub_post(union_float64 a, union_float64 b) +{ + if (QEMU_HARDFLOAT_2F64_USE_FP) { + return !(fpclassify(a.h) == FP_ZERO && fpclassify(b.h) == FP_ZERO); + } else { + return !(float64_is_zero(a.s) && float64_is_zero(b.s)); + } +} + +static float32 float32_addsub(float32 a, float32 b, float_status *s, + hard_f32_op2_fn hard, soft_f32_op2_fn soft) +{ + return float32_gen2(a, b, s, hard, soft, + f32_is_zon2, f32_addsub_post, NULL, NULL); +} + +static float64 float64_addsub(float64 a, float64 b, float_status *s, + hard_f64_op2_fn hard, soft_f64_op2_fn soft) +{ + return float64_gen2(a, b, s, hard, soft, + f64_is_zon2, f64_addsub_post, NULL, NULL); +} + +float32 QEMU_FLATTEN +float32_add(float32 a, float32 b, float_status *s) +{ + return float32_addsub(a, b, s, hard_f32_add, soft_f32_add); +} + +float32 QEMU_FLATTEN +float32_sub(float32 a, float32 b, float_status *s) +{ + return float32_addsub(a, b, s, hard_f32_sub, soft_f32_sub); +} + +float64 QEMU_FLATTEN +float64_add(float64 a, float64 b, float_status *s) +{ + return float64_addsub(a, b, s, hard_f64_add, soft_f64_add); +} + +float64 QEMU_FLATTEN +float64_sub(float64 a, float64 b, float_status *s) +{ + return float64_addsub(a, b, s, hard_f64_sub, soft_f64_sub); } /* From patchwork Fri Dec 14 13:54:48 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: 153845 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2102746ljp; Fri, 14 Dec 2018 06:01:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/UNxeLPlvp69LcVILfdcET+69US/uENzV51jjbX9l8TaFY6Lgfp9SYJeFjUXxoafMKDpMZN X-Received: by 2002:ac8:7518:: with SMTP id u24mr2875891qtq.75.1544796107590; Fri, 14 Dec 2018 06:01:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796107; cv=none; d=google.com; s=arc-20160816; b=hCizr+xda5go/OejpHSSL5ynS4htMjZtBYhEMMliF8cNDsSWZkgB4m+JS3266SzGpj 0jzOuWyc1zdEbRKf4IzFJTXF06emMQp6NN+zvvoU0pOkgkapd9TEX78UQVKw+TjQPGFW aRtHsNyCmdJJvS1AgrPVIGt+hnYjCSzPtJZMsOfaniQLNmvhdfG8VW8FTTw9fmpdvAh1 kU5E9OGMsOGYNQTS68K7Yamkpx9tuuqvVltnGHoz91PYQmZwwDH6OpiuXUlpOVV87UMs o2GhxIXoDkkGPCTAwlJXPYS4kbmzvxVrLtbOGYphscjspGbkdyII2UEojQXRw6QeJJBR duIQ== 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=c/PerMWSPIjcbhwxD3x33iKPftA7Si/+WsOd5NZj+vM=; b=CK9FELqojPjtrJUQxFxqmQUzJ5yOaARKAxhw0oCJJZmDq5u9nibw7c/WtuRmGqPrWT KUOKEYTDdQmjjyCH2U9/RJ/XUT5nO49MZH4d/j/C2qWGB2mSfHIGAHgSnmCAMnBtx3Ev r+o9a3PsQS9GbNw6Tm/cSrOhuXcuEufL30UpOvmqOSLTtMbTJ9nNC79nPx6g7X+aRc6B aekTiqtp3TBqyYsP4usrKp+p8XNLzDvmHr3haQywCWeJO8BiQq6glKPZl54ySpwNZ/2K 25tSbTNgRSmzUN/qZPjWsNt6xJS8o7dm10yBKQPKYSzT8WrYJCppMePSG9WXYfUu+Y20 5auw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=R7cqO7+g; 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 x31si1617055qvc.205.2018.12.14.06.01.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:01:47 -0800 (PST) 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=R7cqO7+g; 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]:33680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo2F-0005UR-1p for patch@linaro.org; Fri, 14 Dec 2018 09:01:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvl-0008O3-QL for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvk-0001yn-O1 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:05 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:32782) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvk-0001yD-H0 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:04 -0500 Received: by mail-wr1-x42e.google.com with SMTP id c14so5550189wrr.0 for ; Fri, 14 Dec 2018 05:55:04 -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=c/PerMWSPIjcbhwxD3x33iKPftA7Si/+WsOd5NZj+vM=; b=R7cqO7+g9IHfK2h1QwSofSj2+d/PHYk9b5hHIG1h5bPLhTYwOwu0TkvkME8YbM6xvj i7dJO9MgTX/PpFYfSW14m2WABBGu3qLciyR77xhGRWyrN8Y4oFy/HW8Zft8FIoSu+Rxc 9dHxSRFPdxXa5qN27CQp4HDcb1vAWnN0X67dY= 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=c/PerMWSPIjcbhwxD3x33iKPftA7Si/+WsOd5NZj+vM=; b=Z7nau/seziB0I0zQgX8rds3rTByQrA6qtPEwr+zFdcuUxSGFdwmRJeuVErnDYo0mPs 9RNob0qo0n9RhL24lA5lDAhcvf4DzjLGVGc0xSh1hpGdU/ZQatMAoh/TJLuJ/xGwwoya 8oWR2ynjGI7mQLzjrmGC0cCUMtictWOMnHheaghvFJcfEkCpJcvG1DTUFD/bEfEFRxS6 Yt0ZtN7jY/l2eyxu676VSCYR3lM9JfQjkANARRmRhunMYMl81c2dF/bh12YlOLXko8FQ FBDxIpi4LK6fD7z2Gy1nVADJ1N912le8YTELAKi5RuTX76neV0FG1yGCtS/46rv+SXRf AgNg== X-Gm-Message-State: AA+aEWYHvLCrNE6w4kXiKU2qsv56gPe4cQ0OwvHCteAdkXKgL4VvdDyx jo9bEpUocioiUfoVbMirztxUXA== X-Received: by 2002:adf:ecc8:: with SMTP id s8mr2653076wro.208.1544795703414; Fri, 14 Dec 2018 05:55:03 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o81sm6308298wmd.10.2018.12.14.05.54.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:59 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id DD5AA3E0593; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:48 +0000 Message-Id: <20181214135452.25936-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::42e Subject: [Qemu-devel] [PULL 11/15] hardfloat: implement float32/64 multiplication 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Performance results for fp-bench: 1. Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz - before: mul-single: 126.91 MFlops mul-double: 118.28 MFlops - after: mul-single: 258.02 MFlops mul-double: 197.96 MFlops 2. ARM Aarch64 A57 @ 2.4GHz - before: mul-single: 37.42 MFlops mul-double: 38.77 MFlops - after: mul-single: 73.41 MFlops mul-double: 76.93 MFlops 3. IBM POWER8E @ 2.1 GHz - before: mul-single: 58.40 MFlops mul-double: 59.33 MFlops - after: mul-single: 60.25 MFlops mul-double: 94.79 MFlops Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 08afa861a7..dad2ce2d9f 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1236,7 +1236,8 @@ float16 QEMU_FLATTEN float16_mul(float16 a, float16 b, float_status *status) return float16_round_pack_canonical(pr, status); } -float32 QEMU_FLATTEN float32_mul(float32 a, float32 b, float_status *status) +static float32 QEMU_SOFTFLOAT_ATTR +soft_f32_mul(float32 a, float32 b, float_status *status) { FloatParts pa = float32_unpack_canonical(a, status); FloatParts pb = float32_unpack_canonical(b, status); @@ -1245,7 +1246,8 @@ float32 QEMU_FLATTEN float32_mul(float32 a, float32 b, float_status *status) return float32_round_pack_canonical(pr, status); } -float64 QEMU_FLATTEN float64_mul(float64 a, float64 b, float_status *status) +static float64 QEMU_SOFTFLOAT_ATTR +soft_f64_mul(float64 a, float64 b, float_status *status) { FloatParts pa = float64_unpack_canonical(a, status); FloatParts pb = float64_unpack_canonical(b, status); @@ -1254,6 +1256,54 @@ float64 QEMU_FLATTEN float64_mul(float64 a, float64 b, float_status *status) return float64_round_pack_canonical(pr, status); } +static float hard_f32_mul(float a, float b) +{ + return a * b; +} + +static double hard_f64_mul(double a, double b) +{ + return a * b; +} + +static bool f32_mul_fast_test(union_float32 a, union_float32 b) +{ + return float32_is_zero(a.s) || float32_is_zero(b.s); +} + +static bool f64_mul_fast_test(union_float64 a, union_float64 b) +{ + return float64_is_zero(a.s) || float64_is_zero(b.s); +} + +static float32 f32_mul_fast_op(float32 a, float32 b, float_status *s) +{ + bool signbit = float32_is_neg(a) ^ float32_is_neg(b); + + return float32_set_sign(float32_zero, signbit); +} + +static float64 f64_mul_fast_op(float64 a, float64 b, float_status *s) +{ + bool signbit = float64_is_neg(a) ^ float64_is_neg(b); + + return float64_set_sign(float64_zero, signbit); +} + +float32 QEMU_FLATTEN +float32_mul(float32 a, float32 b, float_status *s) +{ + return float32_gen2(a, b, s, hard_f32_mul, soft_f32_mul, + f32_is_zon2, NULL, f32_mul_fast_test, f32_mul_fast_op); +} + +float64 QEMU_FLATTEN +float64_mul(float64 a, float64 b, float_status *s) +{ + return float64_gen2(a, b, s, hard_f64_mul, soft_f64_mul, + f64_is_zon2, NULL, f64_mul_fast_test, f64_mul_fast_op); +} + /* * Returns the result of multiplying the floating-point values `a' and * `b' then adding 'c', with no intermediate rounding step after the From patchwork Fri Dec 14 13:54:49 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: 153851 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2108521ljp; Fri, 14 Dec 2018 06:05:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/WBMUvg6ndj+NhBlZ2ARP2siwln51jrVm7+neMmvf8Rgt71yfxddAIxeD+vqnjlD4UCFT1k X-Received: by 2002:ae9:ee02:: with SMTP id i2mr2598564qkg.179.1544796356308; Fri, 14 Dec 2018 06:05:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796356; cv=none; d=google.com; s=arc-20160816; b=yhDy7A7YvAoEMzFCltuZFSKee7wp34GwR0XG73rQQSD+zIRefzd/mRwJ6xY9OzXZo3 MrIY3eK9WmiMrG2oz5vbULN8HEi38/2w1I5gWynDIXhcyWgiFLqu5Af44JKc1/FJ129w fVREY51DoU4b6SxO/NaHg0BPmSvYvFZZego+79GiKi8e7xrzlRoroCspMkxt5cSFkKRv L6nSGHBDuTVnfqLv+FhHWmq7WCGI12TlvrO5rzqA2J84p/7wcrWXfL2wELgJ3EAc33QM vWwpYDVcfqynIxkLmZSODHx8D9p8iUW4rpJ7NVghU05t+ZVsqGopdehU1eTmI1rZUSSC sTEA== 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=RMhnnIR17SBiSba935IicBicApMGoHG/QIEwdhjzhO4=; b=p+fNSexZlaFCwIgj7tMLUIVWuDNRF41bAUhOJXqkBvr8lGrHO5cfjMDLMiT190bFO6 1rrBp5tXG8d1+h04EO+m9Xx4u6YaSNIWpa6zgjW7VsOI732i29C8cIWEQqxNWzzpoZ2y ithx67qi9MtCtTm/nUWI5pf9U86INtaFEEMy5+yJBiVW6CUaL8Bo3YhV+xYpsAXZhnhF 9aiqWDvk2W+FfpMxCGMTwhw5brBBhDcMCmVIZ55BIYv1G8+WcOkz8g/d+lsh9NW3TpVw 054DqeeGYFLVq1PalAIHA4nUdjY0peTFhuEGwwZFA5lsUN5q9NTI+bO5+vAy179HPWje lciw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EcXBmc5r; 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 l7si1982125qth.251.2018.12.14.06.05.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:05:56 -0800 (PST) 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=EcXBmc5r; 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]:33713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo6F-000369-NL for patch@linaro.org; Fri, 14 Dec 2018 09:05:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvs-0008VR-7B for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvm-0001zQ-0l for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:12 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:54268) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvl-0001yv-Pm for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:05 -0500 Received: by mail-wm1-x329.google.com with SMTP id y1so5744184wmi.3 for ; Fri, 14 Dec 2018 05:55: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=RMhnnIR17SBiSba935IicBicApMGoHG/QIEwdhjzhO4=; b=EcXBmc5r33MOI1Ydr4UNsLZ4xUsP9E690qphBDM23W/23IesTMsSkkh7XzqLBQjwMT moEwNkViU9wwppgl797We8pSocYjAc88uzbh4AxqdEqAW/ayVYhZi1bJLHqxA7yPX62w ZeMW0ftvoJwxbtL8F0HI7h38xgocBUE/wUBcw= 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=RMhnnIR17SBiSba935IicBicApMGoHG/QIEwdhjzhO4=; b=pOsay+PZHOUc0+nYa68KPse6nQndSIBgX+QR7OjlNSBRnhVejSKzTpalidW/6A+N8B oRrkJ4lYmYHc7sGPs8Z6ndkYGzXXPVh08ZVRbtyX+JIp4L5xmxbb5m+3QZmQsqxH2zA8 3euAg/6P+Yr+9qEW23UwwbO9BJS6tVRMG/Y4nhs2mX8EF3ufMaVyf+Rxf4UT1vk9bQWQ BIOE52eN2Om/ZEvaTpvtWZghLu8C6Ua9R2RVy0I9tDk7j1OMSibsgNLAqOzsN8Zs46U3 EWUDQ7tpegeDgNpoPqhiKTokV/TH+MnjWKMk8SUBNQqyjWO4o69bxnkVNb1d7xYK/pci Ypyw== X-Gm-Message-State: AA+aEWZpBrjq3M+Nrakuf2LpFgXrswfKsyw3n33Qk6C7+z3hZdxf5Qgv OQVUbcbpU3I132H2MvSn8Cee2w== X-Received: by 2002:a7b:c191:: with SMTP id y17mr3407791wmi.10.1544795704680; Fri, 14 Dec 2018 05:55:04 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id e16sm5878258wrn.72.2018.12.14.05.54.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:54:59 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id F0AF93E059D; Fri, 14 Dec 2018 13:54:53 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:49 +0000 Message-Id: <20181214135452.25936-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::329 Subject: [Qemu-devel] [PULL 12/15] hardfloat: implement float32/64 division 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Performance results for fp-bench: 1. Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz - before: div-single: 34.84 MFlops div-double: 34.04 MFlops - after: div-single: 275.23 MFlops div-double: 216.38 MFlops 2. ARM Aarch64 A57 @ 2.4GHz - before: div-single: 9.33 MFlops div-double: 9.30 MFlops - after: div-single: 51.55 MFlops div-double: 15.09 MFlops 3. IBM POWER8E @ 2.1 GHz - before: div-single: 25.65 MFlops div-double: 24.91 MFlops - after: div-single: 96.83 MFlops div-double: 31.01 MFlops Here setting 2FP64_USE_FP to 1 pays off for x86_64: [1] 215.97 vs [0] 62.15 MFlops Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index dad2ce2d9f..82294458fe 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1628,7 +1628,8 @@ float16 float16_div(float16 a, float16 b, float_status *status) return float16_round_pack_canonical(pr, status); } -float32 float32_div(float32 a, float32 b, float_status *status) +static float32 QEMU_SOFTFLOAT_ATTR +soft_f32_div(float32 a, float32 b, float_status *status) { FloatParts pa = float32_unpack_canonical(a, status); FloatParts pb = float32_unpack_canonical(b, status); @@ -1637,7 +1638,8 @@ float32 float32_div(float32 a, float32 b, float_status *status) return float32_round_pack_canonical(pr, status); } -float64 float64_div(float64 a, float64 b, float_status *status) +static float64 QEMU_SOFTFLOAT_ATTR +soft_f64_div(float64 a, float64 b, float_status *status) { FloatParts pa = float64_unpack_canonical(a, status); FloatParts pb = float64_unpack_canonical(b, status); @@ -1646,6 +1648,64 @@ float64 float64_div(float64 a, float64 b, float_status *status) return float64_round_pack_canonical(pr, status); } +static float hard_f32_div(float a, float b) +{ + return a / b; +} + +static double hard_f64_div(double a, double b) +{ + return a / b; +} + +static bool f32_div_pre(union_float32 a, union_float32 b) +{ + if (QEMU_HARDFLOAT_2F32_USE_FP) { + return (fpclassify(a.h) == FP_NORMAL || fpclassify(a.h) == FP_ZERO) && + fpclassify(b.h) == FP_NORMAL; + } + return float32_is_zero_or_normal(a.s) && float32_is_normal(b.s); +} + +static bool f64_div_pre(union_float64 a, union_float64 b) +{ + if (QEMU_HARDFLOAT_2F64_USE_FP) { + return (fpclassify(a.h) == FP_NORMAL || fpclassify(a.h) == FP_ZERO) && + fpclassify(b.h) == FP_NORMAL; + } + return float64_is_zero_or_normal(a.s) && float64_is_normal(b.s); +} + +static bool f32_div_post(union_float32 a, union_float32 b) +{ + if (QEMU_HARDFLOAT_2F32_USE_FP) { + return fpclassify(a.h) != FP_ZERO; + } + return !float32_is_zero(a.s); +} + +static bool f64_div_post(union_float64 a, union_float64 b) +{ + if (QEMU_HARDFLOAT_2F64_USE_FP) { + return fpclassify(a.h) != FP_ZERO; + } + return !float64_is_zero(a.s); +} + +float32 QEMU_FLATTEN +float32_div(float32 a, float32 b, float_status *s) +{ + return float32_gen2(a, b, s, hard_f32_div, soft_f32_div, + f32_div_pre, f32_div_post, NULL, NULL); +} + +float64 QEMU_FLATTEN +float64_div(float64 a, float64 b, float_status *s) +{ + return float64_gen2(a, b, s, hard_f64_div, soft_f64_div, + f64_div_pre, f64_div_post, NULL, NULL); +} + /* * Float to Float conversions * From patchwork Fri Dec 14 13:54:50 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: 153847 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2105559ljp; Fri, 14 Dec 2018 06:03:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/UNXQPwKsFnn85YBzjiTraiwaOsaEn1Ya7ByaB/lWv3chGL9KOVxwWQpSwSsm2fRAKsyz7H X-Received: by 2002:a37:3081:: with SMTP id w123mr2464956qkw.321.1544796225667; Fri, 14 Dec 2018 06:03:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796225; cv=none; d=google.com; s=arc-20160816; b=TOHo0lDyav3wjTzpcCDms5U2qBqGtbfLtSK2ibH2ewQ3C9ZOyGaMXmjYe+xlPeAUl8 k/jmApphSEQCAKWy+cKV6dUtC2TtTpwYxRUiceqD/YQDgVdgcWlGPdWxncdAN2tJWT1c Ah9gD/8afW4CGMcfHnSS3EeDtsWPQc4ZCJLbjgVYPUS3+kWCMQ0vc7K3JzuB8ieDHHeF MKmUPyBCiqmjczvywdD4tmFc1H9DPtUJrdTMfBO6KwvaRCfdd4m23QmeSzSlBDmp+5M2 V6m0D7N+WnbIKOEsKhKfFgHAjgg2cZKl+M/v0qK8O0IAO4gfGgyI/zsolRhUMCAxWv4R vhTw== 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=avb+rCi+XzCXzUbUL9NU5f6aJ2cYi1T60sE1/2MaAhU=; b=sqgHyx+Hk3LV79uRfaQoa/I4dRZd+yTx6WS59tYdeCbsdB+BTr/6fRKFRSq5ClwbQA e49zIEPkGsCJiunpjKix9o5lfn9nQuzXnadJxv35hREnNDa/diAZ3IdjZ2sIqTwK5nqD CSfXQdgKugSGmDQ3xXxs9FEe/8u0BVvD90ETJP0cSDd7qImBcitQ6JVuk5i7kep8lFsR 1M79BL4SJJE9pOi15Sf2blcXLL8bqfOTJMPbOtAEiljlXL9R9ZCTtgQFdlBY2XTDH7jv owCOQxtaxzIwsiHNV3056dKDAd0W4qCsnO61RCULumNPk5sM/lts6bHEPr08DQZcxXCH G3Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bTil02HG; 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 o5si1133135qkc.148.2018.12.14.06.03.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:03:45 -0800 (PST) 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=bTil02HG; 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]:33697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo48-0007eR-Nn for patch@linaro.org; Fri, 14 Dec 2018 09:03:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvo-0008Rb-Vq for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvl-0001z3-GO for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:08 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:38347) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvl-0001yX-6u for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:05 -0500 Received: by mail-wr1-x42d.google.com with SMTP id v13so5520787wrw.5 for ; Fri, 14 Dec 2018 05:55: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=avb+rCi+XzCXzUbUL9NU5f6aJ2cYi1T60sE1/2MaAhU=; b=bTil02HGqAH60dqoBRucvRmfJZzXi5ougiWcatw0FI7UXQ/JOCmWALgkA0bEnFF3FA AVOsZfBuL9k2+3dIJEBvBXt3onv5NCcXhlyWLch/zFEOEXGObzTkO5X0W+YE3MLglHII dpweD6LsII4D1dBGZnMa4FZRuZNZNK0m8nvys= 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=avb+rCi+XzCXzUbUL9NU5f6aJ2cYi1T60sE1/2MaAhU=; b=fjVyg8IW4ByTovXNIZFt3bLzuAIocFpWwoyRnDSWjMjEq7eLkczoJ1HQCKXnYCw4ZJ 0YWAqC3q/AQwGn0zvtliWNCTJsKKg/lP0hqAI+nNxkaB3OeC1Jb1LobS27oWT6nPydtw NXWlZPK7uN8SlHeKXC3rUojACSmULl6c16eDAE2KN2zHtd5YDlBTBSDWzr/T0hSTik+0 bHK8fHjxK4k8ftJr1Sa1X9NNanirV8LTFWYSIw3kUuQAps8xcnObF3DdZZHbdGZ7kmSA /ua7rTAMiNRSTZuB1dQJS/51BNl5/aWoHJjGWVxIkbVP/sENefkRFcI2hX1MvNayiqdp oyDg== X-Gm-Message-State: AA+aEWZvOGKFFfneAQ0ifgrWxdhjUEJMDaqlE8jkVAMP6EisvWLHhpc1 ZIUh5EMiYIz7JanZg0sdy0aotdRC8GA= X-Received: by 2002:adf:91c3:: with SMTP id 61mr2618080wri.324.1544795703962; Fri, 14 Dec 2018 05:55:03 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id v6sm4156330wro.57.2018.12.14.05.54.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:55:01 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 0FA143E025C; Fri, 14 Dec 2018 13:54:54 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:50 +0000 Message-Id: <20181214135452.25936-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::42d Subject: [Qemu-devel] [PULL 13/15] hardfloat: implement float32/64 fused multiply-add 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Performance results for fp-bench: 1. Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz - before: fma-single: 74.73 MFlops fma-double: 74.54 MFlops - after: fma-single: 203.37 MFlops fma-double: 169.37 MFlops 2. ARM Aarch64 A57 @ 2.4GHz - before: fma-single: 23.24 MFlops fma-double: 23.70 MFlops - after: fma-single: 66.14 MFlops fma-double: 63.10 MFlops 3. IBM POWER8E @ 2.1 GHz - before: fma-single: 37.26 MFlops fma-double: 37.29 MFlops - after: fma-single: 48.90 MFlops fma-double: 59.51 MFlops Here having 3FP64 set to 1 pays off for x86_64: [1] 170.15 vs [0] 153.12 MFlops Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 82294458fe..7554d63495 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1518,8 +1518,9 @@ float16 QEMU_FLATTEN float16_muladd(float16 a, float16 b, float16 c, return float16_round_pack_canonical(pr, status); } -float32 QEMU_FLATTEN float32_muladd(float32 a, float32 b, float32 c, - int flags, float_status *status) +static float32 QEMU_SOFTFLOAT_ATTR +soft_f32_muladd(float32 a, float32 b, float32 c, int flags, + float_status *status) { FloatParts pa = float32_unpack_canonical(a, status); FloatParts pb = float32_unpack_canonical(b, status); @@ -1529,8 +1530,9 @@ float32 QEMU_FLATTEN float32_muladd(float32 a, float32 b, float32 c, return float32_round_pack_canonical(pr, status); } -float64 QEMU_FLATTEN float64_muladd(float64 a, float64 b, float64 c, - int flags, float_status *status) +static float64 QEMU_SOFTFLOAT_ATTR +soft_f64_muladd(float64 a, float64 b, float64 c, int flags, + float_status *status) { FloatParts pa = float64_unpack_canonical(a, status); FloatParts pb = float64_unpack_canonical(b, status); @@ -1540,6 +1542,128 @@ float64 QEMU_FLATTEN float64_muladd(float64 a, float64 b, float64 c, return float64_round_pack_canonical(pr, status); } +float32 QEMU_FLATTEN +float32_muladd(float32 xa, float32 xb, float32 xc, int flags, float_status *s) +{ + union_float32 ua, ub, uc, ur; + + ua.s = xa; + ub.s = xb; + uc.s = xc; + + if (unlikely(!can_use_fpu(s))) { + goto soft; + } + if (unlikely(flags & float_muladd_halve_result)) { + goto soft; + } + + float32_input_flush3(&ua.s, &ub.s, &uc.s, s); + if (unlikely(!f32_is_zon3(ua, ub, uc))) { + goto soft; + } + /* + * When (a || b) == 0, there's no need to check for under/over flow, + * since we know the addend is (normal || 0) and the product is 0. + */ + if (float32_is_zero(ua.s) || float32_is_zero(ub.s)) { + union_float32 up; + bool prod_sign; + + prod_sign = float32_is_neg(ua.s) ^ float32_is_neg(ub.s); + prod_sign ^= !!(flags & float_muladd_negate_product); + up.s = float32_set_sign(float32_zero, prod_sign); + + if (flags & float_muladd_negate_c) { + uc.h = -uc.h; + } + ur.h = up.h + uc.h; + } else { + if (flags & float_muladd_negate_product) { + ua.h = -ua.h; + } + if (flags & float_muladd_negate_c) { + uc.h = -uc.h; + } + + ur.h = fmaf(ua.h, ub.h, uc.h); + + if (unlikely(f32_is_inf(ur))) { + s->float_exception_flags |= float_flag_overflow; + } else if (unlikely(fabsf(ur.h) <= FLT_MIN)) { + goto soft; + } + } + if (flags & float_muladd_negate_result) { + return float32_chs(ur.s); + } + return ur.s; + + soft: + return soft_f32_muladd(ua.s, ub.s, uc.s, flags, s); +} + +float64 QEMU_FLATTEN +float64_muladd(float64 xa, float64 xb, float64 xc, int flags, float_status *s) +{ + union_float64 ua, ub, uc, ur; + + ua.s = xa; + ub.s = xb; + uc.s = xc; + + if (unlikely(!can_use_fpu(s))) { + goto soft; + } + if (unlikely(flags & float_muladd_halve_result)) { + goto soft; + } + + float64_input_flush3(&ua.s, &ub.s, &uc.s, s); + if (unlikely(!f64_is_zon3(ua, ub, uc))) { + goto soft; + } + /* + * When (a || b) == 0, there's no need to check for under/over flow, + * since we know the addend is (normal || 0) and the product is 0. + */ + if (float64_is_zero(ua.s) || float64_is_zero(ub.s)) { + union_float64 up; + bool prod_sign; + + prod_sign = float64_is_neg(ua.s) ^ float64_is_neg(ub.s); + prod_sign ^= !!(flags & float_muladd_negate_product); + up.s = float64_set_sign(float64_zero, prod_sign); + + if (flags & float_muladd_negate_c) { + uc.h = -uc.h; + } + ur.h = up.h + uc.h; + } else { + if (flags & float_muladd_negate_product) { + ua.h = -ua.h; + } + if (flags & float_muladd_negate_c) { + uc.h = -uc.h; + } + + ur.h = fma(ua.h, ub.h, uc.h); + + if (unlikely(f64_is_inf(ur))) { + s->float_exception_flags |= float_flag_overflow; + } else if (unlikely(fabs(ur.h) <= FLT_MIN)) { + goto soft; + } + } + if (flags & float_muladd_negate_result) { + return float64_chs(ur.s); + } + return ur.s; + + soft: + return soft_f64_muladd(ua.s, ub.s, uc.s, flags, s); +} + /* * Returns the result of dividing the floating-point value `a' by the * corresponding value `b'. The operation is performed according to From patchwork Fri Dec 14 13:54:51 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: 153853 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2114418ljp; Fri, 14 Dec 2018 06:10:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/VuIL2yYm5A9uydBHToL4swazEVYrq90iZkfDxdGaPIrBRhYptG/BBM8xG+6UAw5JiHzQy6 X-Received: by 2002:ac8:3b52:: with SMTP id r18mr2824349qtf.81.1544796614969; Fri, 14 Dec 2018 06:10:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796614; cv=none; d=google.com; s=arc-20160816; b=a+ZqlfmUROLBdt03X7EYHH+PkLT/rgCvoFAGkThN1fGBl6tnRUH9k36Gouotr2zEHb 5vZhtQFp6/iwFkzlfIwuJsm6MSHoR8Gcutiy/UcrDp2hgmFEb0WMtM9JPlvCprGt7ayz ND5U5ef+E7Z4/h2rJFtlMJtPy0im1T5LzFpDcWCs9zYoH7nXoojwvRHQoXL2mQkVfuPl HmJh38JeJoJ1ccyaqj3doqbrnhGISuzydcEy39NVHMYNtLaMQlYNgOm/H0RRVBDzaCB6 8K2jFM37ZaSe+vviRBVq7+UjzHvhoFwKgzRhvCkELcBeENEoolk1epZu4cJhAIH9pGUy qACw== 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=Jo7mvkk8gYJZ07ZsA1PodkuMG0iSUhQYU7WZB/7bsKE=; b=Jor+p594eWBHGy7vBQr94LMSdW1O6J4I+usRt880rVdfC3Vn/oTtCqx47swsDCL9VA FhaSG57oYM8TlPtvGqs04r9hnQkKl0YemD/ryMG2beVxtZz7rl70ROb5BvN/6KKV3DVj 3S7quLIE9ZitHjEVrs7zMOvDUptNGKqvY6hcRHL4dAY41kCr3fj/BZG8ZuIdR+lbasl1 sM+IH0/TFP6VoVl9YcVMnBvmGXl4CnEywU1qaDIGzoLAno48/np8Nr7ZhT6GlkNUGd+1 2I0vBbYicZ1Y/JojqsdJsRMs5b/1ZII22fLcBDJ4AuNTG3eTBERK7TcadIqDKkBKDrw0 K3HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kI5nVuRb; 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 16si69262qve.150.2018.12.14.06.10.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:10:14 -0800 (PST) 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=kI5nVuRb; 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]:33732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXoAP-0006mw-Sp for patch@linaro.org; Fri, 14 Dec 2018 09:10:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvo-0008Rc-Vr for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvm-0001zh-Hc for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:08 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:40595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvm-0001zF-AB for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:06 -0500 Received: by mail-wm1-x333.google.com with SMTP id q26so5857356wmf.5 for ; Fri, 14 Dec 2018 05:55: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=Jo7mvkk8gYJZ07ZsA1PodkuMG0iSUhQYU7WZB/7bsKE=; b=kI5nVuRbpFbpeTIAZILGPChFTl+eCN0S7AKUfzyJDUIPULhMDR91obtJEl91N0ri16 V8tUhZ1dkqs7QRDWkOLphmto6TCmrbcPElzVFlwfB9nkE5mX2lQmhpKGXf9Y8tkY5O/8 IAuslT0HyIWXQQVMWX9uSKJfkwR82qF7fd1fk= 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=Jo7mvkk8gYJZ07ZsA1PodkuMG0iSUhQYU7WZB/7bsKE=; b=SickxmQHG7CcKPgF5e7G8PGjl79pSpBb2UdQT4UXSrP+s7tQR26r1aplTa4NRUt6cC omo1VPQ+VF43q2D7OurdPKvja7HdOuaLxgVB8CuJzoxtEqWML7SuC7O+pIJ3tKfEZ7ph Uco0Mg54f/unC47ul/mTCsIrMh6wBVpDkrb5xTSnsKekSktREnQpjsiqO6FW6yb385Pm mHUVrCCJY3d2HAR7HW4yb9cAkovB/qwjh4U7KmlBvvlWUOSA2SKdR5Xx7FKY2eqat9Sb jLifTzZsyD4gzD/EMjak+VRqa3LRDIsJywh08wU3AiSXZpkNzmBM42/p1uT20Yf0/QRM 27lg== X-Gm-Message-State: AA+aEWYuhHhBMl9BJTJ6nYvQ1lND2VEEo1eV1ouqTdwXL/3p20Rfn4dK YPD/52zbGl+HmGe9dB1N4S8gow== X-Received: by 2002:a1c:cc2:: with SMTP id 185mr3468014wmm.1.1544795705289; Fri, 14 Dec 2018 05:55:05 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id s16sm3396312wrt.77.2018.12.14.05.54.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:55:01 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2242A3E05EF; Fri, 14 Dec 2018 13:54:54 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:51 +0000 Message-Id: <20181214135452.25936-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::333 Subject: [Qemu-devel] [PULL 14/15] hardfloat: implement float32/64 square root 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Performance results for fp-bench: Host: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz - before: sqrt-single: 42.30 MFlops sqrt-double: 22.97 MFlops - after: sqrt-single: 311.42 MFlops sqrt-double: 311.08 MFlops Here USE_FP makes a huge difference for f64's, with throughput going from ~200 MFlops to ~300 MFlops. Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 7554d63495..fbd66fd8dc 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -3044,20 +3044,76 @@ float16 QEMU_FLATTEN float16_sqrt(float16 a, float_status *status) return float16_round_pack_canonical(pr, status); } -float32 QEMU_FLATTEN float32_sqrt(float32 a, float_status *status) +static float32 QEMU_SOFTFLOAT_ATTR +soft_f32_sqrt(float32 a, float_status *status) { FloatParts pa = float32_unpack_canonical(a, status); FloatParts pr = sqrt_float(pa, status, &float32_params); return float32_round_pack_canonical(pr, status); } -float64 QEMU_FLATTEN float64_sqrt(float64 a, float_status *status) +static float64 QEMU_SOFTFLOAT_ATTR +soft_f64_sqrt(float64 a, float_status *status) { FloatParts pa = float64_unpack_canonical(a, status); FloatParts pr = sqrt_float(pa, status, &float64_params); return float64_round_pack_canonical(pr, status); } +float32 QEMU_FLATTEN float32_sqrt(float32 xa, float_status *s) +{ + union_float32 ua, ur; + + ua.s = xa; + if (unlikely(!can_use_fpu(s))) { + goto soft; + } + + float32_input_flush1(&ua.s, s); + if (QEMU_HARDFLOAT_1F32_USE_FP) { + if (unlikely(!(fpclassify(ua.h) == FP_NORMAL || + fpclassify(ua.h) == FP_ZERO) || + signbit(ua.h))) { + goto soft; + } + } else if (unlikely(!float32_is_zero_or_normal(ua.s) || + float32_is_neg(ua.s))) { + goto soft; + } + ur.h = sqrtf(ua.h); + return ur.s; + + soft: + return soft_f32_sqrt(ua.s, s); +} + +float64 QEMU_FLATTEN float64_sqrt(float64 xa, float_status *s) +{ + union_float64 ua, ur; + + ua.s = xa; + if (unlikely(!can_use_fpu(s))) { + goto soft; + } + + float64_input_flush1(&ua.s, s); + if (QEMU_HARDFLOAT_1F64_USE_FP) { + if (unlikely(!(fpclassify(ua.h) == FP_NORMAL || + fpclassify(ua.h) == FP_ZERO) || + signbit(ua.h))) { + goto soft; + } + } else if (unlikely(!float64_is_zero_or_normal(ua.s) || + float64_is_neg(ua.s))) { + goto soft; + } + ur.h = sqrt(ua.h); + return ur.s; + + soft: + return soft_f64_sqrt(ua.s, s); +} + /*---------------------------------------------------------------------------- | The pattern for a default generated NaN. *----------------------------------------------------------------------------*/ From patchwork Fri Dec 14 13:54:52 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: 153848 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2106324ljp; Fri, 14 Dec 2018 06:04:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/WW4eD3Uj5S8FrL/D1YIiLPX34+U0GkEnHXGuuOR4njzHYXdtoTpRs2zn/8U1QbiAaOJ3oG X-Received: by 2002:ac8:366a:: with SMTP id n39mr2792492qtb.133.1544796262885; Fri, 14 Dec 2018 06:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544796262; cv=none; d=google.com; s=arc-20160816; b=rg0lsMYdJDW+6bnY854fFlh+x0W5XhhNF41NVoH3SJsfkLJthtqiPjh+/DoS1yGZNk 9tRxM5TJYTIMqUX/zGzT/YxnLiJlkRCCLPwppQ1YRi7je8vZRA3AmRdliumVyrWAFD8w fpPhoXY8U16/QHW7zCRujGF7hOObT2vsNPe1icF4Rw7fU5FZ7/sb3ISKRo17B2qT2Qgx w6TSePhYjUGltfY+TYPerF7hq9YYln7s3XDDiXUrGHYo3vFHHe9kFfAvoSoURv5tGafK PnA0MGZTzQutaAHu6IodYr1Ssu0P32h30X176n8cmsmIUZUV8aRDTEFQAxCm1lpmj53u 19BQ== 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=gOXFTj5uqzApKHFUrx/GP3fxC64evZtaKBwy5sxWSzs=; b=Rw5H9zzCqVhcak2C7qQNI8bYh1zy1bXZPMKoxNl9ugNIhc3nkbn/NmS3HOFkCkCw5s NFeUzXxWVgF04+OHc+sTMhTeJMMfu+qfALUwkFsEUbjil/S+nkK93+GA1OHdjsqpQTEo scEfEgKOuK5FH4FGiGW1GUZJ6Ue9lE6IcU5mUJv0EWGJjZvOYYbfCJ9MEP41P6fhIEY6 6T8fE7B4aZqsJRkUdFQLMhb+OqtDfKZ6mSRYOQwsH2xJi1S2nle6WiYkbJaMmM+pBTWJ 7KtP3B2paR6ArrHCYjk5rkDMfsuJ3Al16QxGTNmj22Kt2gS7ZCW2mC5N+qrw5tKAcuc5 PM+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OdFudG2a; 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 c4si611417qvo.215.2018.12.14.06.04.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Dec 2018 06:04:22 -0800 (PST) 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=OdFudG2a; 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]:33693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXo4k-0007UX-An for patch@linaro.org; Fri, 14 Dec 2018 09:04:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnvp-0008SU-QG for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnvo-00020H-D7 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:09 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51437) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXnvn-0001zw-Hd for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:55:08 -0500 Received: by mail-wm1-x342.google.com with SMTP id s14so5782287wmh.1 for ; Fri, 14 Dec 2018 05:55:07 -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=gOXFTj5uqzApKHFUrx/GP3fxC64evZtaKBwy5sxWSzs=; b=OdFudG2aMKTtdXG2g4SsW1ptxfl6QKi/gMLYHgIU3+NgwFZpwsa1Y2piq4RtUyB1Ka Lz8vX6zHcPceq8XRsITooyHnR9+ZXTArVIqzFvpUuvq3udHo+tDDMoE9nkBxlrZ4QZI9 etVIVT/ATy5ORjYiKvBkKe+6BBU5S5GCowAnM= 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=gOXFTj5uqzApKHFUrx/GP3fxC64evZtaKBwy5sxWSzs=; b=fHOiZkTERM0mJo4kWIGjL0zLK8len7K/iW+3x87I+yXNPrNBtZRDTQ+g9+SveV2I0n RYCk2/5yLwDVPfjAKjLyW4dvMbcKeKvmGJEy5G2Wu3Lem2K1Fcr5dRAW3vAQ3Nham/WD 3K8KI4EWFqZ1TAwVjXdoUDxhc0212HecQ7wA/nfq9Se7DPkS1TdzW5EtIpjmZ2uaZp/N yOxko/7kngQFynAaPlaeS4mR+9RHRI5khJljAQcmkYvGxMDfOBsZCbi8VUIGiH02+aRD ZlDpu68Wy2glkrch1jYgj4wbfjrUgGhIXsURQFtNlRNDq9FLsMBvZGrS+u2Rd/eBTIhF 2gVQ== X-Gm-Message-State: AA+aEWbXhtEqxu5IzqbKhcvGIq/9qntpsX3PYObWGBYoHrdUGHe00cT4 9NEfGyHxMt0FxSGzKP/1Waa1Nw== X-Received: by 2002:a1c:48d:: with SMTP id 135mr3243156wme.1.1544795706323; Fri, 14 Dec 2018 05:55:06 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b18sm6057179wrr.43.2018.12.14.05.54.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 05:55:01 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 3587C3E05F2; Fri, 14 Dec 2018 13:54:54 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 14 Dec 2018 13:54:52 +0000 Message-Id: <20181214135452.25936-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org> References: <20181214135452.25936-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::342 Subject: [Qemu-devel] [PULL 15/15] hardfloat: implement float32/64 comparison 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: "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Performance results for fp-bench: Host: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz - before: cmp-single: 110.98 MFlops cmp-double: 107.12 MFlops - after: cmp-single: 506.28 MFlops cmp-double: 524.77 MFlops Note that flattening both eq and eq_signaling versions would give us extra performance (695v506, 615v524 Mflops for single/double, respectively) but this would emit two essentially identical functions for each eq/signaling pair, which is a waste. Aggregate performance improvement for the last few patches: [ all charts in png: https://imgur.com/a/4yV8p ] 1. Host: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz qemu-aarch64 NBench score; higher is better Host: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz 16 +-+-----------+-------------+----===-------+---===-------+-----------+-+ 14 +-+..........................@@@&&.=.......@@@&&.=...................+-+ 12 +-+..........................@.@.&.=.......@.@.&.=.....+befor=== +-+ 10 +-+..........................@.@.&.=.......@.@.&.=.....+ad@@&& = +-+ 8 +-+.......................$$$%.@.&.=.......@.@.&.=.....+ @@u& = +-+ 6 +-+............@@@&&=+***##.$%.@.&.=***##$$%+@.&.=..###$$%%@i& = +-+ 4 +-+.......###$%%.@.&=.*.*.#.$%.@.&.=*.*.#.$%.@.&.=+**.#+$ +@m& = +-+ 2 +-+.....***.#$.%.@.&=.*.*.#.$%.@.&.=*.*.#.$%.@.&.=.**.#+$+sqr& = +-+ 0 +-+-----***##$%%@@&&=-***##$$%@@&&==***##$$%@@&&==-**##$$%+cmp==-----+-+ FOURIER NEURAL NELU DECOMPOSITION gmean qemu-aarch64 SPEC06fp (test set) speedup over QEMU 4c2c1015905 Host: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz error bars: 95% confidence interval 4.5 +-+---+-----+----+-----+-----+-&---+-----+----+-----+-----+-----+----+-----+-----+-----+-----+----+-----+---+-+ 4 +-+..........................+@@+...........................................................................+-+ 3.5 +-+..............%%@&.........@@..............%%@&............................................+++dsub +-+ 2.5 +-+....&&+.......%%@&.......+%%@..+%%&+..@@&+.%%@&....................................+%%&+.+%@&++%%@& +-+ 2 +-+..+%%&..+%@&+.%%@&...+++..%%@...%%&.+$$@&..%%@&..%%@&.......+%%&+.%%@&+......+%%@&.+%%&++$$@&++d%@& %%@&+-+ 1.5 +-+**#$%&**#$@&**#%@&**$%@**#$%@**#$%&**#$@&**$%@&*#$%@**#$%@**#$%&**#%@&**$%@&*#$%@**#$%&**#$@&*+f%@&**$%@&+-+ 0.5 +-+**#$%&**#$@&**#%@&**$%@**#$%@**#$%&**#$@&**$%@&*#$%@**#$%@**#$%&**#%@&**$%@&*#$%@**#$%&**#$@&+sqr@&**$%@&+-+ 0 +-+**#$%&**#$@&**#%@&**$%@**#$%@**#$%&**#$@&**$%@&*#$%@**#$%@**#$%&**#%@&**$%@&*#$%@**#$%&**#$@&*+cmp&**$%@&+-+ 410.bw416.gam433.434.z435.436.cac437.lesli444.447.de450.so453454.ca459.GemsF465.tont470.lb4482.sphinxgeomean 2. Host: ARM Aarch64 A57 @ 2.4GHz qemu-aarch64 NBench score; higher is better Host: Applied Micro X-Gene, Aarch64 A57 @ 2.4 GHz 5 +-+-----------+-------------+-------------+-------------+-----------+-+ 4.5 +-+........................................@@@&==...................+-+ 3 4 +-+..........................@@@&==........@.@&.=.....+before +-+ 3 +-+..........................@.@&.=........@.@&.=.....+ad@@@&== +-+ 2.5 +-+.....................##$$%%.@&.=........@.@&.=.....+ @m@& = +-+ 2 +-+............@@@&==.***#.$.%.@&.=.***#$$%%.@&.=.***#$$%%d@& = +-+ 1.5 +-+.....***#$$%%.@&.=.*.*#.$.%.@&.=.*.*#.$.%.@&.=.*.*#+$ +f@& = +-+ 0.5 +-+.....*.*#.$.%.@&.=.*.*#.$.%.@&.=.*.*#.$.%.@&.=.*.*#+$+sqr& = +-+ 0 +-+-----***#$$%%@@&==-***#$$%%@@&==-***#$$%%@@&==-***#$$%+cmp==-----+-+ FOURIER NEURAL NLU DECOMPOSITION gmean Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index fbd66fd8dc..59eac97d10 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -2903,28 +2903,109 @@ static int compare_floats(FloatParts a, FloatParts b, bool is_quiet, } } -#define COMPARE(sz) \ -int float ## sz ## _compare(float ## sz a, float ## sz b, \ - float_status *s) \ +#define COMPARE(name, attr, sz) \ +static int attr \ +name(float ## sz a, float ## sz b, bool is_quiet, float_status *s) \ { \ FloatParts pa = float ## sz ## _unpack_canonical(a, s); \ FloatParts pb = float ## sz ## _unpack_canonical(b, s); \ - return compare_floats(pa, pb, false, s); \ -} \ -int float ## sz ## _compare_quiet(float ## sz a, float ## sz b, \ - float_status *s) \ -{ \ - FloatParts pa = float ## sz ## _unpack_canonical(a, s); \ - FloatParts pb = float ## sz ## _unpack_canonical(b, s); \ - return compare_floats(pa, pb, true, s); \ + return compare_floats(pa, pb, is_quiet, s); \ } -COMPARE(16) -COMPARE(32) -COMPARE(64) +COMPARE(soft_f16_compare, QEMU_FLATTEN, 16) +COMPARE(soft_f32_compare, QEMU_SOFTFLOAT_ATTR, 32) +COMPARE(soft_f64_compare, QEMU_SOFTFLOAT_ATTR, 64) #undef COMPARE +int float16_compare(float16 a, float16 b, float_status *s) +{ + return soft_f16_compare(a, b, false, s); +} + +int float16_compare_quiet(float16 a, float16 b, float_status *s) +{ + return soft_f16_compare(a, b, true, s); +} + +static int QEMU_FLATTEN +f32_compare(float32 xa, float32 xb, bool is_quiet, float_status *s) +{ + union_float32 ua, ub; + + ua.s = xa; + ub.s = xb; + + if (QEMU_NO_HARDFLOAT) { + goto soft; + } + + float32_input_flush2(&ua.s, &ub.s, s); + if (isgreaterequal(ua.h, ub.h)) { + if (isgreater(ua.h, ub.h)) { + return float_relation_greater; + } + return float_relation_equal; + } + if (likely(isless(ua.h, ub.h))) { + return float_relation_less; + } + /* The only condition remaining is unordered. + * Fall through to set flags. + */ + soft: + return soft_f32_compare(ua.s, ub.s, is_quiet, s); +} + +int float32_compare(float32 a, float32 b, float_status *s) +{ + return f32_compare(a, b, false, s); +} + +int float32_compare_quiet(float32 a, float32 b, float_status *s) +{ + return f32_compare(a, b, true, s); +} + +static int QEMU_FLATTEN +f64_compare(float64 xa, float64 xb, bool is_quiet, float_status *s) +{ + union_float64 ua, ub; + + ua.s = xa; + ub.s = xb; + + if (QEMU_NO_HARDFLOAT) { + goto soft; + } + + float64_input_flush2(&ua.s, &ub.s, s); + if (isgreaterequal(ua.h, ub.h)) { + if (isgreater(ua.h, ub.h)) { + return float_relation_greater; + } + return float_relation_equal; + } + if (likely(isless(ua.h, ub.h))) { + return float_relation_less; + } + /* The only condition remaining is unordered. + * Fall through to set flags. + */ + soft: + return soft_f64_compare(ua.s, ub.s, is_quiet, s); +} + +int float64_compare(float64 a, float64 b, float_status *s) +{ + return f64_compare(a, b, false, s); +} + +int float64_compare_quiet(float64 a, float64 b, float_status *s) +{ + return f64_compare(a, b, true, s); +} + /* Multiply A by 2 raised to the power N. */ static FloatParts scalbn_decomposed(FloatParts a, int n, float_status *s) {