Commit 1fa79fb0 authored by David Brenken's avatar David Brenken Committed by Bastian Koppelmann
Browse files

tricore: add FTOIZ instruction

parent 474f3938
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -303,6 +303,31 @@ uint32_t helper_itof(CPUTriCoreState *env, uint32_t arg)
    return (uint32_t)f_result;
}

uint32_t helper_ftoiz(CPUTriCoreState *env, uint32_t arg)
{
    float32 f_arg = make_float32(arg);
    uint32_t result;
    int32_t flags;

    result = float32_to_int32_round_to_zero(f_arg, &env->fp_status);

    flags = f_get_excp_flags(env);
    if (flags & float_flag_invalid) {
        flags &= ~float_flag_inexact;
        if (float32_is_any_nan(f_arg)) {
            result = 0;
        }
    }

    if (flags) {
        f_update_psw_flags(env, flags);
    } else {
        env->FPU_FS = 0;
    }

    return result;
}

uint32_t helper_ftouz(CPUTriCoreState *env, uint32_t arg)
{
    float32 f_arg = make_float32(arg);
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ DEF_HELPER_4(fmsub, i32, env, i32, i32, i32)
DEF_HELPER_3(fcmp, i32, env, i32, i32)
DEF_HELPER_2(ftoi, i32, env, i32)
DEF_HELPER_2(itof, i32, env, i32)
DEF_HELPER_2(ftoiz, i32, env, i32)
DEF_HELPER_2(ftouz, i32, env, i32)
DEF_HELPER_2(updfl, void, env, i32)
/* dvinit */
+3 −0
Original line number Diff line number Diff line
@@ -6747,6 +6747,9 @@ static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx)
    case OPC2_32_RR_UPDFL:
        gen_helper_updfl(cpu_env, cpu_gpr_d[r1]);
        break;
    case OPC2_32_RR_FTOIZ:
        gen_helper_ftoiz(cpu_gpr_d[r3], cpu_env, cpu_gpr_d[r1]);
        break;
    default:
        generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC);
    }