summaryrefslogtreecommitdiffstats
path: root/target/s390x/fpu_helper.c
diff options
context:
space:
mode:
authorDavid Hildenbrand2019-02-18 13:27:08 +0100
committerCornelia Huck2019-03-04 11:49:31 +0100
commitbdcfcd445dd4f07e4df5345f1cdd0da5a5e6ba5f (patch)
treea2898ea60fcb1496aa2348590068cd27c1afcdcf /target/s390x/fpu_helper.c
parents390x/tcg: Implement XxC and checks for most FP instructions (diff)
downloadqemu-bdcfcd445dd4f07e4df5345f1cdd0da5a5e6ba5f.tar.gz
qemu-bdcfcd445dd4f07e4df5345f1cdd0da5a5e6ba5f.tar.xz
qemu-bdcfcd445dd4f07e4df5345f1cdd0da5a5e6ba5f.zip
s390x/tcg: Implement rounding mode and XxC for LOAD ROUNDED
With the floating-point extension facility, LOAD ROUNDED has a rounding mode specification and the inexact-exception control (XxC). Handle them just like e.g. LOAD FP INTEGER. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20190218122710.23639-14-david@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'target/s390x/fpu_helper.c')
-rw-r--r--target/s390x/fpu_helper.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c
index 906280bfcd..e258f20aa9 100644
--- a/target/s390x/fpu_helper.c
+++ b/target/s390x/fpu_helper.c
@@ -317,10 +317,14 @@ uint64_t HELPER(ldeb)(CPUS390XState *env, uint64_t f2)
}
/* convert 128-bit float to 64-bit float */
-uint64_t HELPER(ldxb)(CPUS390XState *env, uint64_t ah, uint64_t al)
+uint64_t HELPER(ldxb)(CPUS390XState *env, uint64_t ah, uint64_t al,
+ uint32_t m34)
{
+ int old_mode = s390_swap_bfp_rounding_mode(env, round_from_m34(m34));
float64 ret = float128_to_float64(make_float128(ah, al), &env->fpu_status);
- handle_exceptions(env, false, GETPC());
+
+ s390_restore_bfp_rounding_mode(env, old_mode);
+ handle_exceptions(env, xxc_from_m34(m34), GETPC());
return ret;
}
@@ -341,18 +345,25 @@ uint64_t HELPER(lxeb)(CPUS390XState *env, uint64_t f2)
}
/* convert 64-bit float to 32-bit float */
-uint64_t HELPER(ledb)(CPUS390XState *env, uint64_t f2)
+uint64_t HELPER(ledb)(CPUS390XState *env, uint64_t f2, uint32_t m34)
{
+ int old_mode = s390_swap_bfp_rounding_mode(env, round_from_m34(m34));
float32 ret = float64_to_float32(f2, &env->fpu_status);
- handle_exceptions(env, false, GETPC());
+
+ s390_restore_bfp_rounding_mode(env, old_mode);
+ handle_exceptions(env, xxc_from_m34(m34), GETPC());
return ret;
}
/* convert 128-bit float to 32-bit float */
-uint64_t HELPER(lexb)(CPUS390XState *env, uint64_t ah, uint64_t al)
+uint64_t HELPER(lexb)(CPUS390XState *env, uint64_t ah, uint64_t al,
+ uint32_t m34)
{
+ int old_mode = s390_swap_bfp_rounding_mode(env, round_from_m34(m34));
float32 ret = float128_to_float32(make_float128(ah, al), &env->fpu_status);
- handle_exceptions(env, false, GETPC());
+
+ s390_restore_bfp_rounding_mode(env, old_mode);
+ handle_exceptions(env, xxc_from_m34(m34), GETPC());
return ret;
}