From patchwork Wed Oct 30 18:09:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 178132 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp1796226ill; Wed, 30 Oct 2019 13:40:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqydOi2zQ+6CXX7U/l/iHW8yOYOJ5YQK8sEP5J2nVjzhU8xaEBoBg+ImJ8CNkkQwYPNR+qcz X-Received: by 2002:ad4:55f0:: with SMTP id bu16mr1109754qvb.80.1572468037345; Wed, 30 Oct 2019 13:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572468037; cv=none; d=google.com; s=arc-20160816; b=oYJU8MTE6HIYZXg1v8alu02Ib+tubWE9DxETcmih+XiByg6FMSUeCUa8sWryS/b++g xsFI0+6bQ9H6hcyp0d2GpMUrKfMPU9p3ObCYSN/AhntKxbQT2dljmSsrrPB3h3bsH9Q+ XECIocbpIWHdRSmhHRkOHOi3TGTm/eovOfw0KFoIVxt9hiGXj6j9Gbkh1P8Y6Cz15KvM 0ZLAoqsph75CLNR981/v/2AJDwtGNVga4p1mkRbXpBsNUFvOSIjHJuiMOFILGY5BfEnX ASaZmOhuDJWKyzixVH9alIrgX3RzBVxh8Go9IAxEg+8EOW1c8GzUsQLLCfqdARQU737P AzRA== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=xSeZDkLwEVTssoJX+QVCXaZ98b8wT4AcO2nXdLSZxaw=; b=Zc+DiNMhPnBCJhT2KmcVGzUYq3yIi0PyWgcjzlUfvQP3Mr4Fij5EFrdwg/3ZpJ18Rv 1O329KbUsddS1KXjnyL47I/EJw6NfJK/6lWzfhdIGulTQrLETjObBgSgJoWR/N7+NdCi gHAcOBFa121Y6qzzyzYRx9caUKjrHYrFonZGRVAqRJpONW1fFfr2ATgvgY0LDq0GF2If Q34VM2oUUq5IOL1w68md4Wm5uYReMfTyJFKaRkkSow6kuzcy/mMfnH5jI+YbAkdbG+fh fUbm83Uo67rnN6lhmuepjQnGTWd3kRiqr8lXb/YkmX+YF7Jy8A/iaFgDSLDptTdkGNwu WdEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TWHVRa35; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b6si2742581qtr.46.2019.10.30.13.40.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Oct 2019 13:40:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TWHVRa35; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPulg-0006C0-PD for patch@linaro.org; Wed, 30 Oct 2019 16:40:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47541) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPsPv-0003ux-91 for qemu-devel@nongnu.org; Wed, 30 Oct 2019 14:10:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPsPs-0006SY-TW for qemu-devel@nongnu.org; Wed, 30 Oct 2019 14:09:58 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:42804) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iPsPs-0006Pq-MP for qemu-devel@nongnu.org; Wed, 30 Oct 2019 14:09:56 -0400 Received: by mail-wr1-x431.google.com with SMTP id a15so3378359wrf.9 for ; Wed, 30 Oct 2019 11:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xSeZDkLwEVTssoJX+QVCXaZ98b8wT4AcO2nXdLSZxaw=; b=TWHVRa35v4AixZFOiLu4/cO6GeQAwV/NZ2/ajz4MlIjP2dkxbT+dRhOQ68mdvbpwJx Iup+FQc5bw3Lh7BoWtzthHXZm8KrNw9dBxskYgzu3Q42+k2FWY7+m3vsPLLJBy4aFr0L UTgAFUPkMZFy0PZltQ377wrLe13KgW6rjYVSBo8kLp4ORUhH27ttKSJiaj7j9wA/nodU P/bncRi3EouuYhAbjjinHRHQbwwMNpPh44FTOscM0qNwOYVmUiZ0fJA4d7yoazWkx+Ti WjU6a8SzUC/kdfQG9s+qDXQMhpqmi0MgLi7lwG2MXaNTTNwrmZcrndQS4mgqtNJD9C5I KuRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xSeZDkLwEVTssoJX+QVCXaZ98b8wT4AcO2nXdLSZxaw=; b=K88cb7BEXxhKvHyUJh53qQBet14UVCs7yCveBfxfrZpSW8E1M2ZkbdamUZ6WT5+ojx 9abEnpNHuL1yiS38H4L4bJo2zrrVRFStGHUPpWKomB21taGY8vbD/ZnmPGtACGDk/SKb SmAkMB0mTFdxvOCXnuiorthcFRTjAir/iTOACzysMKbIxX5ec2nke+ays0F5VjX4OD3B XOzM9JlAsXrHb7mrxbk+c05WGH/ib6U64+mXD9p1PiDG7jadDWVMg7zN3BJnA2xTqfsu iGnQHfEoo9JgjAY31ilQ8VYXDCT9SYAFnW6Rwst+GIu9IT0iOfYc9hjyPdHoXr1LvY4h JH7Q== X-Gm-Message-State: APjAAAVnSzXTcBdOiMQgRbk3HX/fwVpX/UHXlwAXa2yqyI9NsfgzevvY 9I5Cjv85wo9rJKcFCzN440lDfenB60xYAQ== X-Received: by 2002:a05:6000:350:: with SMTP id e16mr1201569wre.276.1572458995071; Wed, 30 Oct 2019 11:09:55 -0700 (PDT) Received: from localhost.localdomain (248.42.142.88.rev.sfr.net. [88.142.42.248]) by smtp.gmail.com with ESMTPSA id t133sm6931299wmb.1.2019.10.30.11.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 11:09:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL for-4.2 1/1] softfp: Added hardfloat conversion from float32 to float64 Date: Wed, 30 Oct 2019 19:09:53 +0100 Message-Id: <20191030180953.24180-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030180953.24180-1-richard.henderson@linaro.org> References: <20191030180953.24180-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Matus Kysel Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Matus Kysel Reintroduce float32_to_float64 that was removed here: https://lists.gnu.org/archive/html/qemu-devel/2018-04/msg00455.html - nbench test it not actually calling this function at all - SPECS 2006 significat number of tests impoved their runtime, just few of them showed small slowdown Reviewed-by: Richard Henderson Signed-off-by: Matus Kysel Message-Id: <20191017142133.59439-1-mkysel@tachyum.com> [rth: Add comment about impossible inexact exceptions.] Signed-off-by: Richard Henderson --- fpu/softfloat.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 0638c9f4e0..301ce3b537 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1920,13 +1920,30 @@ float16 float32_to_float16(float32 a, bool ieee, float_status *s) return float16a_round_pack_canonical(pr, s, fmt16); } -float64 float32_to_float64(float32 a, float_status *s) +static float64 QEMU_SOFTFLOAT_ATTR +soft_float32_to_float64(float32 a, float_status *s) { FloatParts p = float32_unpack_canonical(a, s); FloatParts pr = float_to_float(p, &float64_params, s); return float64_round_pack_canonical(pr, s); } +float64 float32_to_float64(float32 a, float_status *s) +{ + if (likely(float32_is_normal(a))) { + /* Widening conversion can never produce inexact results. */ + union_float32 uf; + union_float64 ud; + uf.s = a; + ud.h = uf.h; + return ud.s; + } else if (float32_is_zero(a)) { + return float64_set_sign(float64_zero, float32_is_neg(a)); + } else { + return soft_float32_to_float64(a, s); + } +} + float16 float64_to_float16(float64 a, bool ieee, float_status *s) { const FloatFmt *fmt16 = ieee ? &float16_params : &float16_params_ahp;