From patchwork Sun May 15 14:13:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 95618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 38CA6B6EF1 for ; Mon, 16 May 2011 00:13:55 +1000 (EST) Received: from localhost ([::1]:36685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLc4u-00005Y-CU for incoming@patchwork.ozlabs.org; Sun, 15 May 2011 10:13:52 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLc4X-0008Vn-32 for qemu-devel@nongnu.org; Sun, 15 May 2011 10:13:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QLc4V-0007hR-10 for qemu-devel@nongnu.org; Sun, 15 May 2011 10:13:29 -0400 Received: from hall.aurel32.net ([88.191.126.93]:42083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLc4U-0007hF-Sl for qemu-devel@nongnu.org; Sun, 15 May 2011 10:13:26 -0400 Received: from [2001:470:d4ed:0:5e26:aff:fe2b:6f5b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1QLc4U-0005xf-8J; Sun, 15 May 2011 16:13:26 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.72) (envelope-from ) id 1QLc4S-00025B-VE; Sun, 15 May 2011 16:13:24 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Sun, 15 May 2011 16:13:21 +0200 Message-Id: <1305468801-6015-12-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1305468801-6015-1-git-send-email-aurelien@aurel32.net> References: <1305468801-6015-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 88.191.126.93 Cc: Aurelien Jarno Subject: [Qemu-devel] [PATCH 11/11] target-i386: use floatx80_log2() to implement helper_fyl2x*() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use the new floatx80_log2() softfloat function to implement both helper_fyl2x() and helper_fyl2xp1(). Signed-off-by: Aurelien Jarno --- target-i386/op_helper.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index eccb957..b021a00 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -3972,12 +3972,11 @@ void helper_f2xm1(void) void helper_fyl2x(void) { - double fptemp = floatx80_to_double(ST0); + floatx80 temp; - if (fptemp>0.0){ - fptemp = log(fptemp)/log(2.0); /* log2(ST) */ - fptemp *= floatx80_to_double(ST1); - ST1 = double_to_floatx80(fptemp); + if (! floatx80_is_neg(ST0)) { + temp = floatx80_log2(ST0, &env->fp_status); + ST1 = floatx80_mul(ST1, temp, &env->fp_status); fpop(); } else { env->fpus &= (~0x4700); @@ -4153,12 +4152,13 @@ void helper_fprem(void) void helper_fyl2xp1(void) { - double fptemp = floatx80_to_double(ST0); + floatx80 temp; - if ((fptemp+1.0)>0.0) { - fptemp = log(fptemp+1.0) / log(2.0); /* log2(ST+1.0) */ - fptemp *= floatx80_to_double(ST1); - ST1 = double_to_floatx80(fptemp); + temp = floatx80_add(ST0, floatx80_one, &env->fp_status); + if (!floatx80_is_neg(temp)) { + temp = floatx80_add(ST0, floatx80_one, &env->fp_status); + temp = floatx80_log2(temp, &env->fp_status); + ST1 = floatx80_mul(ST1, temp, &env->fp_status); fpop(); } else { env->fpus &= (~0x4700);