aboutsummaryrefslogtreecommitdiff
path: root/target/sparc/helper.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-10-14 21:38:12 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-11-05 12:03:14 -0800
commit68524e83f8fbe23dca37dc5b847fb558d75c8fab (patch)
tree4677780d2ed613103b00c0613029aa248f6fb8f4 /target/sparc/helper.c
parentf828df744376609907f8d054219233227efb3a34 (diff)
target/sparc: Remove CC_OP_TADDTV, CC_OP_TSUBTV
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/sparc/helper.c')
-rw-r--r--target/sparc/helper.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/target/sparc/helper.c b/target/sparc/helper.c
index 53eec693dd..6117e99b55 100644
--- a/target/sparc/helper.c
+++ b/target/sparc/helper.c
@@ -156,7 +156,7 @@ uint64_t helper_udivx(CPUSPARCState *env, uint64_t a, uint64_t b)
target_ulong helper_taddcctv(CPUSPARCState *env, target_ulong src1,
target_ulong src2)
{
- target_ulong dst;
+ target_ulong dst, v;
/* Tag overflow occurs if either input has bits 0 or 1 set. */
if ((src1 | src2) & 3) {
@@ -166,13 +166,23 @@ target_ulong helper_taddcctv(CPUSPARCState *env, target_ulong src1,
dst = src1 + src2;
/* Tag overflow occurs if the addition overflows. */
- if (~(src1 ^ src2) & (src1 ^ dst) & (1u << 31)) {
+ v = ~(src1 ^ src2) & (src1 ^ dst);
+ if (v & (1u << 31)) {
goto tag_overflow;
}
/* Only modify the CC after any exceptions have been generated. */
- env->cc_src = src1;
- env->cc_src2 = src2;
+ env->cc_V = v;
+ env->cc_N = dst;
+ env->icc_Z = dst;
+#ifdef TARGET_SPARC64
+ env->xcc_Z = dst;
+ env->icc_C = dst ^ src1 ^ src2;
+ env->xcc_C = dst < src1;
+#else
+ env->icc_C = dst < src1;
+#endif
+
return dst;
tag_overflow:
@@ -182,7 +192,7 @@ target_ulong helper_taddcctv(CPUSPARCState *env, target_ulong src1,
target_ulong helper_tsubcctv(CPUSPARCState *env, target_ulong src1,
target_ulong src2)
{
- target_ulong dst;
+ target_ulong dst, v;
/* Tag overflow occurs if either input has bits 0 or 1 set. */
if ((src1 | src2) & 3) {
@@ -192,13 +202,23 @@ target_ulong helper_tsubcctv(CPUSPARCState *env, target_ulong src1,
dst = src1 - src2;
/* Tag overflow occurs if the subtraction overflows. */
- if ((src1 ^ src2) & (src1 ^ dst) & (1u << 31)) {
+ v = (src1 ^ src2) & (src1 ^ dst);
+ if (v & (1u << 31)) {
goto tag_overflow;
}
/* Only modify the CC after any exceptions have been generated. */
- env->cc_src = src1;
- env->cc_src2 = src2;
+ env->cc_V = v;
+ env->cc_N = dst;
+ env->icc_Z = dst;
+#ifdef TARGET_SPARC64
+ env->xcc_Z = dst;
+ env->icc_C = dst ^ src1 ^ src2;
+ env->xcc_C = src1 < src2;
+#else
+ env->icc_C = src1 < src2;
+#endif
+
return dst;
tag_overflow: