true);
7: mulli({{
- int32_t src = Ra_sw;
- int64_t prod = src * simm;
- Rt = (uint32_t)prod;
+ int64_t res = Ra_sd * simm;
+ Rt = res;
}});
}
// with destination register Rt.
format IntArithCheckRcOp {
75: mulhw({{
- int64_t prod = Ra_sd * Rb_sd;
- Rt = prod >> 32;
+ uint64_t res = (int64_t)Ra_sw * Rb_sw;
+ res = res >> 32;
+ Rt = res;
}});
11: mulhwu({{
- uint64_t prod = Ra_ud * Rb_ud;
- Rt = prod >> 32;
+ uint64_t res = (uint64_t)Ra_uw * Rb_uw;
+ res = res >> 32;
+ Rt = res;
}});
235: mullw({{
- int64_t prod = Ra_sd * Rb_sd; Rt = prod;
- if (prod != (int32_t)prod) {
+ int64_t res = (int64_t)Ra_sw * Rb_sw;
+ if (res != (int32_t)res) {
setOV = true;
}
+ Rt = res;
}},
true);
491: divw({{
int32_t src1 = Ra_sw;
int32_t src2 = Rb_sw;
- if ((src1 != 0x80000000 || src2 != 0xffffffff)
- && src2 != 0) {
- Rt = src1 / src2;
+ if ((src1 != INT32_MIN || src2 != -1) && src2 != 0) {
+ Rt = (uint32_t)(src1 / src2);
} else {
Rt = 0;
setOV = true;
true);
459: divwu({{
- uint32_t src1 = Ra_sw;
- uint32_t src2 = Rb_sw;
+ uint32_t src1 = Ra_uw;
+ uint32_t src2 = Rb_uw;
if (src2 != 0) {
Rt = src1 / src2;
} else {
computeCR0Code = '''
Cr cr = CR;
- cr.cr0 = makeCRField((int32_t)%(result)s, (int32_t)0, xer.so);
+ cr.cr0 = makeCRField((int64_t)%(result)s, (int64_t)0, xer.so);
CR = cr;
'''
computeCACode = '''
- if (findCarry(32, %(result)s, %(inputa)s, %(inputb)s)) {
+ if (findCarry(64, %(result)s, %(inputa)s, %(inputb)s)) {
xer.ca = 1;
} else {
xer.ca = 0;
}
+
+ if (findCarry(32, %(result)s, %(inputa)s, %(inputb)s)) {
+ xer.ca32 = 1;
+ } else {
+ xer.ca32 = 0;
+ }
'''
computeOVCode = '''
- if (findOverflow(32, %(result)s, %(inputa)s, %(inputb)s)) {
+ if (findOverflow(64, %(result)s, %(inputa)s, %(inputb)s)) {
xer.ov = 1;
xer.so = 1;
} else {
xer.ov = 0;
}
+
+ if (findOverflow(32, %(result)s, %(inputa)s, %(inputb)s)) {
+ xer.ov32 = 1;
+ } else {
+ xer.ov32 = 0;
+ }
'''
setOVCode = '''
if (setOV) {
xer.ov = 1;
+ xer.ov32 = 1;
xer.so = 1;
} else {
xer.ov = 0;
+ xer.ov32 = 0;
}
'''