summaryrefslogtreecommitdiffstats
path: root/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
diff options
context:
space:
mode:
authorJannik Vogel <email@jannikvogel.de>2016-05-18 15:12:31 +0200
committerJannik Vogel <email@jannikvogel.de>2016-05-18 16:28:13 +0200
commitedf30d84cc0e8299d61c98f5bb40a6428d1576bc (patch)
treea53e1a34a139964323127aff92f101018dbfb2e3 /src/core/arm/skyeye_common/vfp/vfpsingle.cpp
parentFix exception propagation for VFP single precision (diff)
downloadyuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.tar
yuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.tar.gz
yuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.tar.bz2
yuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.tar.lz
yuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.tar.xz
yuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.tar.zst
yuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.zip
Diffstat (limited to '')
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpsingle.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
index 5fb6b51ec..23e0cdf26 100644
--- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
@@ -89,10 +89,11 @@ static void vfp_single_normalise_denormal(struct vfp_single *vs)
}
-u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs, u32 fpscr, u32 exceptions, const char *func)
+u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs, u32 fpscr, const char *func)
{
u32 significand, incr, rmode;
int exponent, shift, underflow;
+ u32 exceptions = 0;
vfp_single_dump("pack: in", vs);
@@ -409,8 +410,7 @@ sqrt_invalid:
}
vsd.significand = vfp_shiftright32jamming(vsd.significand, 1);
- exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, 0, "fsqrt");
-
+ exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fsqrt");
return exceptions;
}
@@ -535,7 +535,8 @@ static u32 vfp_single_fcvtd(ARMul_State* state, int dd, int unused, s32 m, u32 f
else
vdd.exponent = vsm.exponent + (1023 - 127);
- return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fcvtd");
+ exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fcvtd");
+ return exceptions;
pack_nan:
vfp_put_double(state, vfp_double_pack(&vdd), dd);
@@ -545,23 +546,27 @@ pack_nan:
static u32 vfp_single_fuito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr)
{
struct vfp_single vs;
+ u32 exceptions = 0;
vs.sign = 0;
vs.exponent = 127 + 31 - 1;
vs.significand = (u32)m;
- return vfp_single_normaliseround(state, sd, &vs, fpscr, 0, "fuito");
+ exceptions |= vfp_single_normaliseround(state, sd, &vs, fpscr, "fuito");
+ return exceptions;
}
static u32 vfp_single_fsito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr)
{
struct vfp_single vs;
+ u32 exceptions = 0;
vs.sign = (m & 0x80000000) >> 16;
vs.exponent = 127 + 31 - 1;
vs.significand = vs.sign ? -m : m;
- return vfp_single_normaliseround(state, sd, &vs, fpscr, 0, "fsito");
+ exceptions |= vfp_single_normaliseround(state, sd, &vs, fpscr, "fsito");
+ return exceptions;
}
static u32 vfp_single_ftoui(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr)
@@ -953,7 +958,8 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
exceptions |= vfp_single_add(&vsd, &vsn, &vsp, fpscr);
- return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, func);
+ exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, func);
+ return exceptions;
}
/*
@@ -965,8 +971,10 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
*/
static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
{
+ u32 exceptions = 0;
LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
- return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
+ exceptions |= vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
+ return exceptions;
}
/*
@@ -1017,7 +1025,9 @@ static u32 vfp_single_fmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
vfp_single_normalise_denormal(&vsm);
exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr);
- return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fmul");
+
+ exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fmul");
+ return exceptions;
}
/*
@@ -1041,7 +1051,9 @@ static u32 vfp_single_fnmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr);
vsd.sign = vfp_sign_negate(vsd.sign);
- return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fnmul");
+
+ exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fnmul");
+ return exceptions;
}
/*
@@ -1068,7 +1080,8 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
exceptions |= vfp_single_add(&vsd, &vsn, &vsm, fpscr);
- return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fadd");
+ exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fadd");
+ return exceptions;
}
/*
@@ -1165,7 +1178,8 @@ static u32 vfp_single_fdiv(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
if ((vsd.significand & 0x3f) == 0)
vsd.significand |= ((u64)vsm.significand * vsd.significand != (u64)vsn.significand << 32);
- return vfp_single_normaliseround(state, sd, &vsd, fpscr, 0, "fdiv");
+ exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fdiv");
+ return exceptions;
vsn_nan:
exceptions |= vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr);
@@ -1191,7 +1205,8 @@ infinity:
invalid:
vfp_put_float(state, vfp_single_pack(&vfp_single_default_qnan), sd);
- return FPSCR_IOC;
+ exceptions |= FPSCR_IOC;
+ return exceptions;
}
static struct op fops[] = {