From: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL v2 3/9] target-tricore: calculate av bits before saturation
Date: Tue, 27 Jan 2015 12:09:19 +0000 [thread overview]
Message-ID: <1422360565-15503-4-git-send-email-kbastian@mail.uni-paderborn.de> (raw)
In-Reply-To: <1422360565-15503-1-git-send-email-kbastian@mail.uni-paderborn.de>
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>
---
target-tricore/op_helper.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/target-tricore/op_helper.c b/target-tricore/op_helper.c
index ec2a0cc..dcc65b1 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;
}
--
2.2.2
next prev parent reply other threads:[~2015-01-27 11:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-27 12:09 [Qemu-devel] [PULL v2 0/9] tricore patches Bastian Koppelmann
2015-01-27 12:09 ` [Qemu-devel] [PULL v2 1/9] target-tricore: Add missing ULL suffix on 64 bit constant Bastian Koppelmann
2015-01-27 12:09 ` [Qemu-devel] [PULL v2 2/9] target-tricore: Several translator and cpu model fixes Bastian Koppelmann
2015-01-27 12:09 ` Bastian Koppelmann [this message]
2015-01-27 12:09 ` [Qemu-devel] [PULL v2 4/9] target-tricore: Fix bugs found by coverity Bastian Koppelmann
2015-01-27 12:09 ` [Qemu-devel] [PULL v2 5/9] target-tricore: split up suov32 into suov32_pos and suov32_neg Bastian Koppelmann
2015-01-27 12:09 ` [Qemu-devel] [PULL v2 6/9] target-tricore: Add instructions of RR1 opcode format, that have 0x93 as first opcode Bastian Koppelmann
2015-01-27 12:09 ` [Qemu-devel] [PULL v2 7/9] target-tricore: Add instructions of RR2 opcode format Bastian Koppelmann
2015-01-27 12:09 ` [Qemu-devel] [PULL v2 8/9] target-tricore: Add instructions of RRPW " Bastian Koppelmann
2015-01-27 12:09 ` [Qemu-devel] [PULL v2 9/9] target-tricore: Add instructions of RRR " Bastian Koppelmann
2015-01-27 12:47 ` [Qemu-devel] [PULL v2 0/9] tricore patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1422360565-15503-4-git-send-email-kbastian@mail.uni-paderborn.de \
--to=kbastian@mail.uni-paderborn.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).