target/arm: Implement fp16 for Neon VCVT fixed-point

Implement fp16 for the Neon VCVT insns which convert between
float and fixed-point.

Backports 24018cf3990b692b51e50183c5fbd98d17b3fa40
This commit is contained in:
Peter Maydell 2021-03-01 17:36:40 -05:00 committed by Lioncash
parent 948b01ad01
commit 56fe927d40
20 changed files with 85 additions and 1 deletions

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_aarch64
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_aarch64
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_aarch64
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_aarch64
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_aarch64
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_aarch64
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_aarch64
#define helper_power_down helper_power_down_aarch64
#define helper_pre_hvc helper_pre_hvc_aarch64
#define helper_pre_smc helper_pre_smc_aarch64

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_aarch64eb
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_aarch64eb
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_aarch64eb
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_aarch64eb
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_aarch64eb
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_aarch64eb
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_aarch64eb
#define helper_power_down helper_power_down_aarch64eb
#define helper_pre_hvc helper_pre_hvc_aarch64eb
#define helper_pre_smc helper_pre_smc_aarch64eb

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_arm
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_arm
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_arm
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_arm
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_arm
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_arm
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_arm
#define helper_power_down helper_power_down_arm
#define helper_pre_hvc helper_pre_hvc_arm
#define helper_pre_smc helper_pre_smc_arm

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_armeb
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_armeb
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_armeb
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_armeb
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_armeb
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_armeb
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_armeb
#define helper_power_down helper_power_down_armeb
#define helper_pre_hvc helper_pre_hvc_armeb
#define helper_pre_smc helper_pre_smc_armeb

View file

