mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-31 22:55:40 +00:00
target/arm: Implement fp16 for Neon VMAXNM, VMINNM
Convert the Neon floating point VMAXNM and VMINNM insns to using a gvec helper and use this to implement the fp16 case. Backports e22705bb941d82d6c2a09e8b2031084326902be3
This commit is contained in:
parent
465cfb54c4
commit
0068d12355
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_aarch64
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_aarch64
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_aarch64
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_aarch64
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_aarch64eb
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_aarch64eb
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_aarch64eb
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_aarch64eb
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_arm
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_arm
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_arm
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_arm
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_armeb
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_armeb
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_armeb
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_armeb
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1296,7 +1296,11 @@ symbols = (
|
|||
'helper_gvec_fmax_h',
|
||||
'helper_gvec_fmax_s',
|
||||
'helper_gvec_fmin_h',
|
||||
'helper_gvec_fmaxnum_h',
|
||||
'helper_gvec_fmaxnum_s',
|
||||
'helper_gvec_fmin_s',
|
||||
'helper_gvec_fminnum_h',
|
||||
'helper_gvec_fminnum_s',
|
||||
'helper_gvec_fmla_idx_d',
|
||||
'helper_gvec_fmla_idx_h',
|
||||
'helper_gvec_fmla_idx_s',
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_m68k
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_m68k
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_m68k
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_m68k
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_mips
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_mips
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_mips
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_mips
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_mips64
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_mips64
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_mips64
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_mips64
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_mips64el
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_mips64el
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_mips64el
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_mips64el
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_mipsel
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_mipsel
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_mipsel
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_mipsel
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_powerpc
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_powerpc
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_powerpc
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_powerpc
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_riscv32
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_riscv32
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_riscv32
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_riscv32
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_riscv64
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_riscv64
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_riscv64
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_riscv64
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_sparc
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_sparc
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_sparc
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_sparc
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_sparc64
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_sparc64
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_sparc64
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_sparc64
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
|
@ -651,6 +651,12 @@ 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_fmaxnum_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_fmaxnum_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_5(gvec_fminnum_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_fminnum_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,
|
||||
|
|
|
@ -1170,6 +1170,11 @@ static void gen_VMLS_fp_3s(TCGContext *s, TCGv_i32 vd, TCGv_i32 vn, TCGv_i32 vm,
|
|||
DO_3S_FP(VMLA, gen_VMLA_fp_3s, true)
|
||||
DO_3S_FP(VMLS, gen_VMLS_fp_3s, true)
|
||||
|
||||
WRAP_FP_GVEC(gen_VMAXNM_fp32_3s, FPST_STD, gen_helper_gvec_fmaxnum_s)
|
||||
WRAP_FP_GVEC(gen_VMAXNM_fp16_3s, FPST_STD_F16, gen_helper_gvec_fmaxnum_h)
|
||||
WRAP_FP_GVEC(gen_VMINNM_fp32_3s, FPST_STD, gen_helper_gvec_fminnum_s)
|
||||
WRAP_FP_GVEC(gen_VMINNM_fp16_3s, FPST_STD_F16, gen_helper_gvec_fminnum_h)
|
||||
|
||||
static bool trans_VMAXNM_fp_3s(DisasContext *s, arg_3same *a)
|
||||
{
|
||||
if (!arm_dc_feature(s, ARM_FEATURE_V8)) {
|
||||
|
@ -1177,11 +1182,13 @@ static bool trans_VMAXNM_fp_3s(DisasContext *s, arg_3same *a)
|
|||
}
|
||||
|
||||
if (a->size != 0) {
|
||||
/* TODO fp16 support */
|
||||
return false;
|
||||
if (!dc_isar_feature(aa32_fp16_arith, s)) {
|
||||
return false;
|
||||
}
|
||||
return do_3same(s, a, gen_VMAXNM_fp16_3s);
|
||||
}
|
||||
|
||||
return do_3same_fp(s, a, gen_helper_vfp_maxnums, false);
|
||||
return do_3same(s, a, gen_VMAXNM_fp32_3s);
|
||||
}
|
||||
|
||||
static bool trans_VMINNM_fp_3s(DisasContext *s, arg_3same *a)
|
||||
|
@ -1191,11 +1198,13 @@ static bool trans_VMINNM_fp_3s(DisasContext *s, arg_3same *a)
|
|||
}
|
||||
|
||||
if (a->size != 0) {
|
||||
/* TODO fp16 support */
|
||||
return false;
|
||||
if (!dc_isar_feature(aa32_fp16_arith, s)) {
|
||||
return false;
|
||||
}
|
||||
return do_3same(s, a, gen_VMINNM_fp16_3s);
|
||||
}
|
||||
|
||||
return do_3same_fp(s, a, gen_helper_vfp_minnums, false);
|
||||
return do_3same(s, a, gen_VMINNM_fp32_3s);
|
||||
}
|
||||
|
||||
WRAP_ENV_FN(gen_VRECPS_tramp, gen_helper_recps_f32)
|
||||
|
|
|
@ -824,6 +824,12 @@ DO_3OP(gvec_fmax_s, float32_max, float32)
|
|||
DO_3OP(gvec_fmin_h, float16_min, float16)
|
||||
DO_3OP(gvec_fmin_s, float32_min, float32)
|
||||
|
||||
DO_3OP(gvec_fmaxnum_h, float16_maxnum, float16)
|
||||
DO_3OP(gvec_fmaxnum_s, float32_maxnum, float32)
|
||||
|
||||
DO_3OP(gvec_fminnum_h, float16_minnum, float16)
|
||||
DO_3OP(gvec_fminnum_s, float32_minnum, float32)
|
||||
|
||||
#ifdef TARGET_AARCH64
|
||||
|
||||
DO_3OP(gvec_recps_h, helper_recpsf_f16, float16)
|
||||
|
|
|
@ -1290,7 +1290,11 @@
|
|||
#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_fmaxnum_h helper_gvec_fmaxnum_h_x86_64
|
||||
#define helper_gvec_fmaxnum_s helper_gvec_fmaxnum_s_x86_64
|
||||
#define helper_gvec_fmin_s helper_gvec_fmin_s_x86_64
|
||||
#define helper_gvec_fminnum_h helper_gvec_fminnum_h_x86_64
|
||||
#define helper_gvec_fminnum_s helper_gvec_fminnum_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
|
||||
|
|
Loading…
Reference in a new issue