target/arm: Implement fp16 for Neon VMAX, VMIN

Convert the Neon float-point VMAX and VMIN insns over to using
a gvec helper, and use this to implement the fp16 case.

Backport e43268c54b6cbcb197d179409df7126e81f8cd52
This commit is contained in:
Peter Maydell 2021-03-01 16:50:12 -05:00 committed by Lioncash
parent 6dd4a8e93f
commit 465cfb54c4
19 changed files with 78 additions and 3 deletions

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_aarch64
#define helper_gvec_fcmlas helper_gvec_fcmlas_aarch64
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_aarch64
#define helper_gvec_fmax_h helper_gvec_fmax_h_aarch64
#define helper_gvec_fmax_s helper_gvec_fmax_s_aarch64
#define helper_gvec_fmin_h helper_gvec_fmin_h_aarch64
#define helper_gvec_fmin_s helper_gvec_fmin_s_aarch64
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_aarch64
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_aarch64
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_aarch64

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_aarch64eb
#define helper_gvec_fcmlas helper_gvec_fcmlas_aarch64eb
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_aarch64eb
#define helper_gvec_fmax_h helper_gvec_fmax_h_aarch64eb
#define helper_gvec_fmax_s helper_gvec_fmax_s_aarch64eb
#define helper_gvec_fmin_h helper_gvec_fmin_h_aarch64eb
#define helper_gvec_fmin_s helper_gvec_fmin_s_aarch64eb
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_aarch64eb
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_aarch64eb
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_aarch64eb

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_arm
#define helper_gvec_fcmlas helper_gvec_fcmlas_arm
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_arm
#define helper_gvec_fmax_h helper_gvec_fmax_h_arm
#define helper_gvec_fmax_s helper_gvec_fmax_s_arm
#define helper_gvec_fmin_h helper_gvec_fmin_h_arm
#define helper_gvec_fmin_s helper_gvec_fmin_s_arm
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_arm
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_arm
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_arm

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_armeb
#define helper_gvec_fcmlas helper_gvec_fcmlas_armeb
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_armeb
#define helper_gvec_fmax_h helper_gvec_fmax_h_armeb
#define helper_gvec_fmax_s helper_gvec_fmax_s_armeb
#define helper_gvec_fmin_h helper_gvec_fmin_h_armeb
#define helper_gvec_fmin_s helper_gvec_fmin_s_armeb
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_armeb
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_armeb
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_armeb

View file

