From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MM3yx-0006M7-4Z for qemu-devel@nongnu.org; Wed, 01 Jul 2009 13:52:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MM3ys-0006Da-GA for qemu-devel@nongnu.org; Wed, 01 Jul 2009 13:52:30 -0400 Received: from [199.232.76.173] (port=38530 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MM3ys-0006DP-CX for qemu-devel@nongnu.org; Wed, 01 Jul 2009 13:52:26 -0400 Received: from mx20.gnu.org ([199.232.41.8]:19753) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MM3ys-0002zC-1R for qemu-devel@nongnu.org; Wed, 01 Jul 2009 13:52:26 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MM3yq-0002vk-9z for qemu-devel@nongnu.org; Wed, 01 Jul 2009 13:52:24 -0400 From: Nathan Froyd Date: Wed, 1 Jul 2009 10:52:22 -0700 Message-Id: <1246470742-4631-1-git-send-email-froydnj@codesourcery.com> Subject: [Qemu-devel] [PATCH] target-mips: fix MADD and MSUB/MSUBU instructions List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org MADD was not correctly writing to HI. MSUB/MSUBU are specified as `HI||LO - product', not `product - HI||LO'. Signed-off-by: Nathan Froyd --- target-mips/translate.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target-mips/translate.c b/target-mips/translate.c index 6f5bea4..d316b9d 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -2132,7 +2132,7 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc, tcg_gen_trunc_i64_tl(t1, t2); tcg_temp_free_i64(t2); tcg_gen_ext32s_tl(cpu_LO[0], t0); - tcg_gen_ext32s_tl(cpu_LO[1], t1); + tcg_gen_ext32s_tl(cpu_HI[0], t1); } opn = "madd"; break; @@ -2167,7 +2167,7 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc, tcg_gen_ext_tl_i64(t3, t1); tcg_gen_mul_i64(t2, t2, t3); tcg_gen_concat_tl_i64(t3, cpu_LO[0], cpu_HI[0]); - tcg_gen_sub_i64(t2, t2, t3); + tcg_gen_sub_i64(t2, t3, t2); tcg_temp_free_i64(t3); tcg_gen_trunc_i64_tl(t0, t2); tcg_gen_shri_i64(t2, t2, 32); @@ -2189,7 +2189,7 @@ static void gen_muldiv (DisasContext *ctx, uint32_t opc, tcg_gen_extu_tl_i64(t3, t1); tcg_gen_mul_i64(t2, t2, t3); tcg_gen_concat_tl_i64(t3, cpu_LO[0], cpu_HI[0]); - tcg_gen_sub_i64(t2, t2, t3); + tcg_gen_sub_i64(t2, t3, t2); tcg_temp_free_i64(t3); tcg_gen_trunc_i64_tl(t0, t2); tcg_gen_shri_i64(t2, t2, 32); -- 1.6.3.2