From patchwork Tue Aug 14 00:26:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 144062 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3689469ljj; Mon, 13 Aug 2018 17:27:24 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzJjwMhrvRq1DoXrO7SV7TgZOEATSdUEGSPtI6UaEHxLRmGIhu8or0gyODhizqCnCkNlgEx X-Received: by 2002:aed:3d95:: with SMTP id i21-v6mr19280170qtf.232.1534206444874; Mon, 13 Aug 2018 17:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534206444; cv=none; d=google.com; s=arc-20160816; b=GSAlzv+Nk2Hwausk7OTTxWoH0coNjGzIViSjAjToJdad8vD1Zg6J9is4RMR6dD0VGb OhyIPbmUPoLZAkPXB/xUmSn0prAqpJO9tPygeFAMovZO8JCFUlgAyODLpFAsFU3n69/7 o1WrQng69TZKL0OiHaZbYzy7CQTAjvOUWa/rJDTNjFbHpVt4hi4TeFCQWdKS8CP9PsQo iHX0nlCyFDLEY681TdaiOPeqAqQBnoVnM6KoJ8giCjah+XwgI/KzOu2m6X4MdrBiAXM7 XEHmijE442yZmr5V6v59pv8lAw54y/QfZmQTdDEkw48WblXZJhcEk3z2wsy9GPLIyfUw Mw8g== 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:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=RNv7t40zEq6f6fooiar+hEcf2S/lXGqLc9NA6AlTOFk=; b=PJkX1peCGyVQoQI5018rxUhtMAF/dTqwhQudUaVDCsbrlzTFUoPd3Q87ORCMPw74Ql jUGf3AE5UJCQI7LQn3p6eDPt+QHFRD2PHrYJClsjbUjyLSrZJ2xDFfmQU7x/FFv2m3F/ bG+o4GP6cYM5GO8z6hdeGtRluMR+gX/XV5sItEkJ6EPcexQUhq9oRxwbvVPk90ZfDtip IGJfIEENs9lH1qVQg5ghQgWC1IBbZ35yPX8fQ6PEoUJzYj08wbjlRkn/lvwd5B+cLXhA kOOnJfZhXl1FgrQjl83Nterw1S7kEf78xqEG1sT/pCbawn2C6JOT8y116e6TmXP5n1Le uK8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=P1j3JC+l; 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 z3-v6si1137118qth.129.2018.08.13.17.27.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 13 Aug 2018 17:27:24 -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=P1j3JC+l; 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]:41900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpNBE-0004ux-Az for patch@linaro.org; Mon, 13 Aug 2018 20:27:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpNAr-0004um-8V for qemu-devel@nongnu.org; Mon, 13 Aug 2018 20:27:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpNAo-0000kn-4d for qemu-devel@nongnu.org; Mon, 13 Aug 2018 20:27:01 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:38544) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fpNAn-0000kZ-RX for qemu-devel@nongnu.org; Mon, 13 Aug 2018 20:26:58 -0400 Received: by mail-pf1-x441.google.com with SMTP id x17-v6so8427466pfh.5 for ; Mon, 13 Aug 2018 17:26:57 -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; bh=RNv7t40zEq6f6fooiar+hEcf2S/lXGqLc9NA6AlTOFk=; b=P1j3JC+lbk1i0fYmRdeVgpbB8SzXcjTOWYPr1hBODLfxkJzhL8/RdVDg7O1xIcR5Lh mpdHEiMf+CrOwobSJCnZ9WR8buR0UW7lK7EG9sG6gNBTkGxERFnR5eGnipMJTEaIQTnW 4QE1/oijXLQ0hUkeqTTAOsyOL2IkEbtFBC8JE= 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; bh=RNv7t40zEq6f6fooiar+hEcf2S/lXGqLc9NA6AlTOFk=; b=bAbM082bROF8rZc1llztnVTWt3Q27A2sIWdrdFTDuE1QCsmJFXTgGkrxG4qSv1HKA3 B6ROwsWqbF+UmlWCM0/F8kG1k0PNY8rnhZNFBPIhqz3dzRDRrR7B39USkXgc7VwhERfM lKsYEPKv22wcGHT9Xj9OqHzAMhMPzrmL95Pe5iLlVlEx64bwekQ7meFbFcvNXQVtXJTN VGIL3hcqd2CUYEJpFki+vg//gluPYsnSEeYjM4S3RXWZ5VeyGvJPaWFQ5L5T9ZITEPFy RLtbdH02H1583UUmDtMBQeDzdqpss3OsBzEytWxGJUTG3eNYm+2QD1JPWixpsq3dk6bb LGzg== X-Gm-Message-State: AOUpUlFQYfiEElsiKRlpXcdI5gYft2ZjnrwbbeC6qzGu9IkbV8oKyMnm QW+6QOco+ZTRLbbPfeVQjSILQ9AThEM= X-Received: by 2002:a63:380d:: with SMTP id f13-v6mr18934667pga.124.1534206416110; Mon, 13 Aug 2018 17:26:56 -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.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Aug 2018 17:26:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 17:26:49 -0700 Message-Id: <20180814002653.12828-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH 0/4] target/arm: Fix int64_to_float16 double-rounding 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" In 88808a022c0, I tried to fix an overflow problem that affected float16 scaling by coverting first to float64 and then rounding after that. However, Laurent reported that -0x3ff40000000001 converted to float16 resulted in 0xfbfe instead of the expected 0xfbff. This is caused by the inexact conversion to float64. Rather than build more logic into target/arm to compensate, just add a function that takes a scaling parameter so that the whole thing is done all at once with only one rounding. I don't have a failing test case for the float-to-int paths, but it seemed best to apply the same solution. r~ Richard Henderson (4): softfloat: Add scaling int-to-float routines softfloat: Add scaling float-to-int routines target/arm: Use the int-to-float-scale softfloat routines target/arm: Use the float-to-int-scale softfloat routines include/fpu/softfloat.h | 169 ++++++++---- fpu/softfloat.c | 579 +++++++++++++++++++++++++++++++--------- target/arm/helper.c | 130 ++++----- 3 files changed, 628 insertions(+), 250 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell