From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Aurelien Jarno Date: Sun, 15 May 2011 16:13:21 +0200 Message-Id: <1305468801-6015-12-git-send-email-aurelien@aurel32.net> In-Reply-To: <1305468801-6015-1-git-send-email-aurelien@aurel32.net> References: <1305468801-6015-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH 11/11] target-i386: use floatx80_log2() to implement helper_fyl2x*() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno 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); -- 1.7.2.3