summaryrefslogtreecommitdiffstats
path: root/target/s390x/fpu_helper.c
diff options
context:
space:
mode:
authorDavid Hildenbrand2019-02-18 13:27:04 +0100
committerCornelia Huck2019-03-04 11:49:31 +0100
commitb9c737f58e82bf89efaa4a04ab3f730342c06a3a (patch)
treef559054f7e61040886ecc11497414c75989e0924 /target/s390x/fpu_helper.c
parents390x/tcg: Handle SET FPC AND LOAD FPC 3-bit BFP rounding modes (diff)
downloadqemu-b9c737f58e82bf89efaa4a04ab3f730342c06a3a.tar.gz
qemu-b9c737f58e82bf89efaa4a04ab3f730342c06a3a.tar.xz
qemu-b9c737f58e82bf89efaa4a04ab3f730342c06a3a.zip
s390x/tcg: Check for exceptions in SET BFP ROUNDING MODE
Let's split handling of BFP/DFP rounding mode configuration. Also, let's not reuse the sfpc handler, use a separate handler so we can properly check for specification exceptions for SRNMB. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20190218122710.23639-10-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.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/target/s390x/fpu_helper.c b/target/s390x/fpu_helper.c
index 4dc70ec60f..ed9c74c420 100644
--- a/target/s390x/fpu_helper.c
+++ b/target/s390x/fpu_helper.c
@@ -819,3 +819,14 @@ void HELPER(sfas)(CPUS390XState *env, uint64_t fpc)
tcg_s390_data_exception(env, s390_exc | 3, GETPC());
}
}
+
+/* set bfp rounding mode */
+void HELPER(srnm)(CPUS390XState *env, uint64_t rnd)
+{
+ if (rnd > 0x7 || fpc_to_rnd[rnd & 0x7] == -1) {
+ s390_program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO, GETPC());
+ }
+
+ env->fpc = deposit32(env->fpc, 0, 3, rnd);
+ set_float_rounding_mode(fpc_to_rnd[rnd & 0x7], &env->fpu_status);
+}