tmp = T0;
T0 += T1;
- if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) {
- CALL_FROM_TB1(do_raise_exception, EXCP_OVERFLOW);
+ if (((tmp ^ T1 ^ (-1)) & (T0 ^ T1)) >> 31) {
+ /* operands of same sign, result different sign */
+ CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
RETURN();
}
tmp = T0;
T0 = (int32_t)T0 - (int32_t)T1;
- if (!((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31))) {
- CALL_FROM_TB1(do_raise_exception, EXCP_OVERFLOW);
+ if (((tmp ^ T1) & (tmp ^ T0)) >> 31) {
+ /* operands of different sign, first operand and result different sign */
+ CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
RETURN();
}
void op_mult (void)
{
- set_HILO((int64_t)T0 * (int64_t)T1);
+ set_HILO((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1);
RETURN();
}
{
int64_t tmp;
- tmp = ((int64_t)T0 * (int64_t)T1);
+ tmp = ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1);
set_HILO((int64_t)get_HILO() + tmp);
RETURN();
}
{
int64_t tmp;
- tmp = ((int64_t)T0 * (int64_t)T1);
+ tmp = ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1);
set_HILO((int64_t)get_HILO() - tmp);
RETURN();
}
void op_trap (void)
{
if (T0) {
- CALL_FROM_TB1(do_raise_exception, EXCP_TRAP);
+ CALL_FROM_TB1(do_raise_exception_direct, EXCP_TRAP);
}
RETURN();
}
+void op_debug (void)
+{
+ CALL_FROM_TB1(do_raise_exception, EXCP_DEBUG);
+}
+
void op_set_lladdr (void)
{
env->CP0_LLAddr = T2;
EXIT_TB();
}
+void op_wait (void)
+{
+ env->halted = 1;
+ CALL_FROM_TB1(do_raise_exception, EXCP_HLT);
+}