summaryrefslogtreecommitdiff
path: root/target-tricore
diff options
context:
space:
mode:
authorBastian Koppelmann <kbastian@mail.uni-paderborn.de>2015-01-21 15:55:15 +0000
committerBastian Koppelmann <kbastian@mail.uni-paderborn.de>2015-01-26 19:56:45 +0000
commit811ea608e9721dc4f6933da440f235e7d3a39c0f (patch)
tree561c36d60fcef2665ce9fe806526f5eb1c914e75 /target-tricore
parent5f30046f156c181fb4088da2f4b8ea25a7d07c7a (diff)
downloadqemu-811ea608e9721dc4f6933da440f235e7d3a39c0f.tar.gz
qemu-811ea608e9721dc4f6933da440f235e7d3a39c0f.tar.bz2
qemu-811ea608e9721dc4f6933da440f235e7d3a39c0f.zip
target-tricore: calculate av bits before saturation
64 bit mac instructions calculated the av bits after the saturation, which resulted in a wrong PSW. This moves the av bit calculation before the saturation. Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Diffstat (limited to 'target-tricore')
-rw-r--r--target-tricore/op_helper.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/target-tricore/op_helper.c b/target-tricore/op_helper.c
index ec2a0cc343..dcc65b1385 100644
--- a/target-tricore/op_helper.c
+++ b/target-tricore/op_helper.c
@@ -371,6 +371,10 @@ uint64_t helper_madd64_ssov(CPUTriCoreState *env, target_ulong r1,
ret = mul + r2;
ovf = (ret ^ mul) & ~(mul ^ r2);
+ t1 = ret >> 32;
+ env->PSW_USB_AV = t1 ^ t1 * 2u;
+ env->PSW_USB_SAV |= env->PSW_USB_AV;
+
if ((int64_t)ovf < 0) {
env->PSW_USB_V = (1 << 31);
env->PSW_USB_SV = (1 << 31);
@@ -384,9 +388,6 @@ uint64_t helper_madd64_ssov(CPUTriCoreState *env, target_ulong r1,
} else {
env->PSW_USB_V = 0;
}
- t1 = ret >> 32;
- env->PSW_USB_AV = t1 ^ t1 * 2u;
- env->PSW_USB_SAV |= env->PSW_USB_AV;
return ret;
}
@@ -401,6 +402,10 @@ uint64_t helper_madd64_suov(CPUTriCoreState *env, target_ulong r1,
mul = t1 * t3;
ret = mul + r2;
+ t1 = ret >> 32;
+ env->PSW_USB_AV = t1 ^ t1 * 2u;
+ env->PSW_USB_SAV |= env->PSW_USB_AV;
+
if (ret < r2) {
env->PSW_USB_V = (1 << 31);
env->PSW_USB_SV = (1 << 31);
@@ -409,9 +414,6 @@ uint64_t helper_madd64_suov(CPUTriCoreState *env, target_ulong r1,
} else {
env->PSW_USB_V = 0;
}
- t1 = ret >> 32;
- env->PSW_USB_AV = t1 ^ t1 * 2u;
- env->PSW_USB_SAV |= env->PSW_USB_AV;
return ret;
}
@@ -451,6 +453,10 @@ uint64_t helper_msub64_ssov(CPUTriCoreState *env, target_ulong r1,
ret = r2 - mul;
ovf = (ret ^ r2) & (mul ^ r2);
+ t1 = ret >> 32;
+ env->PSW_USB_AV = t1 ^ t1 * 2u;
+ env->PSW_USB_SAV |= env->PSW_USB_AV;
+
if ((int64_t)ovf < 0) {
env->PSW_USB_V = (1 << 31);
env->PSW_USB_SV = (1 << 31);
@@ -464,9 +470,6 @@ uint64_t helper_msub64_ssov(CPUTriCoreState *env, target_ulong r1,
} else {
env->PSW_USB_V = 0;
}
- t1 = ret >> 32;
- env->PSW_USB_AV = t1 ^ t1 * 2u;
- env->PSW_USB_SAV |= env->PSW_USB_AV;
return ret;
}
@@ -480,6 +483,10 @@ uint64_t helper_msub64_suov(CPUTriCoreState *env, target_ulong r1,
mul = t1 * t3;
ret = r2 - mul;
+ t1 = ret >> 32;
+ env->PSW_USB_AV = t1 ^ t1 * 2u;
+ env->PSW_USB_SAV |= env->PSW_USB_AV;
+
if (ret > r2) {
env->PSW_USB_V = (1 << 31);
env->PSW_USB_SV = (1 << 31);
@@ -488,9 +495,6 @@ uint64_t helper_msub64_suov(CPUTriCoreState *env, target_ulong r1,
} else {
env->PSW_USB_V = 0;
}
- t1 = ret >> 32;
- env->PSW_USB_AV = t1 ^ t1 * 2u;
- env->PSW_USB_SAV |= env->PSW_USB_AV;
return ret;
}