@ -1293,6 +1293,10 @@ symbols = (
'helper_gvec_fcmlah_idx',
'helper_gvec_fcmlas',
'helper_gvec_fcmlas_idx',
'helper_gvec_fmax_h',
'helper_gvec_fmax_s',
'helper_gvec_fmin_h',
'helper_gvec_fmin_s',
'helper_gvec_fmla_idx_d',
'helper_gvec_fmla_idx_h',
'helper_gvec_fmla_idx_s',

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_m68k
#define helper_gvec_fcmlas helper_gvec_fcmlas_m68k
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_m68k
#define helper_gvec_fmax_h helper_gvec_fmax_h_m68k
#define helper_gvec_fmax_s helper_gvec_fmax_s_m68k
#define helper_gvec_fmin_h helper_gvec_fmin_h_m68k
#define helper_gvec_fmin_s helper_gvec_fmin_s_m68k
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_m68k
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_m68k
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_m68k

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_mips
#define helper_gvec_fcmlas helper_gvec_fcmlas_mips
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_mips
#define helper_gvec_fmax_h helper_gvec_fmax_h_mips
#define helper_gvec_fmax_s helper_gvec_fmax_s_mips
#define helper_gvec_fmin_h helper_gvec_fmin_h_mips
#define helper_gvec_fmin_s helper_gvec_fmin_s_mips
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_mips
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_mips
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_mips

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_mips64
#define helper_gvec_fcmlas helper_gvec_fcmlas_mips64
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_mips64
#define helper_gvec_fmax_h helper_gvec_fmax_h_mips64
#define helper_gvec_fmax_s helper_gvec_fmax_s_mips64
#define helper_gvec_fmin_h helper_gvec_fmin_h_mips64
#define helper_gvec_fmin_s helper_gvec_fmin_s_mips64
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_mips64
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_mips64
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_mips64

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_mips64el
#define helper_gvec_fcmlas helper_gvec_fcmlas_mips64el
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_mips64el
#define helper_gvec_fmax_h helper_gvec_fmax_h_mips64el
#define helper_gvec_fmax_s helper_gvec_fmax_s_mips64el
#define helper_gvec_fmin_h helper_gvec_fmin_h_mips64el
#define helper_gvec_fmin_s helper_gvec_fmin_s_mips64el
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_mips64el
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_mips64el
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_mips64el

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_mipsel
#define helper_gvec_fcmlas helper_gvec_fcmlas_mipsel
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_mipsel
#define helper_gvec_fmax_h helper_gvec_fmax_h_mipsel
#define helper_gvec_fmax_s helper_gvec_fmax_s_mipsel
#define helper_gvec_fmin_h helper_gvec_fmin_h_mipsel
#define helper_gvec_fmin_s helper_gvec_fmin_s_mipsel
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_mipsel
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_mipsel
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_mipsel

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_powerpc
#define helper_gvec_fcmlas helper_gvec_fcmlas_powerpc
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_powerpc
#define helper_gvec_fmax_h helper_gvec_fmax_h_powerpc
#define helper_gvec_fmax_s helper_gvec_fmax_s_powerpc
#define helper_gvec_fmin_h helper_gvec_fmin_h_powerpc
#define helper_gvec_fmin_s helper_gvec_fmin_s_powerpc
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_powerpc
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_powerpc
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_powerpc

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_riscv32
#define helper_gvec_fcmlas helper_gvec_fcmlas_riscv32
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_riscv32
#define helper_gvec_fmax_h helper_gvec_fmax_h_riscv32
#define helper_gvec_fmax_s helper_gvec_fmax_s_riscv32
#define helper_gvec_fmin_h helper_gvec_fmin_h_riscv32
#define helper_gvec_fmin_s helper_gvec_fmin_s_riscv32
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_riscv32
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_riscv32
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_riscv32

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_riscv64
#define helper_gvec_fcmlas helper_gvec_fcmlas_riscv64
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_riscv64
#define helper_gvec_fmax_h helper_gvec_fmax_h_riscv64
#define helper_gvec_fmax_s helper_gvec_fmax_s_riscv64
#define helper_gvec_fmin_h helper_gvec_fmin_h_riscv64
#define helper_gvec_fmin_s helper_gvec_fmin_s_riscv64
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_riscv64
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_riscv64
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_riscv64

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_sparc
#define helper_gvec_fcmlas helper_gvec_fcmlas_sparc
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_sparc
#define helper_gvec_fmax_h helper_gvec_fmax_h_sparc
#define helper_gvec_fmax_s helper_gvec_fmax_s_sparc
#define helper_gvec_fmin_h helper_gvec_fmin_h_sparc
#define helper_gvec_fmin_s helper_gvec_fmin_s_sparc
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_sparc
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_sparc
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_sparc

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_sparc64
#define helper_gvec_fcmlas helper_gvec_fcmlas_sparc64
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_sparc64
#define helper_gvec_fmax_h helper_gvec_fmax_h_sparc64
#define helper_gvec_fmax_s helper_gvec_fmax_s_sparc64
#define helper_gvec_fmin_h helper_gvec_fmin_h_sparc64
#define helper_gvec_fmin_s helper_gvec_fmin_s_sparc64
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_sparc64
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_sparc64
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_sparc64

View file

@ -645,6 +645,12 @@ DEF_HELPER_FLAGS_5(gvec_facge_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_facgt_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_facgt_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_fmax_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_fmax_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_fmin_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_fmin_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_ftsmul_h, TCG_CALL_NO_RWG,
void, ptr, ptr, ptr, ptr, i32)
DEF_HELPER_FLAGS_5(gvec_ftsmul_s, TCG_CALL_NO_RWG,

View file

@ -1136,6 +1136,8 @@ DO_3S_FP_GVEC(VCGE, gen_helper_gvec_fcge_s, gen_helper_gvec_fcge_h)
DO_3S_FP_GVEC(VCGT, gen_helper_gvec_fcgt_s, gen_helper_gvec_fcgt_h)
DO_3S_FP_GVEC(VACGE, gen_helper_gvec_facge_s, gen_helper_gvec_facge_h)
DO_3S_FP_GVEC(VACGT, gen_helper_gvec_facgt_s, gen_helper_gvec_facgt_h)
DO_3S_FP_GVEC(VMAX, gen_helper_gvec_fmax_s, gen_helper_gvec_fmax_h)
DO_3S_FP_GVEC(VMIN, gen_helper_gvec_fmin_s, gen_helper_gvec_fmin_h)
/*
* For all the functions using this macro, size == 1 means fp16,
@ -1151,9 +1153,6 @@ DO_3S_FP_GVEC(VACGT, gen_helper_gvec_facgt_s, gen_helper_gvec_facgt_h)
return do_3same_fp(s, a, FUNC, READS_VD); \
}
DO_3S_FP(VMAX, gen_helper_vfp_maxs, false)
DO_3S_FP(VMIN, gen_helper_vfp_mins, false)
static void gen_VMLA_fp_3s(TCGContext *s, TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm,
TCGv_ptr fpstatus)
{

View file

@ -818,6 +818,12 @@ DO_3OP(gvec_facge_s, float32_acge, float32)
DO_3OP(gvec_facgt_h, float16_acgt, float16)
DO_3OP(gvec_facgt_s, float32_acgt, float32)
DO_3OP(gvec_fmax_h, float16_max, float16)
DO_3OP(gvec_fmax_s, float32_max, float32)
DO_3OP(gvec_fmin_h, float16_min, float16)
DO_3OP(gvec_fmin_s, float32_min, float32)
#ifdef TARGET_AARCH64
DO_3OP(gvec_recps_h, helper_recpsf_f16, float16)

View file

@ -1287,6 +1287,10 @@
#define helper_gvec_fcmlah_idx helper_gvec_fcmlah_idx_x86_64
#define helper_gvec_fcmlas helper_gvec_fcmlas_x86_64
#define helper_gvec_fcmlas_idx helper_gvec_fcmlas_idx_x86_64
#define helper_gvec_fmax_h helper_gvec_fmax_h_x86_64
#define helper_gvec_fmax_s helper_gvec_fmax_s_x86_64
#define helper_gvec_fmin_h helper_gvec_fmin_h_x86_64
#define helper_gvec_fmin_s helper_gvec_fmin_s_x86_64
#define helper_gvec_fmla_idx_d helper_gvec_fmla_idx_d_x86_64
#define helper_gvec_fmla_idx_h helper_gvec_fmla_idx_h_x86_64
#define helper_gvec_fmla_idx_s helper_gvec_fmla_idx_s_x86_64