aboutsummaryrefslogtreecommitdiff
path: root/target/openrisc/exception_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2015-02-18 13:26:26 -0800
committerRichard Henderson <rth@twiddle.net>2017-02-14 08:14:59 +1100
commit9745807191a81c45970f780166f44a7f93b18653 (patch)
tree426a6b0c6b8fe6576c3d564e3bb0672ab794101c /target/openrisc/exception_helper.c
parent84775c43f390d4f5dd9adf8732e7e0b6deed8f61 (diff)
target/openrisc: Keep SR_CY and SR_OV in a separate variables
This significantly streamlines carry and overflow production. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target/openrisc/exception_helper.c')
-rw-r--r--target/openrisc/exception_helper.c31
1 files changed, 25 insertions, 6 deletions
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());
}
}