aboutsummaryrefslogtreecommitdiff
path: root/target-tricore/helper.c
diff options
context:
space:
mode:
authorBastian Koppelmann <kbastian@mail.uni-paderborn.de>2016-03-11 16:03:11 +0100
committerBastian Koppelmann <kbastian@mail.uni-paderborn.de>2016-03-23 09:22:48 +0100
commit996a729f9b7f93fb921891bf0e07757a29d0c68a (patch)
treeaa4f52d2b9a699187c4afc52c24258b85caf069a /target-tricore/helper.c
parent1bd3e2fc3de683941f18e346a1793b81b20cab2d (diff)
target-tricore: Add FPU infrastructure
This patch adds a file for all the FPU related helpers with all the includes, useful defines, and a function to update the status bits. Additionally it adds a mask for the rounding mode bits of PSW as well as all the opcodes for the FPU instructions. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Message-Id: <1457708597-3025-2-git-send-email-kbastian@mail.uni-paderborn.de>
Diffstat (limited to 'target-tricore/helper.c')
-rw-r--r--target-tricore/helper.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/target-tricore/helper.c b/target-tricore/helper.c
index adbb6db10d..71b31cdb9b 100644
--- a/target-tricore/helper.c
+++ b/target-tricore/helper.c
@@ -110,6 +110,14 @@ void tricore_cpu_list(FILE *f, fprintf_function cpu_fprintf)
g_slist_free(list);
}
+void fpu_set_state(CPUTriCoreState *env)
+{
+ set_float_rounding_mode(env->PSW & MASK_PSW_FPU_RM, &env->fp_status);
+ set_flush_inputs_to_zero(1, &env->fp_status);
+ set_flush_to_zero(1, &env->fp_status);
+ set_default_nan_mode(1, &env->fp_status);
+}
+
uint32_t psw_read(CPUTriCoreState *env)
{
/* clear all USB bits */
@@ -132,4 +140,6 @@ void psw_write(CPUTriCoreState *env, uint32_t val)
env->PSW_USB_AV = (val & MASK_USB_AV) << 3;
env->PSW_USB_SAV = (val & MASK_USB_SAV) << 4;
env->PSW = val;
+
+ fpu_set_state(env);
}