[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 09/28] target/arm: convert conversion helpers to
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PULL 09/28] target/arm: convert conversion helpers to fpst/ahp_flag |
Date: |
Thu, 17 May 2018 11:16:23 +0100 |
On 16 May 2018 at 16:52, Richard Henderson <address@hidden> wrote:
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 731cf327a1..613598d090 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
Just noticed, but in the 32-bit translator where the argument to
get_fpstatus_ptr() is "is this neon?" (ie "do we use the standard
FPSCR value"), shouldn't we be passing 'true' to get_fpstatus_ptr()
for the halfprec conversions in disas_neon_data_insn() ?
I haven't tested, but I imagine that otherwise you get the wrong
results if the input is a denormal and FPSCR.FZ is 0 or if the
output should be a NaN and FPSCR.DN is 0.
> @@ -7222,53 +7247,70 @@ static int disas_neon_data_insn(DisasContext *s,
> uint32_t insn)
> }
> break;
> case NEON_2RM_VCVT_F16_F32:
> + {
> + TCGv_ptr fpst;
> + TCGv_i32 ahp;
> +
> if (!arm_dc_feature(s, ARM_FEATURE_VFP_FP16) ||
> q || (rm & 1)) {
> return 1;
> }
> tmp = tcg_temp_new_i32();
> tmp2 = tcg_temp_new_i32();
> + fpst = get_fpstatus_ptr(false);
> + ahp = get_ahp_flag();
> tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 0));
> - gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
> + gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, fpst, ahp);
> tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 1));
> - gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
> + gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, fpst, ahp);
> tcg_gen_shli_i32(tmp2, tmp2, 16);
> tcg_gen_or_i32(tmp2, tmp2, tmp);
> tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 2));
> - gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
> + gen_helper_vfp_fcvt_f32_to_f16(tmp, cpu_F0s, fpst, ahp);
> tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 3));
> neon_store_reg(rd, 0, tmp2);
> tmp2 = tcg_temp_new_i32();
> - gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
> + gen_helper_vfp_fcvt_f32_to_f16(tmp2, cpu_F0s, fpst, ahp);
> tcg_gen_shli_i32(tmp2, tmp2, 16);
> tcg_gen_or_i32(tmp2, tmp2, tmp);
> neon_store_reg(rd, 1, tmp2);
> tcg_temp_free_i32(tmp);
> + tcg_temp_free_i32(ahp);
> + tcg_temp_free_ptr(fpst);
> break;
> + }
> case NEON_2RM_VCVT_F32_F16:
> + {
> + TCGv_ptr fpst;
> + TCGv_i32 ahp;
> if (!arm_dc_feature(s, ARM_FEATURE_VFP_FP16) ||
> q || (rd & 1)) {
> return 1;
> }
> + fpst = get_fpstatus_ptr(false);
> + ahp = get_ahp_flag();
> tmp3 = tcg_temp_new_i32();
> tmp = neon_load_reg(rm, 0);
> tmp2 = neon_load_reg(rm, 1);
> tcg_gen_ext16u_i32(tmp3, tmp);
> - gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
> + gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, fpst, ahp);
> tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 0));
> tcg_gen_shri_i32(tmp3, tmp, 16);
> - gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
> + gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, fpst, ahp);
> tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 1));
> tcg_temp_free_i32(tmp);
> tcg_gen_ext16u_i32(tmp3, tmp2);
> - gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
> + gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, fpst, ahp);
> tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 2));
> tcg_gen_shri_i32(tmp3, tmp2, 16);
> - gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
> + gen_helper_vfp_fcvt_f16_to_f32(cpu_F0s, tmp3, fpst, ahp);
> tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 3));
> tcg_temp_free_i32(tmp2);
> tcg_temp_free_i32(tmp3);
> + tcg_temp_free_i32(ahp);
> + tcg_temp_free_ptr(fpst);
> break;
> + }
> case NEON_2RM_AESE: case NEON_2RM_AESMC:
> if (!arm_dc_feature(s, ARM_FEATURE_V8_AES)
> || ((rm | rd) & 1)) {
> --
> 2.17.0
>
thanks
-- PMM
- [Qemu-devel] [PULL 01/28] fpu/softfloat: Fix conversion from uint64 to float128, (continued)
- [Qemu-devel] [PULL 01/28] fpu/softfloat: Fix conversion from uint64 to float128, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 02/28] fpu/softfloat: Merge NO_SIGNALING_NANS definitions, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 03/28] fpu/softfloat: Split floatXX_silence_nan from floatXX_maybe_silence_nan, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 05/28] fpu/softfloat: Canonicalize NaN fraction, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 04/28] fpu/softfloat: Move softfloat-specialize.h below FloatParts definition, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 08/28] fpu/softfloat: Replace float_class_msnan with parts_silence_nan, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 07/28] fpu/softfloat: Replace float_class_dnan with parts_default_nan, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 06/28] fpu/softfloat: Introduce parts_is_snan_frac, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 11/28] fpu/softfloat: Partial support for ARM Alternative half-precision, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 09/28] target/arm: convert conversion helpers to fpst/ahp_flag, Richard Henderson, 2018/05/16
- Re: [Qemu-devel] [PULL 09/28] target/arm: convert conversion helpers to fpst/ahp_flag,
Peter Maydell <=
- [Qemu-devel] [PULL 14/28] target/arm: Remove floatX_maybe_silence_nan from conversions, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 12/28] fpu/softfloat: re-factor float to float conversions, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 10/28] target/arm: squash FZ16 behaviour for conversions, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 13/28] target/arm: Use floatX_silence_nan when we have already checked for SNaN, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 15/28] target/hppa: Remove floatX_maybe_silence_nan from conversions, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 16/28] target/m68k: Use floatX_silence_nan when we have already checked for SNaN, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 17/28] target/mips: Remove floatX_maybe_silence_nan from conversions, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 18/28] target/riscv: Remove floatX_maybe_silence_nan from conversions, Richard Henderson, 2018/05/16
- [Qemu-devel] [PULL 19/28] target/s390x: Remove floatX_maybe_silence_nan from conversions, Richard Henderson, 2018/05/16