summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpsingle.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
index ae5b325f0..6b4cb8efa 100644
--- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
@@ -1049,12 +1049,22 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
1049static u32 vfp_single_fsub(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) { 1049static u32 vfp_single_fsub(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
1050 LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd); 1050 LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
1051 /* 1051 /*
1052 * Subtraction is addition with one sign inverted. 1052 * Subtraction is addition with one sign inverted. Unpack the second operand to perform FTZ if
1053 * necessary, we can't let fadd do this because a denormal in m might get flushed to +0 in FTZ
1054 * mode, and the resulting sign of 0 OP +0 differs between fadd and fsub. We do not need to do
1055 * this for n because +0 OP 0 is always +0 for both fadd and fsub.
1053 */ 1056 */
1057 struct vfp_single vsm;
1058 u32 exceptions = vfp_single_unpack(&vsm, m, fpscr);
1059 if (exceptions & FPSCR_IDC) {
1060 // The value was flushed to zero, re-pack it.
1061 m = vfp_single_pack(&vsm);
1062 }
1063
1054 if (m != 0x7FC00000) // Only negate if m isn't NaN. 1064 if (m != 0x7FC00000) // Only negate if m isn't NaN.
1055 m = vfp_single_packed_negate(m); 1065 m = vfp_single_packed_negate(m);
1056 1066
1057 return vfp_single_fadd(state, sd, sn, m, fpscr); 1067 return vfp_single_fadd(state, sd, sn, m, fpscr) | exceptions;
1058} 1068}
1059 1069
1060/* 1070/*