mtfsf: fix FPSCR_VX and FPSCR_FEX computation
PATCH 1/1 mtfsf: fix FPSCR_VX and FPSCR_FEX computation
Hi all,
The patch below fix the computation of FPSCR_VX and FPSCR_FEX when using the mtfsf instruction. As stated in the PowerPC manual the mtfsf instruction can't alter those bit, and thus it should always be computed.
Bye,
Aurelien
Index: target-ppc/op_helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-ppc/op_helper.c,v retrieving revision 1.73
op_helper.c +4 -0
@@ -888,12 +888,16 @@ void do_store_fpscr (uint32_t mask)/* Update VX and FEX */ if (fpscr_ix !=0 ) env->fpscr |=1 <<FPSCR_VX ; +else + env->fpscr &= ~(1 <<FPSCR_VX );if ((fpscr_ex & fpscr_eex) !=0 ) { env->fpscr |=1 <<FPSCR_FEX ; env->exception_index =POWERPC_EXCP_PROGRAM ;/* XXX: we should compute it properly */ env->error_code =POWERPC_EXCP_FP ; } +else + env->fpscr &= ~(1 <<FPSCR_FEX );fpscr_set_rounding_mode (); }#undef WORD0
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Quoted 1 line · Aurelien Jarno
Hi all,
Hi,
Quoted 4 lines
The patch below fix the computation of
FPSCR_VXandFPSCR_FEXwhen using the mtfsf instruction. As stated in the PowerPC manual the mtfsf instruction can't alter those bit, and thus it should always be computed.
You're right, the values are not computed properly. I'll commit your fix.
Quoted 24 lines
Index:
target-ppc/op_helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-ppc/op_helper.c,v retrieving revision 1.73
diff -u -d -p -r1.73op_helper.cop_helper.c +4
-0@@ -888,12 +888,16 @@ void do_store_fpscr (uint32_t mask)/* Update VX and FEX */ if (fpscr_ix !=0 ) env->fpscr |=1 <<FPSCR_VX ; +else + env->fpscr &= ~(1 <<FPSCR_VX );if ((fpscr_ex & fpscr_eex) !=0 ) { env->fpscr |=1 <<FPSCR_FEX ; env->exception_index =POWERPC_EXCP_PROGRAM ;/* XXX: we should compute it properly */ env->error_code =POWERPC_EXCP_FP ; } +else + env->fpscr &= ~(1 <<FPSCR_FEX );fpscr_set_rounding_mode (); }#undef WORD0
Signature · 1 line
Jocelyn Mayer <[email protected]>
Quoted 5 lines · Jocelyn Mayer
Quoted 1 line · Aurelien Jarno
Hi all,
Hi,
Quoted 8 lines
Quoted 4 lines
The patch below fix the computation of
FPSCR_VXandFPSCR_FEXwhen using the mtfsf instruction. As stated in the PowerPC manual the mtfsf instruction can't alter those bit, and thus it should always be computed.You're right, the values are not computed properly. I'll commit your fix.
Any news on that?
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net