From patchwork Tue Apr 12 21:59:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 90910 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 00D2CB6F3E for ; Wed, 13 Apr 2011 11:44:31 +1000 (EST) Received: from localhost ([::1]:44972 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9p88-0001Kf-4A for incoming@patchwork.ozlabs.org; Tue, 12 Apr 2011 21:44:28 -0400 Received: from eggs.gnu.org ([140.186.70.92]:37774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9p7R-0007v1-Eb for qemu-devel@nongnu.org; Tue, 12 Apr 2011 21:43:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9m78-0005Fs-3H for qemu-devel@nongnu.org; Tue, 12 Apr 2011 18:31:26 -0400 Received: from hall.aurel32.net ([88.191.126.93]:48402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9m77-0005CZ-NA for qemu-devel@nongnu.org; Tue, 12 Apr 2011 18:31:13 -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 1Q9m75-0001Wf-RS; Wed, 13 Apr 2011 00:31:12 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.72) (envelope-from ) id 1Q9lcX-0002ZD-9O; Tue, 12 Apr 2011 23:59:37 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Tue, 12 Apr 2011 23:59:17 +0200 Message-Id: <1302645571-20500-6-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1302645571-20500-1-git-send-email-aurelien@aurel32.net> References: <1302645571-20500-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 05/19] target-i386: add floatx_{add, mul, sub} and use them 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 Add floatx_{add,mul,sub} defines, and use them instead of using direct C operations. Signed-off-by: Aurelien Jarno --- target-i386/exec.h | 6 ++++++ target-i386/op_helper.c | 18 ++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/target-i386/exec.h b/target-i386/exec.h index 63a23cd..ae6b947 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -110,6 +110,9 @@ static inline void svm_check_intercept(uint32_t type) #define float64_to_floatx float64_to_floatx80 #define floatx_to_float32 floatx80_to_float32 #define floatx_to_float64 floatx80_to_float64 +#define floatx_add floatx80_add +#define floatx_mul floatx80_mul +#define floatx_sub floatx80_sub #define floatx_abs floatx80_abs #define floatx_chs floatx80_chs #define floatx_round_to_int floatx80_round_to_int @@ -126,6 +129,9 @@ static inline void svm_check_intercept(uint32_t type) #define float64_to_floatx(x, e) (x) #define floatx_to_float32 float64_to_float32 #define floatx_to_float64(x, e) (x) +#define floatx_add float64_add +#define floatx_mul float64_mul +#define floatx_sub float64_sub #define floatx_abs float64_abs #define floatx_chs float64_chs #define floatx_round_to_int float64_round_to_int diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 43fbd0c..a73427f 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -3711,22 +3711,22 @@ void helper_fucomi_ST0_FT0(void) void helper_fadd_ST0_FT0(void) { - ST0 += FT0; + ST0 = floatx_add(ST0, FT0, &env->fp_status); } void helper_fmul_ST0_FT0(void) { - ST0 *= FT0; + ST0 = floatx_mul(ST0, FT0, &env->fp_status); } void helper_fsub_ST0_FT0(void) { - ST0 -= FT0; + ST0 = floatx_sub(ST0, FT0, &env->fp_status); } void helper_fsubr_ST0_FT0(void) { - ST0 = FT0 - ST0; + ST0 = floatx_sub(FT0, ST0, &env->fp_status); } void helper_fdiv_ST0_FT0(void) @@ -3743,24 +3743,22 @@ void helper_fdivr_ST0_FT0(void) void helper_fadd_STN_ST0(int st_index) { - ST(st_index) += ST0; + ST(st_index) = floatx_add(ST(st_index), ST0, &env->fp_status); } void helper_fmul_STN_ST0(int st_index) { - ST(st_index) *= ST0; + ST(st_index) = floatx_mul(ST(st_index), ST0, &env->fp_status); } void helper_fsub_STN_ST0(int st_index) { - ST(st_index) -= ST0; + ST(st_index) = floatx_sub(ST(st_index), ST0, &env->fp_status); } void helper_fsubr_STN_ST0(int st_index) { - CPU86_LDouble *p; - p = &ST(st_index); - *p = ST0 - *p; + ST(st_index) = floatx_sub(ST0, ST(st_index), &env->fp_status); } void helper_fdiv_STN_ST0(int st_index)