aboutsummaryrefslogtreecommitdiff
path: root/target-tricore/helper.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-03-24 12:36:38 +0000
committerPeter Maydell <peter.maydell@linaro.org>2016-03-24 12:36:39 +0000
commita2ecc80db5078dd98b60a7d03af9a4da3e1bad25 (patch)
tree7cb9a733899407c431663e8e2e1d5d50cc2f4326 /target-tricore/helper.c
parent2538039f2c26d66053426fb547e4f25e669baf62 (diff)
parent0d4c3b8010320a8ebb4061d88510e082b06ed2cc (diff)
Merge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20160323' into staging
TriCore FPU + bugfixes # gpg: Signature made Wed 23 Mar 2016 08:26:03 GMT using RSA key ID 6B69CA14 # gpg: Good signature from "Bastian Koppelmann <kbastian@mail.uni-paderborn.de>" * remotes/bkoppelmann/tags/pull-tricore-20160323: target-tricore: Add ftoi and itof instructions target-tricore: Add cmp.f instruction target-tricore: Add div.f instruction target-tricore: Add mul.f instruction target-tricore: add add.f/sub.f instructions target-tricore: Move general CHECK_REG_PAIR of decode_rrr_divide target-tricore: Add FPU infrastructure target-tricore: Fix psw_read() clearing too many bits target-tricore: Fix helper_msub64_q_ssov not reseting OVF bit target-tricore: add missing break in insn decode switch stmt Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-tricore/helper.c')
-rw-r--r--target-tricore/helper.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/target-tricore/helper.c b/target-tricore/helper.c
index 7d96daddb1..71b31cdb9b 100644
--- a/target-tricore/helper.c
+++ b/target-tricore/helper.c
@@ -110,10 +110,18 @@ 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 */
- env->PSW &= 0xffffff;
+ env->PSW &= 0x6ffffff;
/* now set them from the cache */
env->PSW |= ((env->PSW_USB_C != 0) << 31);
env->PSW |= ((env->PSW_USB_V & (1 << 31)) >> 1);
@@ -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);
}