@@ -112,3 +112,33 @@ uint32_t helper_f##name(CPUTriCoreState *env, uint32_t r1, uint32_t r2) \
}
FADD_SUB(add)
FADD_SUB(sub)
+
+uint32_t helper_fmul(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
+{
+ float32 arg1 = make_float32(r1);
+ float32 arg2 = make_float32(r2);
+ float32 f_result;
+
+ f_set_flags(env);
+
+ arg1 = float32_squash_input_denormal(arg1, &env->fp_status);
+ arg2 = float32_squash_input_denormal(arg2, &env->fp_status);
+
+ if (float32_is_any_nan(arg1) || float32_is_any_nan(arg2)) {
+ f_result = QUIET_NAN;
+ if (float32_is_signaling_nan(arg1) || float32_is_signaling_nan(arg2)) {
+ env->fp_status.float_exception_flags |= float_flag_invalid;
+ }
+ } else if (float32_is_infinity(arg1) && float32_is_zero(arg2)) {
+ f_result = MUL_NAN;
+ env->fp_status.float_exception_flags |= float_flag_invalid;
+ } else if (float32_is_infinity(arg2) && float32_is_zero(arg1)) {
+ f_result = MUL_NAN;
+ env->fp_status.float_exception_flags |= float_flag_invalid;
+ } else {
+ f_result = float32_mul(arg1, arg2, &env->fp_status);
+ }
+ f_update_psw_flags(env, false);
+ return (uint32_t)f_result;
+
+}
@@ -107,6 +107,7 @@ DEF_HELPER_FLAGS_4(pack, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32, i32)
DEF_HELPER_1(unpack, i64, i32)
DEF_HELPER_3(fadd, i32, env, i32, i32)
DEF_HELPER_3(fsub, i32, env, i32, i32)
+DEF_HELPER_3(fmul, i32, env, i32, i32)
/* dvinit */
DEF_HELPER_3(dvinit_b_13, i64, env, i32, i32)
DEF_HELPER_3(dvinit_b_131, i64, env, i32, i32)
@@ -6672,6 +6672,9 @@ static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx)
generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC);
}
break;
+ case OPC2_32_RR_MUL_F:
+ gen_helper_fmul(cpu_gpr_d[r3], cpu_env, cpu_gpr_d[r1], cpu_gpr_d[r2]);
+ break;
default:
generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC);
}
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> --- target-tricore/fpu_helper.c | 30 ++++++++++++++++++++++++++++++ target-tricore/helper.h | 1 + target-tricore/translate.c | 3 +++ 3 files changed, 34 insertions(+)