From 9ecaa27e7123211f45ca723a736ffae14f6c1f42 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 7 Apr 2015 13:31:50 -0700 Subject: target/openrisc: Streamline arithmetic and OVE Fix incorrect overflow calculation. Move overflow exception check to a helper function, to eliminate inline branches. Remove some incorrect special casing of R0. Implement multiply inline. Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- target/openrisc/exception_helper.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'target/openrisc/exception_helper.c') diff --git a/target/openrisc/exception_helper.c b/target/openrisc/exception_helper.c index 329a9e400b..7e54c978be 100644 --- a/target/openrisc/exception_helper.c +++ b/target/openrisc/exception_helper.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/helper-proto.h" +#include "exec/exec-all.h" #include "exception.h" void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) @@ -28,3 +29,14 @@ void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) raise_exception(cpu, excp); } + +void HELPER(ove)(CPUOpenRISCState *env, target_ulong test) +{ + if (unlikely(test) && (env->sr & SR_OVE)) { + OpenRISCCPU *cpu = openrisc_env_get_cpu(env); + CPUState *cs = CPU(cpu); + + cs->exception_index = EXCP_RANGE; + cpu_loop_exit_restore(cs, GETPC()); + } +} -- cgit v1.2.3