Core_ARM11: Replace debug prints with our own logging functions in vfpsingle.
This commit is contained in:
parent
d9eb7ca95c
commit
2e860bd59c
|
@ -36,9 +36,6 @@
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/arm/skyeye_common/armdefs.h"
|
#include "core/arm/skyeye_common/armdefs.h"
|
||||||
|
|
||||||
#define pr_info //printf
|
|
||||||
#define pr_debug //printf
|
|
||||||
|
|
||||||
#define do_div(n, base) {n/=base;}
|
#define do_div(n, base) {n/=base;}
|
||||||
|
|
||||||
enum : u32 {
|
enum : u32 {
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
* ===========================================================================
|
* ===========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "common/logging/log.h"
|
||||||
|
|
||||||
#include "core/arm/skyeye_common/vfp/vfp_helper.h"
|
#include "core/arm/skyeye_common/vfp/vfp_helper.h"
|
||||||
#include "core/arm/skyeye_common/vfp/asm_vfp.h"
|
#include "core/arm/skyeye_common/vfp/asm_vfp.h"
|
||||||
#include "core/arm/skyeye_common/vfp/vfp.h"
|
#include "core/arm/skyeye_common/vfp/vfp.h"
|
||||||
|
@ -63,7 +65,7 @@ static struct vfp_single vfp_single_default_qnan = {
|
||||||
|
|
||||||
static void vfp_single_dump(const char *str, struct vfp_single *s)
|
static void vfp_single_dump(const char *str, struct vfp_single *s)
|
||||||
{
|
{
|
||||||
pr_debug("VFP: %s: sign=%d exponent=%d significand=%08x\n",
|
LOG_DEBUG(Core_ARM11, "%s: sign=%d exponent=%d significand=%08x",
|
||||||
str, s->sign != 0, s->exponent, s->significand);
|
str, s->sign != 0, s->exponent, s->significand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +156,7 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs,
|
||||||
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vs->sign != 0))
|
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vs->sign != 0))
|
||||||
incr = (1 << (VFP_SINGLE_LOW_BITS + 1)) - 1;
|
incr = (1 << (VFP_SINGLE_LOW_BITS + 1)) - 1;
|
||||||
|
|
||||||
pr_debug("VFP: rounding increment = 0x%08x\n", incr);
|
LOG_DEBUG(Core_ARM11, "rounding increment = 0x%08x", incr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is our rounding going to overflow?
|
* Is our rounding going to overflow?
|
||||||
|
@ -209,10 +211,8 @@ pack:
|
||||||
vfp_single_dump("pack: final", vs);
|
vfp_single_dump("pack: final", vs);
|
||||||
{
|
{
|
||||||
s32 d = vfp_single_pack(vs);
|
s32 d = vfp_single_pack(vs);
|
||||||
#if 1
|
LOG_DEBUG(Core_ARM11, "%s: d(s%d)=%08x exceptions=%08x", func,
|
||||||
pr_debug("VFP: %s: d(s%d)=%08x exceptions=%08x\n", func,
|
|
||||||
sd, d, exceptions);
|
sd, d, exceptions);
|
||||||
#endif
|
|
||||||
vfp_put_float(state, d, sd);
|
vfp_put_float(state, d, sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand)
|
||||||
u32 z, a;
|
u32 z, a;
|
||||||
|
|
||||||
if ((significand & 0xc0000000) != 0x40000000) {
|
if ((significand & 0xc0000000) != 0x40000000) {
|
||||||
pr_debug("VFP: estimate_sqrt: invalid significand\n");
|
LOG_DEBUG(Core_ARM11, "invalid significand");
|
||||||
}
|
}
|
||||||
|
|
||||||
a = significand << 1;
|
a = significand << 1;
|
||||||
|
@ -392,7 +392,7 @@ sqrt_invalid:
|
||||||
term = (u64)vsd.significand * vsd.significand;
|
term = (u64)vsd.significand * vsd.significand;
|
||||||
rem = ((u64)vsm.significand << 32) - term;
|
rem = ((u64)vsm.significand << 32) - term;
|
||||||
|
|
||||||
pr_debug("VFP: term=%016llx rem=%016llx\n", term, rem);
|
LOG_DEBUG(Core_ARM11, "term=%016lx rem=%016lx", term, rem);
|
||||||
|
|
||||||
while (rem < 0) {
|
while (rem < 0) {
|
||||||
vsd.significand -= 1;
|
vsd.significand -= 1;
|
||||||
|
@ -624,7 +624,7 @@ static u32 vfp_single_ftoui(ARMul_State* state, int sd, int unused, s32 m, u32 f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions);
|
LOG_DEBUG(Core_ARM11, "ftoui: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, d, sd);
|
vfp_put_float(state, d, sd);
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ static u32 vfp_single_ftosi(ARMul_State* state, int sd, int unused, s32 m, u32 f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions);
|
LOG_DEBUG(Core_ARM11, "ftosi: d(s%d)=%08x exceptions=%08x", sd, d, exceptions);
|
||||||
|
|
||||||
vfp_put_float(state, (s32)d, sd);
|
vfp_put_float(state, (s32)d, sd);
|
||||||
|
|
||||||
|
@ -800,7 +800,7 @@ vfp_single_add(struct vfp_single *vsd, struct vfp_single *vsn,
|
||||||
|
|
||||||
if (vsn->significand & 0x80000000 ||
|
if (vsn->significand & 0x80000000 ||
|
||||||
vsm->significand & 0x80000000) {
|
vsm->significand & 0x80000000) {
|
||||||
pr_info("VFP: bad FP values in %s\n", __func__);
|
LOG_WARNING(Core_ARM11, "bad FP values");
|
||||||
vfp_single_dump("VSN", vsn);
|
vfp_single_dump("VSN", vsn);
|
||||||
vfp_single_dump("VSM", vsm);
|
vfp_single_dump("VSM", vsm);
|
||||||
}
|
}
|
||||||
|
@ -871,7 +871,7 @@ vfp_single_multiply(struct vfp_single *vsd, struct vfp_single *vsn, struct vfp_s
|
||||||
struct vfp_single *t = vsn;
|
struct vfp_single *t = vsn;
|
||||||
vsn = vsm;
|
vsn = vsm;
|
||||||
vsm = t;
|
vsm = t;
|
||||||
pr_debug("VFP: swapping M <-> N\n");
|
LOG_DEBUG(Core_ARM11, "swapping M <-> N");
|
||||||
}
|
}
|
||||||
|
|
||||||
vsd->sign = vsn->sign ^ vsm->sign;
|
vsd->sign = vsn->sign ^ vsm->sign;
|
||||||
|
@ -924,7 +924,7 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
|
||||||
s32 v;
|
s32 v;
|
||||||
|
|
||||||
v = vfp_get_float(state, sn);
|
v = vfp_get_float(state, sn);
|
||||||
pr_debug("VFP: s%u = %08x\n", sn, v);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, v);
|
||||||
vfp_single_unpack(&vsn, v);
|
vfp_single_unpack(&vsn, v);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
vfp_single_normalise_denormal(&vsn);
|
vfp_single_normalise_denormal(&vsn);
|
||||||
|
@ -939,7 +939,7 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
|
||||||
vsp.sign = vfp_sign_negate(vsp.sign);
|
vsp.sign = vfp_sign_negate(vsp.sign);
|
||||||
|
|
||||||
v = vfp_get_float(state, sd);
|
v = vfp_get_float(state, sd);
|
||||||
pr_debug("VFP: s%u = %08x\n", sd, v);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sd, v);
|
||||||
vfp_single_unpack(&vsn, v);
|
vfp_single_unpack(&vsn, v);
|
||||||
if (vsn.exponent == 0 && vsn.significand != 0)
|
if (vsn.exponent == 0 && vsn.significand != 0)
|
||||||
vfp_single_normalise_denormal(&vsn);
|
vfp_single_normalise_denormal(&vsn);
|
||||||
|
@ -961,7 +961,7 @@ 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)
|
static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
{
|
{
|
||||||
pr_debug("In %sVFP: s%u = %08x\n", __FUNCTION__, sn, sd);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -970,7 +970,8 @@ static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
{
|
{
|
||||||
pr_debug("In %sVFP: s%u = %08x\n", __FUNCTION__, sd, sn);
|
// TODO: this one has its arguments inverted, investigate.
|
||||||
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sd, sn);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_MULTIPLY, "fnmac");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_MULTIPLY, "fnmac");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,7 +980,7 @@ static u32 vfp_single_fnmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
{
|
{
|
||||||
pr_debug("In %sVFP: s%u = %08x\n", __FUNCTION__, sn, sd);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT, "fmsc");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT, "fmsc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,7 +989,7 @@ static u32 vfp_single_fmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fnmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
static u32 vfp_single_fnmsc(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
{
|
{
|
||||||
pr_debug("In %sVFP: s%u = %08x\n", __FUNCTION__, sn, sd);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, sd);
|
||||||
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT | NEG_MULTIPLY, "fnmsc");
|
return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, NEG_SUBTRACT | NEG_MULTIPLY, "fnmsc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,7 +1002,7 @@ static u32 vfp_single_fmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
pr_debug("In %sVFP: s%u = %08x\n", __FUNCTION__, sn, n);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, n);
|
||||||
|
|
||||||
vfp_single_unpack(&vsn, n);
|
vfp_single_unpack(&vsn, n);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
|
@ -1024,7 +1025,7 @@ static u32 vfp_single_fnmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
pr_debug("VFP: s%u = %08x\n", sn, n);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, n);
|
||||||
|
|
||||||
vfp_single_unpack(&vsn, n);
|
vfp_single_unpack(&vsn, n);
|
||||||
if (vsn.exponent == 0 && vsn.significand)
|
if (vsn.exponent == 0 && vsn.significand)
|
||||||
|
@ -1048,7 +1049,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
u32 exceptions;
|
u32 exceptions;
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
|
|
||||||
pr_debug("VFP: s%u = %08x\n", sn, n);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, n);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unpack and normalise denormals.
|
* Unpack and normalise denormals.
|
||||||
|
@ -1071,7 +1072,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
*/
|
*/
|
||||||
static u32 vfp_single_fsub(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
static u32 vfp_single_fsub(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
{
|
{
|
||||||
pr_debug("In %sVFP: s%u = %08x\n", __FUNCTION__, sn, sd);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, sd);
|
||||||
/*
|
/*
|
||||||
* Subtraction is addition with one sign inverted.
|
* Subtraction is addition with one sign inverted.
|
||||||
*/
|
*/
|
||||||
|
@ -1091,7 +1092,7 @@ static u32 vfp_single_fdiv(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
|
||||||
s32 n = vfp_get_float(state, sn);
|
s32 n = vfp_get_float(state, sn);
|
||||||
int tm, tn;
|
int tm, tn;
|
||||||
|
|
||||||
pr_debug("VFP: s%u = %08x\n", sn, n);
|
LOG_DEBUG(Core_ARM11, "s%u = %08x", sn, n);
|
||||||
|
|
||||||
vfp_single_unpack(&vsn, n);
|
vfp_single_unpack(&vsn, n);
|
||||||
vfp_single_unpack(&vsm, m);
|
vfp_single_unpack(&vsm, m);
|
||||||
|
@ -1213,7 +1214,6 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
|
||||||
unsigned int sm = vfp_get_sm(inst);
|
unsigned int sm = vfp_get_sm(inst);
|
||||||
unsigned int vecitr, veclen, vecstride;
|
unsigned int vecitr, veclen, vecstride;
|
||||||
struct op *fop;
|
struct op *fop;
|
||||||
pr_debug("In %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
vecstride = 1 + ((fpscr & FPSCR_STRIDE_MASK) == FPSCR_STRIDE_MASK);
|
vecstride = 1 + ((fpscr & FPSCR_STRIDE_MASK) == FPSCR_STRIDE_MASK);
|
||||||
|
|
||||||
|
@ -1239,11 +1239,11 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
|
||||||
else
|
else
|
||||||
veclen = fpscr & FPSCR_LENGTH_MASK;
|
veclen = fpscr & FPSCR_LENGTH_MASK;
|
||||||
|
|
||||||
pr_debug("VFP: vecstride=%u veclen=%u\n", vecstride,
|
LOG_DEBUG(Core_ARM11, "vecstride=%u veclen=%u", vecstride,
|
||||||
(veclen >> FPSCR_LENGTH_BIT) + 1);
|
(veclen >> FPSCR_LENGTH_BIT) + 1);
|
||||||
|
|
||||||
if (!fop->fn) {
|
if (!fop->fn) {
|
||||||
printf("VFP: could not find single op %d, inst=0x%x@0x%x\n", FEXT_TO_IDX(inst), inst, state->Reg[15]);
|
LOG_CRITICAL(Core_ARM11, "could not find single op %d, inst=0x%x@0x%x", FEXT_TO_IDX(inst), inst, state->Reg[15]);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
@ -1255,16 +1255,16 @@ u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr)
|
||||||
|
|
||||||
type = (fop->flags & OP_DD) ? 'd' : 's';
|
type = (fop->flags & OP_DD) ? 'd' : 's';
|
||||||
if (op == FOP_EXT)
|
if (op == FOP_EXT)
|
||||||
pr_debug("VFP: itr%d (%c%u) = op[%u] (s%u=%08x)\n",
|
LOG_DEBUG(Core_ARM11, "itr%d (%c%u) = op[%u] (s%u=%08x)",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn,
|
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn,
|
||||||
sm, m);
|
sm, m);
|
||||||
else
|
else
|
||||||
pr_debug("VFP: itr%d (%c%u) = (s%u) op[%u] (s%u=%08x)\n",
|
LOG_DEBUG(Core_ARM11, "itr%d (%c%u) = (s%u) op[%u] (s%u=%08x)",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn,
|
vecitr >> FPSCR_LENGTH_BIT, type, dest, sn,
|
||||||
FOP_TO_IDX(op), sm, m);
|
FOP_TO_IDX(op), sm, m);
|
||||||
|
|
||||||
except = fop->fn(state, dest, sn, m, fpscr);
|
except = fop->fn(state, dest, sn, m, fpscr);
|
||||||
pr_debug("VFP: itr%d: exceptions=%08x\n",
|
LOG_DEBUG(Core_ARM11, "itr%d: exceptions=%08x",
|
||||||
vecitr >> FPSCR_LENGTH_BIT, except);
|
vecitr >> FPSCR_LENGTH_BIT, except);
|
||||||
|
|
||||||
exceptions |= except;
|
exceptions |= except;
|
||||||
|
|
Loading…
Reference in a new issue