From patchwork Fri Sep 28 15:17:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 11854 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 41FFB23EFD for ; Fri, 28 Sep 2012 15:17:20 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id CE451A18D32 for ; Fri, 28 Sep 2012 15:17:19 +0000 (UTC) Received: by iagf6 with SMTP id f6so45584iag.11 for ; Fri, 28 Sep 2012 08:17:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=Fk+NQMOAN9A+LJg5isfticwBOTJlT1Ve7L0hR2R+kFE=; b=GF+YkKWLhML90K4L9vH+VSDYIME7PEvNy15vujGZNYwKeA0t+I+G120HVU/MMeMWfJ USKZZjZ5WNuxT9I2pR1h4UlzoUDsTU7mhgjxNKLCTr07SFvp7WXh2TFaARtx1CBzENuV dYA00UCvkqnyw90BNEXPGta82LhiM58oh+Yj/NBCfuIxWmkT9YYDTw2podGcEvv5Wfkt dkQ/sS7H/cCQNJLkkV+1Os369qHFg6m2KrFhhApgpF9flQoO3+seY4/EN6Tp32QeGdRS GHwsgJmlxfoBSgRsIn+10JJm0QxLnsOLor75mAS427yw2y9EVxBuqwNcygza7h563P0c 5Kyw== Received: by 10.50.160.165 with SMTP id xl5mr2008485igb.0.1348845437521; Fri, 28 Sep 2012 08:17:17 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp477659igc; Fri, 28 Sep 2012 08:17:16 -0700 (PDT) Received: by 10.216.241.137 with SMTP id g9mr3209426wer.122.1348845434706; Fri, 28 Sep 2012 08:17:14 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id k79si8197249wej.48.2012.09.28.08.17.13 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 08:17:14 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1THcJM-0005EO-28; Fri, 28 Sep 2012 16:17:04 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: Alexander Graf , Aurelien Jarno , Richard Henderson , patches@linaro.org Subject: [PATCH] fpu/softfloat.c: Return correctly signed values from uint64_to_float32 Date: Fri, 28 Sep 2012 16:17:03 +0100 Message-Id: <1348845423-20085-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQmuu0o9NbrK6v8JDO6HRh8hTNpqk3bd13UQ4FChK4eHS6b/0Gvkwzx9Ur3ysEqj5DJCZNrb The uint64_to_float32() conversion function was incorrectly always returning numbers with the sign bit set (ie negative numbers). Correct this so we return positive numbers instead. Signed-off-by: Peter Maydell Reviewed-by: Aurelien Jarno --- As far as I can see we use this function only in the three PPC SPE insns efscfuf, efsctsf, efsctuf. It is therefore untested(!); if anybody with PPC hw to test against could check the results of those functions that would be cool. fpu/softfloat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index b29256a..91497e8 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1238,7 +1238,7 @@ float32 uint64_to_float32( uint64 a STATUS_PARAM ) if ( a == 0 ) return float32_zero; shiftCount = countLeadingZeros64( a ) - 40; if ( 0 <= shiftCount ) { - return packFloat32( 1 > 0, 0x95 - shiftCount, a< 0, 0x9C - shiftCount, a STATUS_VAR ); + return roundAndPackFloat32(0, 0x9C - shiftCount, a STATUS_VAR); } }