diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-05-25 15:58:08 -0700 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-06-03 16:43:26 +0100 |
commit | 3a98ac40fa9fca85bb37f4281e872b7519e733c5 (patch) | |
tree | 3bdeb6c155cb03d4830914dc6647852d9e446375 /target/arm/translate-vfp.c | |
parent | fc5200ee4583cb9110ee7bda71a65890d787882e (diff) | |
download | qemu-3a98ac40fa9fca85bb37f4281e872b7519e733c5.zip qemu-3a98ac40fa9fca85bb37f4281e872b7519e733c5.tar.gz qemu-3a98ac40fa9fca85bb37f4281e872b7519e733c5.tar.bz2 |
target/arm: Implement scalar float32 to bfloat16 conversion
This is the 64-bit BFCVT and the 32-bit VCVT{B,T}.BF16.F32.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210525225817.400336-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/translate-vfp.c')
-rw-r--r-- | target/arm/translate-vfp.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 2316e10..d01e465 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -3085,6 +3085,30 @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a) return true; } +static bool trans_VCVT_b16_f32(DisasContext *s, arg_VCVT_b16_f32 *a) +{ + TCGv_ptr fpst; + TCGv_i32 tmp; + + if (!dc_isar_feature(aa32_bf16, s)) { + return false; + } + + if (!vfp_access_check(s)) { + return true; + } + + fpst = fpstatus_ptr(FPST_FPCR); + tmp = tcg_temp_new_i32(); + + vfp_load_reg32(tmp, a->vm); + gen_helper_bfcvt(tmp, tmp, fpst); + tcg_gen_st16_i32(tmp, cpu_env, vfp_f16_offset(a->vd, a->t)); + tcg_temp_free_ptr(fpst); + tcg_temp_free_i32(tmp); + return true; +} + static bool trans_VCVT_f16_f32(DisasContext *s, arg_VCVT_f16_f32 *a) { TCGv_ptr fpst; |