Received: from eggs.gnu.org ([2001:4830:134:3::10]:48223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXSO3-0001Oa-18 for qemu-devel@nongnu.org; Tue, 08 Apr 2014 05:32:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXSNo-0004sP-Pa for qemu-devel@nongnu.org; Tue, 08 Apr 2014 05:32:10 -0400 From: Alexander Graf Date: Tue, 8 Apr 2014 11:31:43 +0200 Message-Id: <1396949514-10494-5-git-send-email-agraf@suse.de> In-Reply-To: <1396949514-10494-1-git-send-email-agraf@suse.de> References: <1396949514-10494-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PULL 2.0 04/15] target-ppc: Bug: VSX Convert to Integer Should Truncate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, qemu-ppc@nongnu.org, Tom Musta From: Tom Musta The various VSX Convert to Integer instructions should truncate the floating point number to an integer value, which is equivalent to a round-to-zero rounding mode. The existing VSX floating point to integer conversion helpers are erroneously using the rounding mode set int the PowerPC Floating Point Status and Control Register (FPSCR). This change corrects this defect by using the appropriate float*_to_*_round_to_zero() routines fro the softfloat library. Signed-off-by: Tom Musta Tested-by: Tom Musta Signed-off-by: Alexander Graf --- target-ppc/fpu_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c index fd91239..691d572 100644 --- a/target-ppc/fpu_helper.c +++ b/target-ppc/fpu_helper.c @@ -2568,7 +2568,8 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) \ fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0); \ xt.tfld = rnan; \ } else { \ - xt.tfld = stp##_to_##ttp(xb.sfld, &env->fp_status); \ + xt.tfld = stp##_to_##ttp##_round_to_zero(xb.sfld, \ + &env->fp_status); \ if (env->fp_status.float_exception_flags & float_flag_invalid) { \ fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0); \ } \ -- 1.8.1.4