Revision 866be65d

b/target-alpha/cpu.h
450 450
};
451 451

  
452 452
/* Arithmetic exception */
453
enum {
454
    EXCP_ARITH_OVERFLOW,
455
};
453
#define EXC_M_IOV       (1<<16)         /* Integer Overflow */
454
#define EXC_M_INE       (1<<15)         /* Inexact result */
455
#define EXC_M_UNF       (1<<14)         /* Underflow */
456
#define EXC_M_FOV       (1<<13)         /* Overflow */
457
#define EXC_M_DZE       (1<<12)         /* Division by zero */
458
#define EXC_M_INV       (1<<11)         /* Invalid operation */
459
#define EXC_M_SWC       (1<<10)         /* Software completion */
456 460

  
457 461
enum {
458 462
    IR_V0   = 0,
b/target-alpha/op_helper.c
78 78
    uint64_t tmp = op1;
79 79
    op1 += op2;
80 80
    if (unlikely((tmp ^ op2 ^ (-1ULL)) & (tmp ^ op1) & (1ULL << 63))) {
81
        helper_excp(EXCP_ARITH, EXCP_ARITH_OVERFLOW);
81
        helper_excp(EXCP_ARITH, EXC_M_IOV);
82 82
    }
83 83
    return op1;
84 84
}
......
88 88
    uint64_t tmp = op1;
89 89
    op1 = (uint32_t)(op1 + op2);
90 90
    if (unlikely((tmp ^ op2 ^ (-1UL)) & (tmp ^ op1) & (1UL << 31))) {
91
        helper_excp(EXCP_ARITH, EXCP_ARITH_OVERFLOW);
91
        helper_excp(EXCP_ARITH, EXC_M_IOV);
92 92
    }
93 93
    return op1;
94 94
}
......
98 98
    uint64_t res;
99 99
    res = op1 - op2;
100 100
    if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) {
101
        helper_excp(EXCP_ARITH, EXCP_ARITH_OVERFLOW);
101
        helper_excp(EXCP_ARITH, EXC_M_IOV);
102 102
    }
103 103
    return res;
104 104
}
......
108 108
    uint32_t res;
109 109
    res = op1 - op2;
110 110
    if (unlikely((op1 ^ op2) & (res ^ op1) & (1UL << 31))) {
111
        helper_excp(EXCP_ARITH, EXCP_ARITH_OVERFLOW);
111
        helper_excp(EXCP_ARITH, EXC_M_IOV);
112 112
    }
113 113
    return res;
114 114
}
......
118 118
    int64_t res = (int64_t)op1 * (int64_t)op2;
119 119

  
120 120
    if (unlikely((int32_t)res != res)) {
121
        helper_excp(EXCP_ARITH, EXCP_ARITH_OVERFLOW);
121
        helper_excp(EXCP_ARITH, EXC_M_IOV);
122 122
    }
123 123
    return (int64_t)((int32_t)res);
124 124
}
......
130 130
    muls64(&tl, &th, op1, op2);
131 131
    /* If th != 0 && th != -1, then we had an overflow */
132 132
    if (unlikely((th + 1) > 1)) {
133
        helper_excp(EXCP_ARITH, EXCP_ARITH_OVERFLOW);
133
        helper_excp(EXCP_ARITH, EXC_M_IOV);
134 134
    }
135 135
    return tl;
136 136
}
......
987 987
    r |= ((uint64_t)(a & 0x7FFFFFFF)) << 29;
988 988

  
989 989
    if (v && (int64_t)((int32_t)r) != (int64_t)r) {
990
        helper_excp(EXCP_ARITH, EXCP_ARITH_OVERFLOW);
990
        helper_excp(EXCP_ARITH, EXC_M_IOV);
991 991
    }
992 992
    if (s) {
993 993
        /* TODO */

Also available in: Unified diff