Skip to content

Commit

Permalink
target/mips: fpu: Demacro NMSUB.<D|S|PS>
Browse files Browse the repository at this point in the history
This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>
Signed-off-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Message-Id: <20200518200920.17344-10-aleksandar.qemu.devel@gmail.com>
  • Loading branch information
AMarkovic committed Jun 9, 2020
1 parent 0278586 commit 5c591e2
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion target/mips/fpu_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,6 @@ uint64_t helper_float_ ## name ## _ps(CPUMIPSState *env, \
update_fcr31(env, GETPC()); \
return ((uint64_t)fsth0 << 32) | fst0; \
}
FLOAT_FMA(nmsub, float_muladd_negate_result | float_muladd_negate_c)
#undef FLOAT_FMA

uint64_t helper_float_madd_d(CPUMIPSState *env, uint64_t fst0,
Expand Down Expand Up @@ -1619,6 +1618,49 @@ uint64_t helper_float_nmadd_ps(CPUMIPSState *env, uint64_t fdt0,
return ((uint64_t)fsth0 << 32) | fstl0;
}

uint64_t helper_float_nmsub_d(CPUMIPSState *env, uint64_t fst0,
uint64_t fst1, uint64_t fst2)
{
fst0 = float64_mul(fst0, fst1, &env->active_fpu.fp_status);
fst0 = float64_sub(fst0, fst2, &env->active_fpu.fp_status);
fst0 = float64_chs(fst0);

update_fcr31(env, GETPC());
return fst0;
}

uint32_t helper_float_nmsub_s(CPUMIPSState *env, uint32_t fst0,
uint32_t fst1, uint32_t fst2)
{
fst0 = float32_mul(fst0, fst1, &env->active_fpu.fp_status);
fst0 = float32_sub(fst0, fst2, &env->active_fpu.fp_status);
fst0 = float32_chs(fst0);

update_fcr31(env, GETPC());
return fst0;
}

uint64_t helper_float_nmsub_ps(CPUMIPSState *env, uint64_t fdt0,
uint64_t fdt1, uint64_t fdt2)
{
uint32_t fstl0 = fdt0 & 0XFFFFFFFF;
uint32_t fsth0 = fdt0 >> 32;
uint32_t fstl1 = fdt1 & 0XFFFFFFFF;
uint32_t fsth1 = fdt1 >> 32;
uint32_t fstl2 = fdt2 & 0XFFFFFFFF;
uint32_t fsth2 = fdt2 >> 32;

fstl0 = float32_mul(fstl0, fstl1, &env->active_fpu.fp_status);
fstl0 = float32_sub(fstl0, fstl2, &env->active_fpu.fp_status);
fstl0 = float32_chs(fstl0);
fsth0 = float32_mul(fsth0, fsth1, &env->active_fpu.fp_status);
fsth0 = float32_sub(fsth0, fsth2, &env->active_fpu.fp_status);
fsth0 = float32_chs(fsth0);

update_fcr31(env, GETPC());
return ((uint64_t)fsth0 << 32) | fstl0;
}


#define FLOAT_FMADDSUB(name, bits, muladd_arg) \
uint ## bits ## _t helper_float_ ## name(CPUMIPSState *env, \
Expand Down

0 comments on commit 5c591e2

Please sign in to comment.