mirror of https://github.com/xemu-project/xemu.git
target/arm: Use gvec for neon pmax, pmin
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20240524232121.284515-35-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
28b5451bec
commit
a9240f482c
|
@ -831,6 +831,10 @@ DO_3SAME_NO_SZ_3(VABA_S, gen_gvec_saba)
|
|||
DO_3SAME_NO_SZ_3(VABD_U, gen_gvec_uabd)
|
||||
DO_3SAME_NO_SZ_3(VABA_U, gen_gvec_uaba)
|
||||
DO_3SAME_NO_SZ_3(VPADD, gen_gvec_addp)
|
||||
DO_3SAME_NO_SZ_3(VPMAX_S, gen_gvec_smaxp)
|
||||
DO_3SAME_NO_SZ_3(VPMIN_S, gen_gvec_sminp)
|
||||
DO_3SAME_NO_SZ_3(VPMAX_U, gen_gvec_umaxp)
|
||||
DO_3SAME_NO_SZ_3(VPMIN_U, gen_gvec_uminp)
|
||||
|
||||
#define DO_3SAME_CMP(INSN, COND) \
|
||||
static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
|
||||
|
@ -1003,80 +1007,6 @@ DO_3SAME_32_ENV(VQSHL_U, qshl_u)
|
|||
DO_3SAME_32_ENV(VQRSHL_S, qrshl_s)
|
||||
DO_3SAME_32_ENV(VQRSHL_U, qrshl_u)
|
||||
|
||||
static bool do_3same_pair(DisasContext *s, arg_3same *a, NeonGenTwoOpFn *fn)
|
||||
{
|
||||
/* Operations handled pairwise 32 bits at a time */
|
||||
TCGv_i32 tmp, tmp2, tmp3;
|
||||
|
||||
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* UNDEF accesses to D16-D31 if they don't exist. */
|
||||
if (!dc_isar_feature(aa32_simd_r32, s) &&
|
||||
((a->vd | a->vn | a->vm) & 0x10)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a->size == 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vfp_access_check(s)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
assert(a->q == 0); /* enforced by decode patterns */
|
||||
|
||||
/*
|
||||
* Note that we have to be careful not to clobber the source operands
|
||||
* in the "vm == vd" case by storing the result of the first pass too
|
||||
* early. Since Q is 0 there are always just two passes, so instead
|
||||
* of a complicated loop over each pass we just unroll.
|
||||
*/
|
||||
tmp = tcg_temp_new_i32();
|
||||
tmp2 = tcg_temp_new_i32();
|
||||
tmp3 = tcg_temp_new_i32();
|
||||
|
||||
read_neon_element32(tmp, a->vn, 0, MO_32);
|
||||
read_neon_element32(tmp2, a->vn, 1, MO_32);
|
||||
fn(tmp, tmp, tmp2);
|
||||
|
||||
read_neon_element32(tmp3, a->vm, 0, MO_32);
|
||||
read_neon_element32(tmp2, a->vm, 1, MO_32);
|
||||
fn(tmp3, tmp3, tmp2);
|
||||
|
||||
write_neon_element32(tmp, a->vd, 0, MO_32);
|
||||
write_neon_element32(tmp3, a->vd, 1, MO_32);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define DO_3SAME_PAIR(INSN, func) \
|
||||
static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \
|
||||
{ \
|
||||
static NeonGenTwoOpFn * const fns[] = { \
|
||||
gen_helper_neon_##func##8, \
|
||||
gen_helper_neon_##func##16, \
|
||||
gen_helper_neon_##func##32, \
|
||||
}; \
|
||||
if (a->size > 2) { \
|
||||
return false; \
|
||||
} \
|
||||
return do_3same_pair(s, a, fns[a->size]); \
|
||||
}
|
||||
|
||||
/* 32-bit pairwise ops end up the same as the elementwise versions. */
|
||||
#define gen_helper_neon_pmax_s32 tcg_gen_smax_i32
|
||||
#define gen_helper_neon_pmax_u32 tcg_gen_umax_i32
|
||||
#define gen_helper_neon_pmin_s32 tcg_gen_smin_i32
|
||||
#define gen_helper_neon_pmin_u32 tcg_gen_umin_i32
|
||||
|
||||
DO_3SAME_PAIR(VPMAX_S, pmax_s)
|
||||
DO_3SAME_PAIR(VPMIN_S, pmin_s)
|
||||
DO_3SAME_PAIR(VPMAX_U, pmax_u)
|
||||
DO_3SAME_PAIR(VPMIN_U, pmin_u)
|
||||
|
||||
#define DO_3SAME_VQDMULH(INSN, FUNC) \
|
||||
WRAP_ENV_FN(gen_##INSN##_tramp16, gen_helper_neon_##FUNC##_s16); \
|
||||
WRAP_ENV_FN(gen_##INSN##_tramp32, gen_helper_neon_##FUNC##_s32); \
|
||||
|
|
Loading…
Reference in New Issue