From patchwork Tue Aug 14 00:26:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 144066 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3691615ljj; Mon, 13 Aug 2018 17:30:18 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxCja35LvO6s5gvvSoqJ4wS7gXw+N9WoTW6V5KRwUlsWfChz9X+oBjeXVRjIkqwBFAoMGlz X-Received: by 2002:aed:2518:: with SMTP id v24-v6mr19087789qtc.151.1534206618774; Mon, 13 Aug 2018 17:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534206618; cv=none; d=google.com; s=arc-20160816; b=a02vFKBgLbIjoE/ynMJkNmYJbd/Sip9FNgsKPgIkZqfkk1PwW2rLiFYwZhX1AbroLy +mVLEAXHfI1GUW7PtxJEbEhIfYF7S8X1HzQ1GEloQKFMN3hGAvICcoMc8AO4/eg36UUq gTnzhQDtrwQyjGJ14nSC6nwAJs+c+zhHxMKlBPR0j/rJOcxlqC7f4brDQMZw6pOCTlMz As354CzEUykubcG8jWZshWxK994dseg1l1rRcu4AIZBgN5OoJrjGevQa1lbSkfCIq9pb nbvkO9UnEmbRWqAyLxvQ7TQgmNkkc5o9QHRi+cNPdMC2+nKk5vE7TZY3CJiMU7/5Byuz Cs8g== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=8O4/e0LK0zeeyoKlBYwAe9tKELxEjfMaZ46nQW8OB88=; b=OXbVr3p2HOUDMQsc64TNZ4o8D/w2TcgliHbGXxW8wQIpqqRmIlxxVr04xa2k+FAoU/ g+MHCrv2TL7PfRAR04eYwUlfWXIciVA13XUurPhVXca/ODBMwQ023GdWFyJj+oM7aPgg 5GAMyPpgIYOLNS5KSFKqvyHVa41T7cYT1OLssHx/8NJpgfARB6W9naeZ4WEM5IdNy3GG KuGc0bB3SpzicB4j4gqw5YE/K4isU8FdlfSGyoZkWozw99V0HXpbg/4y4gNXeuqvcvi8 raKtS4PNhj6QpWj94Bgb6G+Ick3PPjrkOuZMmmDO3S8aS46GkuhBLXo0HH2O6nEq/Bv2 JICQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JHCjQYsB; 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 i35-v6si6007658qvc.125.2018.08.13.17.30.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 13 Aug 2018 17:30:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JHCjQYsB; 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]:41914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpNE2-0007Eg-8N for patch@linaro.org; Mon, 13 Aug 2018 20:30:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpNAs-0004us-Ru for qemu-devel@nongnu.org; Mon, 13 Aug 2018 20:27:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpNAr-0000o1-SY for qemu-devel@nongnu.org; Mon, 13 Aug 2018 20:27:02 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:39699) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fpNAr-0000mx-NI for qemu-devel@nongnu.org; Mon, 13 Aug 2018 20:27:01 -0400 Received: by mail-pg1-x52a.google.com with SMTP id a11-v6so8278914pgw.6 for ; Mon, 13 Aug 2018 17:27:01 -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=8O4/e0LK0zeeyoKlBYwAe9tKELxEjfMaZ46nQW8OB88=; b=JHCjQYsBRTk6smEnBqa3IRxwLx6WYz9r0YKo5K7l3okgWQqWY8EmVY0XW7MFtWGiV+ TCEUK3/Gx2krjmYFlhNHj196G2NajiBKONbAg9tgOvPkkNl+0I9trBSLkA2vRV3mYVA7 EyfnDWjqm8ySd40kdPqbrDZUTqr0Tqsi/daAs= 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=8O4/e0LK0zeeyoKlBYwAe9tKELxEjfMaZ46nQW8OB88=; b=i4lQlva4MngsJNCAvjanRYjAsJFmod9jDEJhxgeWLcSSUm/Xxjmu1K1kx1rm58D1O+ JUVMkbof1SUAqGOENVOTqpp0dWkO2AD3Rk9tpambxs2EyvRU7wB5PQlkM7yjVBfSCP4e UnNBId/F3A2b+J0UqA48QRoO/52g5QPUpeSN1X2xUsyHb4lqc8opGc5wxMEe/N9Qev1j H/z4rxPVFqy5qlKicVkZTLIuolGWCVabHWCHRYWmGDQEzYVA/dm9J3//Rhfz1Nh5pPRF oeQEe1NdYn0vZFSwTxoS2zqoFZuKMXUbwF/b6xLmukuwt9Hy6BAXhIG0/yqmLFAJb0tX UwXQ== X-Gm-Message-State: AOUpUlHXoYOzv+w19i46b11TNgh4kEXhPUXzb3TPhU/2uHKin9sisMhf V0g5xWtZTtPWPeThXkbvTicMCUPBKF0= X-Received: by 2002:a63:5758:: with SMTP id h24-v6mr18822824pgm.432.1534206420347; Mon, 13 Aug 2018 17:27:00 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id w192-v6sm22266976pfd.74.2018.08.13.17.26.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Aug 2018 17:26:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 17:26:52 -0700 Message-Id: <20180814002653.12828-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180814002653.12828-1-richard.henderson@linaro.org> References: <20180814002653.12828-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52a Subject: [Qemu-devel] [PATCH 3/4] target/arm: Use the int-to-float-scale softfloat routines 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: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 61454a77ec..38439a2ee8 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11550,12 +11550,7 @@ float32 VFP_HELPER(fcvts, d)(float64 x, CPUARMState *env) #define VFP_CONV_FIX_FLOAT(name, p, fsz, isz, itype) \ float##fsz HELPER(vfp_##name##to##p)(uint##isz##_t x, uint32_t shift, \ void *fpstp) \ -{ \ - float_status *fpst = fpstp; \ - float##fsz tmp; \ - tmp = itype##_to_##float##fsz(x, fpst); \ - return float##fsz##_scalbn(tmp, -(int)shift, fpst); \ -} +{ return itype##_to_##float##fsz##_scalbn(x, -shift, fpstp); } /* Notice that we want only input-denormal exception flags from the * scalbn operation: the other possible flags (overflow+inexact if @@ -11608,38 +11603,24 @@ VFP_CONV_FIX_A64(uq, s, 32, 64, uint64) #undef VFP_CONV_FLOAT_FIX_ROUND #undef VFP_CONV_FIX_A64 -/* Conversion to/from f16 can overflow to infinity before/after scaling. - * Therefore we convert to f64, scale, and then convert f64 to f16; or - * vice versa for conversion to integer. - * - * For 16- and 32-bit integers, the conversion to f64 never rounds. - * For 64-bit integers, any integer that would cause rounding will also - * overflow to f16 infinity, so there is no double rounding problem. - */ - -static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst) -{ - return float64_to_float16(float64_scalbn(f, -shift, fpst), true, fpst); -} - uint32_t HELPER(vfp_sltoh)(uint32_t x, uint32_t shift, void *fpst) { - return do_postscale_fp16(int32_to_float64(x, fpst), shift, fpst); + return int32_to_float16_scalbn(x, -shift, fpst); } uint32_t HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst) { - return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst); + return uint32_to_float16_scalbn(x, -shift, fpst); } uint32_t HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst) { - return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst); + return int64_to_float16_scalbn(x, -shift, fpst); } uint32_t HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst) { - return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst); + return uint64_to_float16_scalbn(x, -shift, fpst); } static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst)