target/arm: Add BFADD, BFSUB, BFMUL, BFMAXNM, BFMINNM (predicated)
FEAT_SVE_B16B16 adds bfloat16 versions of the SVE floating point
(predicated) instructions, which are encoded via sz=0b00.
Add BFADD, BFSUB, BFMUL, BFMAXNM, BFMINNM; these are all the insns
in this group which do not change behaviour for AH=1.
We will deal with BFMAX/BFMIN (which do have different AH=1
behaviour) in a following commit.
Fixes: 7b1613a102 ("target/arm: Enable FEAT_SME2p1 on -cpu max")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250718173032.2498900-3-peter.maydell@linaro.org
This commit is contained in:
parent
2b5a9bbbad
commit
86fa06f8d9
3 changed files with 32 additions and 5 deletions
|
|
@ -1196,6 +1196,8 @@ DEF_HELPER_FLAGS_5(sve_fcmne0_s, TCG_CALL_NO_RWG,
|
|||
DEF_HELPER_FLAGS_5(sve_fcmne0_d, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, fpst, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_6(sve_fadd_b16, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fadd_h, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fadd_s, TCG_CALL_NO_RWG,
|
||||
|
|
@ -1203,6 +1205,8 @@ DEF_HELPER_FLAGS_6(sve_fadd_s, TCG_CALL_NO_RWG,
|
|||
DEF_HELPER_FLAGS_6(sve_fadd_d, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_6(sve_fsub_b16, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fsub_h, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fsub_s, TCG_CALL_NO_RWG,
|
||||
|
|
@ -1210,6 +1214,8 @@ DEF_HELPER_FLAGS_6(sve_fsub_s, TCG_CALL_NO_RWG,
|
|||
DEF_HELPER_FLAGS_6(sve_fsub_d, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_6(sve_fmul_b16, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fmul_h, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fmul_s, TCG_CALL_NO_RWG,
|
||||
|
|
@ -1252,6 +1258,8 @@ DEF_HELPER_FLAGS_6(sve_ah_fmax_s, TCG_CALL_NO_RWG,
|
|||
DEF_HELPER_FLAGS_6(sve_ah_fmax_d, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_6(sve_fminnum_b16, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fminnum_h, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fminnum_s, TCG_CALL_NO_RWG,
|
||||
|
|
@ -1259,6 +1267,8 @@ DEF_HELPER_FLAGS_6(sve_fminnum_s, TCG_CALL_NO_RWG,
|
|||
DEF_HELPER_FLAGS_6(sve_fminnum_d, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_6(sve_fmaxnum_b16, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fmaxnum_h, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fmaxnum_s, TCG_CALL_NO_RWG,
|
||||
|
|
|
|||
|
|
@ -4629,14 +4629,17 @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *vg, \
|
|||
} while (i != 0); \
|
||||
}
|
||||
|
||||
DO_ZPZZ_FP(sve_fadd_b16, uint16_t, H1_2, bfloat16_add)
|
||||
DO_ZPZZ_FP(sve_fadd_h, uint16_t, H1_2, float16_add)
|
||||
DO_ZPZZ_FP(sve_fadd_s, uint32_t, H1_4, float32_add)
|
||||
DO_ZPZZ_FP(sve_fadd_d, uint64_t, H1_8, float64_add)
|
||||
|
||||
DO_ZPZZ_FP(sve_fsub_b16, uint16_t, H1_2, bfloat16_sub)
|
||||
DO_ZPZZ_FP(sve_fsub_h, uint16_t, H1_2, float16_sub)
|
||||
DO_ZPZZ_FP(sve_fsub_s, uint32_t, H1_4, float32_sub)
|
||||
DO_ZPZZ_FP(sve_fsub_d, uint64_t, H1_8, float64_sub)
|
||||
|
||||
DO_ZPZZ_FP(sve_fmul_b16, uint16_t, H1_2, bfloat16_mul)
|
||||
DO_ZPZZ_FP(sve_fmul_h, uint16_t, H1_2, float16_mul)
|
||||
DO_ZPZZ_FP(sve_fmul_s, uint32_t, H1_4, float32_mul)
|
||||
DO_ZPZZ_FP(sve_fmul_d, uint64_t, H1_8, float64_mul)
|
||||
|
|
@ -4661,10 +4664,12 @@ DO_ZPZZ_FP(sve_ah_fmax_h, uint16_t, H1_2, helper_vfp_ah_maxh)
|
|||
DO_ZPZZ_FP(sve_ah_fmax_s, uint32_t, H1_4, helper_vfp_ah_maxs)
|
||||
DO_ZPZZ_FP(sve_ah_fmax_d, uint64_t, H1_8, helper_vfp_ah_maxd)
|
||||
|
||||
DO_ZPZZ_FP(sve_fminnum_b16, uint16_t, H1_2, bfloat16_minnum)
|
||||
DO_ZPZZ_FP(sve_fminnum_h, uint16_t, H1_2, float16_minnum)
|
||||
DO_ZPZZ_FP(sve_fminnum_s, uint32_t, H1_4, float32_minnum)
|
||||
DO_ZPZZ_FP(sve_fminnum_d, uint64_t, H1_8, float64_minnum)
|
||||
|
||||
DO_ZPZZ_FP(sve_fmaxnum_b16, uint16_t, H1_2, bfloat16_maxnum)
|
||||
DO_ZPZZ_FP(sve_fmaxnum_h, uint16_t, H1_2, float16_maxnum)
|
||||
DO_ZPZZ_FP(sve_fmaxnum_s, uint32_t, H1_4, float32_maxnum)
|
||||
DO_ZPZZ_FP(sve_fmaxnum_d, uint64_t, H1_8, float64_maxnum)
|
||||
|
|
|
|||
|
|
@ -407,6 +407,10 @@ static bool gen_gvec_fpst_zzzp(DisasContext *s, gen_helper_gvec_4_ptr *fn,
|
|||
static bool gen_gvec_fpst_arg_zpzz(DisasContext *s, gen_helper_gvec_4_ptr *fn,
|
||||
arg_rprr_esz *a)
|
||||
{
|
||||
/* These insns use MO_8 to encode BFloat16. */
|
||||
if (a->esz == MO_8 && !dc_isar_feature(aa64_sve_b16b16, s)) {
|
||||
return false;
|
||||
}
|
||||
return gen_gvec_fpst_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0,
|
||||
a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
|
||||
}
|
||||
|
|
@ -4206,13 +4210,21 @@ TRANS_FEAT_NONSTREAMING(FTSMUL, aa64_sve, gen_gvec_fpst_arg_zzz,
|
|||
s->fpcr_ah ? name##_ah_zpzz_fns[a->esz] : \
|
||||
name##_zpzz_fns[a->esz], a)
|
||||
|
||||
DO_ZPZZ_FP(FADD_zpzz, aa64_sve, sve_fadd)
|
||||
DO_ZPZZ_FP(FSUB_zpzz, aa64_sve, sve_fsub)
|
||||
DO_ZPZZ_FP(FMUL_zpzz, aa64_sve, sve_fmul)
|
||||
/* Similar, but for insns where sz == 0 encodes bfloat16 */
|
||||
#define DO_ZPZZ_FP_B16(NAME, FEAT, name) \
|
||||
static gen_helper_gvec_4_ptr * const name##_zpzz_fns[4] = { \
|
||||
gen_helper_##name##_b16, gen_helper_##name##_h, \
|
||||
gen_helper_##name##_s, gen_helper_##name##_d \
|
||||
}; \
|
||||
TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a)
|
||||
|
||||
DO_ZPZZ_FP_B16(FADD_zpzz, aa64_sve, sve_fadd)
|
||||
DO_ZPZZ_FP_B16(FSUB_zpzz, aa64_sve, sve_fsub)
|
||||
DO_ZPZZ_FP_B16(FMUL_zpzz, aa64_sve, sve_fmul)
|
||||
DO_ZPZZ_AH_FP(FMIN_zpzz, aa64_sve, sve_fmin, sve_ah_fmin)
|
||||
DO_ZPZZ_AH_FP(FMAX_zpzz, aa64_sve, sve_fmax, sve_ah_fmax)
|
||||
DO_ZPZZ_FP(FMINNM_zpzz, aa64_sve, sve_fminnum)
|
||||
DO_ZPZZ_FP(FMAXNM_zpzz, aa64_sve, sve_fmaxnum)
|
||||
DO_ZPZZ_FP_B16(FMINNM_zpzz, aa64_sve, sve_fminnum)
|
||||
DO_ZPZZ_FP_B16(FMAXNM_zpzz, aa64_sve, sve_fmaxnum)
|
||||
DO_ZPZZ_AH_FP(FABD, aa64_sve, sve_fabd, sve_ah_fabd)
|
||||
DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
|
||||
DO_ZPZZ_FP(FDIV, aa64_sve, sve_fdiv)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue