diff options
author | David Brenken <david.brenken@efs-auto.de> | 2019-06-24 09:03:35 +0200 |
---|---|---|
committer | Bastian Koppelmann <kbastian@mail.uni-paderborn.de> | 2019-06-25 12:11:33 +0200 |
commit | 1fa79fb02d85c8f2ba9f6f9cabaf1b3ab34b7bcd (patch) | |
tree | bf2f89b6c1a073249993a6f9e2e6f5c8b98e0a8c /target/tricore/fpu_helper.c | |
parent | 474f3938d79ab36b9231c9ad3b5a9314c2aeacde (diff) |
tricore: add FTOIZ instruction
Signed-off-by: Andreas Konopik <andreas.konopik@efs-auto.de>
Signed-off-by: David Brenken <david.brenken@efs-auto.de>
Signed-off-by: Georg Hofstetter <georg.hofstetter@efs-auto.de>
Signed-off-by: Robert Rasche <robert.rasche@efs-auto.de>
Signed-off-by: Lars Biermanski <lars.biermanski@efs-auto.de>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <20190624070339.4408-2-david.brenken@efs-auto.org>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Diffstat (limited to 'target/tricore/fpu_helper.c')
-rw-r--r-- | target/tricore/fpu_helper.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/target/tricore/fpu_helper.c b/target/tricore/fpu_helper.c index d8a6c0d25b..f079d9e939 100644 --- a/target/tricore/fpu_helper.c +++ b/target/tricore/fpu_helper.c @@ -303,6 +303,31 @@ uint32_t helper_itof(CPUTriCoreState *env, uint32_t arg) return (uint32_t)f_result; } +uint32_t helper_ftoiz(CPUTriCoreState *env, uint32_t arg) +{ + float32 f_arg = make_float32(arg); + uint32_t result; + int32_t flags; + + result = float32_to_int32_round_to_zero(f_arg, &env->fp_status); + + flags = f_get_excp_flags(env); + if (flags & float_flag_invalid) { + flags &= ~float_flag_inexact; + if (float32_is_any_nan(f_arg)) { + result = 0; + } + } + + if (flags) { + f_update_psw_flags(env, flags); + } else { + env->FPU_FS = 0; + } + + return result; +} + uint32_t helper_ftouz(CPUTriCoreState *env, uint32_t arg) { float32 f_arg = make_float32(arg); |