summaryrefslogtreecommitdiff
path: root/target-s390x/fpu_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2012-08-24 07:44:43 -0700
committerRichard Henderson <rth@twiddle.net>2013-01-05 12:18:41 -0800
commit8379bfdbca195af9df1e6ecf67f04402bd80d471 (patch)
treec12279078df1ad7cab670a867f09ef4f5b55435f /target-s390x/fpu_helper.c
parent102bf2c63535122cba0d7917ed8cfb8cc1c7b14c (diff)
downloadqemu-8379bfdbca195af9df1e6ecf67f04402bd80d471.tar.gz
qemu-8379bfdbca195af9df1e6ecf67f04402bd80d471.tar.bz2
qemu-8379bfdbca195af9df1e6ecf67f04402bd80d471.zip
target-s390: Convert LFPC, SFPC
Note that we were failing to set the rounding mode in fpu_status. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-s390x/fpu_helper.c')
-rw-r--r--target-s390x/fpu_helper.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/target-s390x/fpu_helper.c b/target-s390x/fpu_helper.c
index ac530e9700..74b94f290f 100644
--- a/target-s390x/fpu_helper.c
+++ b/target-s390x/fpu_helper.c
@@ -577,3 +577,20 @@ uint64_t HELPER(sqxb)(CPUS390XState *env, uint64_t ah, uint64_t al)
handle_exceptions(env, GETPC());
return RET128(ret);
}
+
+/* set fpc */
+void HELPER(sfpc)(CPUS390XState *env, uint64_t fpc)
+{
+ static const int rnd[4] = {
+ float_round_nearest_even,
+ float_round_to_zero,
+ float_round_up,
+ float_round_down
+ };
+
+ /* Install everything in the main FPC. */
+ env->fpc = fpc;
+
+ /* Install the rounding mode in the shadow fpu_status. */
+ set_float_rounding_mode(rnd[fpc & 3], &env->fpu_status);
+}