Skip to contentSkip to conversation

[6034] target-ppc: fix fcmp{o,u} instructions

Qemu-devel Aurelien Jarno 1 participant 1 message Dec 14, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 6034

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6034
Author:   aurel32
Date:     2008-12-14 19:34:09 +0000 (Sun, 14 Dec 2008)

Log Message:
-----------
target-ppc: fix fcmp{o,u} instructions

The instructions are specified to update the condition register even if an error is to be signaled because of NaN input.

Modified Paths:
--------------
trunk/target-ppc/helper.h
trunk/target-ppc/op_helper.c
trunk/target-ppc/translate.c

Modified: trunk/target-ppc/helper.h
===================================================================

target-ppc/helper.h +2 -2
@@ -63,8 +63,8 @@
 DEF_HELPER_1(float64_to_float32, i32, i64)
 DEF_HELPER_1(float32_to_float64, i64, i32)
 
-DEF_HELPER_2(fcmpo, i32, i64, i64)
-DEF_HELPER_2(fcmpu, i32, i64, i64)
+DEF_HELPER_3(fcmpo, void, i64, i64, i32)
+DEF_HELPER_3(fcmpu, void, i64, i64, i32)
 
 DEF_HELPER_1(fctiw, i64, i64)
 DEF_HELPER_1(fctiwz, i64, i64)

Modified: trunk/target-ppc/op_helper.c
===================================================================

target-ppc/op_helper.c +31 -25

87 lines not on this page · raw message

Modified: trunk/target-ppc/translate.c
===================================================================

target-ppc/translate.c +8 -4
@@ -2249,26 +2249,30 @@
 /* fcmpo */
 GEN_HANDLER(fcmpo, 0x3F, 0x00, 0x01, 0x00600001, PPC_FLOAT)
 {
+    TCGv crf;
     if (unlikely(!ctx->fpu_enabled)) {
         gen_exception(ctx, POWERPC_EXCP_FPU);
         return;
     }
     gen_reset_fpstatus();
-    gen_helper_fcmpo(cpu_crf[crfD(ctx->opcode)],
-                     cpu_fpr[rA(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]);
+    crf = tcg_const_i32(crfD(ctx->opcode));
+    gen_helper_fcmpo(cpu_fpr[rA(ctx->opcode)], cpu_fpr[rB(ctx->opcode)], crf);
+    tcg_temp_free(crf);
     gen_helper_float_check_status();
 }
 
 /* fcmpu */
 GEN_HANDLER(fcmpu, 0x3F, 0x00, 0x00, 0x00600001, PPC_FLOAT)
 {
+    TCGv crf;
     if (unlikely(!ctx->fpu_enabled)) {
         gen_exception(ctx, POWERPC_EXCP_FPU);
         return;
     }
     gen_reset_fpstatus();
-    gen_helper_fcmpu(cpu_crf[crfD(ctx->opcode)],
-                     cpu_fpr[rA(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]);
+    crf = tcg_const_i32(crfD(ctx->opcode));
+    gen_helper_fcmpu(cpu_fpr[rA(ctx->opcode)], cpu_fpr[rB(ctx->opcode)], crf);
+    tcg_temp_free(crf);
     gen_helper_float_check_status();
 }