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 */
