mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
target/tricore: Implement hptof insn
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1667 Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Message-ID: <20230828112651.522058-8-kbastian@mail.uni-paderborn.de>
This commit is contained in:
parent
815061b9da
commit
5e0e06d9a2
6 changed files with 58 additions and 0 deletions
|
@ -373,6 +373,42 @@ uint32_t helper_ftoi(CPUTriCoreState *env, uint32_t arg)
|
|||
return (uint32_t)result;
|
||||
}
|
||||
|
||||
uint32_t helper_hptof(CPUTriCoreState *env, uint32_t arg)
|
||||
{
|
||||
float16 f_arg = make_float16(arg);
|
||||
uint32_t result = 0;
|
||||
int32_t flags = 0;
|
||||
|
||||
/*
|
||||
* if we have any NAN we need to move the top 2 and lower 8 input mantissa
|
||||
* bits to the top 2 and lower 8 output mantissa bits respectively.
|
||||
* Softfloat on the other hand uses the top 10 mantissa bits.
|
||||
*/
|
||||
if (float16_is_any_nan(f_arg)) {
|
||||
if (float16_is_signaling_nan(f_arg, &env->fp_status)) {
|
||||
flags |= float_flag_invalid;
|
||||
}
|
||||
result = 0;
|
||||
result = float32_set_sign(result, f_arg >> 15);
|
||||
result = deposit32(result, 23, 8, 0xff);
|
||||
result = deposit32(result, 21, 2, extract32(f_arg, 8, 2));
|
||||
result = deposit32(result, 0, 8, extract32(f_arg, 0, 8));
|
||||
} else {
|
||||
set_flush_inputs_to_zero(0, &env->fp_status);
|
||||
result = float16_to_float32(f_arg, true, &env->fp_status);
|
||||
set_flush_inputs_to_zero(1, &env->fp_status);
|
||||
flags = f_get_excp_flags(env);
|
||||
}
|
||||
|
||||
if (flags) {
|
||||
f_update_psw_flags(env, flags);
|
||||
} else {
|
||||
env->FPU_FS = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t helper_ftohp(CPUTriCoreState *env, uint32_t arg)
|
||||
{
|
||||
float32 f_arg = make_float32(arg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue