From 9745807191a81c45970f780166f44a7f93b18653 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 18 Feb 2015 13:26:26 -0800 Subject: target/openrisc: Keep SR_CY and SR_OV in a separate variables This significantly streamlines carry and overflow production. Signed-off-by: Richard Henderson --- target/openrisc/exception_helper.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'target/openrisc/exception_helper.c') diff --git a/target/openrisc/exception_helper.c b/target/openrisc/exception_helper.c index 5147da68c4..1536053856 100644 --- a/target/openrisc/exception_helper.c +++ b/target/openrisc/exception_helper.c @@ -30,13 +30,32 @@ void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) raise_exception(cpu, excp); } -void HELPER(ove)(CPUOpenRISCState *env, target_ulong test) +static void QEMU_NORETURN do_range(CPUOpenRISCState *env, uintptr_t pc) { - if (unlikely(test)) { - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); - CPUState *cs = CPU(cpu); + OpenRISCCPU *cpu = openrisc_env_get_cpu(env); + CPUState *cs = CPU(cpu); + + cs->exception_index = EXCP_RANGE; + cpu_loop_exit_restore(cs, pc); +} + +void HELPER(ove_cy)(CPUOpenRISCState *env) +{ + if (env->sr_cy) { + do_range(env, GETPC()); + } +} + +void HELPER(ove_ov)(CPUOpenRISCState *env) +{ + if (env->sr_ov < 0) { + do_range(env, GETPC()); + } +} - cs->exception_index = EXCP_RANGE; - cpu_loop_exit_restore(cs, GETPC()); +void HELPER(ove_cyov)(CPUOpenRISCState *env) +{ + if (env->sr_cy || env->sr_ov < 0) { + do_range(env, GETPC()); } } -- cgit 1.4.1