@ -1846,6 +1846,10 @@ symbols = (
'helper_gvec_vcvt_uf',
'helper_gvec_vcvt_fs',
'helper_gvec_vcvt_fu',
'helper_gvec_vcvt_sh',
'helper_gvec_vcvt_uh',
'helper_gvec_vcvt_hs',
'helper_gvec_vcvt_hu',
'helper_power_down',
'helper_pre_hvc',
'helper_pre_smc',

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_m68k
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_m68k
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_m68k
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_m68k
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_m68k
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_m68k
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_m68k
#define helper_power_down helper_power_down_m68k
#define helper_pre_hvc helper_pre_hvc_m68k
#define helper_pre_smc helper_pre_smc_m68k

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_mips
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_mips
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_mips
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_mips
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_mips
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_mips
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_mips
#define helper_power_down helper_power_down_mips
#define helper_pre_hvc helper_pre_hvc_mips
#define helper_pre_smc helper_pre_smc_mips

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_mips64
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_mips64
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_mips64
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_mips64
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_mips64
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_mips64
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_mips64
#define helper_power_down helper_power_down_mips64
#define helper_pre_hvc helper_pre_hvc_mips64
#define helper_pre_smc helper_pre_smc_mips64

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_mips64el
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_mips64el
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_mips64el
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_mips64el
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_mips64el
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_mips64el
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_mips64el
#define helper_power_down helper_power_down_mips64el
#define helper_pre_hvc helper_pre_hvc_mips64el
#define helper_pre_smc helper_pre_smc_mips64el

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_mipsel
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_mipsel
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_mipsel
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_mipsel
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_mipsel
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_mipsel
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_mipsel
#define helper_power_down helper_power_down_mipsel
#define helper_pre_hvc helper_pre_hvc_mipsel
#define helper_pre_smc helper_pre_smc_mipsel

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_powerpc
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_powerpc
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_powerpc
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_powerpc
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_powerpc
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_powerpc
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_powerpc
#define helper_power_down helper_power_down_powerpc
#define helper_pre_hvc helper_pre_hvc_powerpc
#define helper_pre_smc helper_pre_smc_powerpc

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_riscv32
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_riscv32
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_riscv32
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_riscv32
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_riscv32
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_riscv32
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_riscv32
#define helper_power_down helper_power_down_riscv32
#define helper_pre_hvc helper_pre_hvc_riscv32
#define helper_pre_smc helper_pre_smc_riscv32

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_riscv64
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_riscv64
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_riscv64
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_riscv64
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_riscv64
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_riscv64
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_riscv64
#define helper_power_down helper_power_down_riscv64
#define helper_pre_hvc helper_pre_hvc_riscv64
#define helper_pre_smc helper_pre_smc_riscv64

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_sparc
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_sparc
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_sparc
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_sparc
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_sparc
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_sparc
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_sparc
#define helper_power_down helper_power_down_sparc
#define helper_pre_hvc helper_pre_hvc_sparc
#define helper_pre_smc helper_pre_smc_sparc

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_sparc64
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_sparc64
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_sparc64
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_sparc64
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_sparc64
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_sparc64
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_sparc64
#define helper_power_down helper_power_down_sparc64
#define helper_pre_hvc helper_pre_hvc_sparc64
#define helper_pre_smc helper_pre_smc_sparc64

View file

@ -626,6 +626,11 @@ DEF_HELPER_FLAGS_4(gvec_vcvt_uf, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_vcvt_fs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_vcvt_fu, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_vcvt_sh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_vcvt_uh, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_vcvt_hs, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_vcvt_hu, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_frecpe_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_frecpe_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_4(gvec_frecpe_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)

View file

@ -254,6 +254,8 @@ VMINNM_fp_3s 1111 001 1 0 . 1 . .... .... 1111 ... 1 .... @3same_fp
# We use size=0 for fp32 and size=1 for fp16 to match the 3-same encodings.
@2reg_vcvt .... ... . . . 1 ..... .... .... . q:1 . . .... \
&2reg_shift vm=%vm_dp vd=%vd_dp size=0 shift=%neon_rshift_i5
@2reg_vcvt_f16 .... ... . . . 11 .... .... .... . q:1 . . .... \
&2reg_shift vm=%vm_dp vd=%vd_dp size=1 shift=%neon_rshift_i4
VSHR_S_2sh 1111 001 0 1 . ...... .... 0000 . . . 1 .... @2reg_shr_d
VSHR_S_2sh 1111 001 0 1 . ...... .... 0000 . . . 1 .... @2reg_shr_s
@ -370,7 +372,11 @@ VSHLL_U_2sh 1111 001 1 1 . ...... .... 1010 . 0 . 1 .... @2reg_shll_h
VSHLL_U_2sh 1111 001 1 1 . ...... .... 1010 . 0 . 1 .... @2reg_shll_b
# VCVT fixed<->float conversions
# TODO: FP16 fixed<->float conversions are opc==0b1100 and 0b1101
VCVT_SH_2sh 1111 001 0 1 . ...... .... 1100 0 . . 1 .... @2reg_vcvt_f16
VCVT_UH_2sh 1111 001 1 1 . ...... .... 1100 0 . . 1 .... @2reg_vcvt_f16
VCVT_HS_2sh 1111 001 0 1 . ...... .... 1101 0 . . 1 .... @2reg_vcvt_f16
VCVT_HU_2sh 1111 001 1 1 . ...... .... 1101 0 . . 1 .... @2reg_vcvt_f16
VCVT_SF_2sh 1111 001 0 1 . ...... .... 1110 0 . . 1 .... @2reg_vcvt
VCVT_UF_2sh 1111 001 1 1 . ...... .... 1110 0 . . 1 .... @2reg_vcvt
VCVT_FS_2sh 1111 001 0 1 . ...... .... 1111 0 . . 1 .... @2reg_vcvt

View file

@ -1684,6 +1684,11 @@ DO_FP_2SH(VCVT_UF, gen_helper_gvec_vcvt_uf)
DO_FP_2SH(VCVT_FS, gen_helper_gvec_vcvt_fs)
DO_FP_2SH(VCVT_FU, gen_helper_gvec_vcvt_fu)
DO_FP_2SH(VCVT_SH, gen_helper_gvec_vcvt_sh)
DO_FP_2SH(VCVT_UH, gen_helper_gvec_vcvt_uh)
DO_FP_2SH(VCVT_HS, gen_helper_gvec_vcvt_hs)
DO_FP_2SH(VCVT_HU, gen_helper_gvec_vcvt_hu)
static uint64_t asimd_imm_const(uint32_t imm, int cmode, int op)
{
/*

View file

@ -1863,5 +1863,9 @@ DO_VCVT_FIXED(gvec_vcvt_sf, helper_vfp_sltos, uint32_t)
DO_VCVT_FIXED(gvec_vcvt_uf, helper_vfp_ultos, uint32_t)
DO_VCVT_FIXED(gvec_vcvt_fs, helper_vfp_tosls_round_to_zero, uint32_t)
DO_VCVT_FIXED(gvec_vcvt_fu, helper_vfp_touls_round_to_zero, uint32_t)
DO_VCVT_FIXED(gvec_vcvt_sh, helper_vfp_shtoh, uint16_t)
DO_VCVT_FIXED(gvec_vcvt_uh, helper_vfp_uhtoh, uint16_t)
DO_VCVT_FIXED(gvec_vcvt_hs, helper_vfp_toshh_round_to_zero, uint16_t)
DO_VCVT_FIXED(gvec_vcvt_hu, helper_vfp_touhh_round_to_zero, uint16_t)
#undef DO_VCVT_FIXED

View file

@ -1840,6 +1840,10 @@
#define helper_gvec_vcvt_uf helper_gvec_vcvt_uf_x86_64
#define helper_gvec_vcvt_fs helper_gvec_vcvt_fs_x86_64
#define helper_gvec_vcvt_fu helper_gvec_vcvt_fu_x86_64
#define helper_gvec_vcvt_sh helper_gvec_vcvt_sh_x86_64
#define helper_gvec_vcvt_uh helper_gvec_vcvt_uh_x86_64
#define helper_gvec_vcvt_hs helper_gvec_vcvt_hs_x86_64
#define helper_gvec_vcvt_hu helper_gvec_vcvt_hu_x86_64
#define helper_power_down helper_power_down_x86_64
#define helper_pre_hvc helper_pre_hvc_x86_64
#define helper_pre_smc helper_pre_smc_x86_64